Skip to content

Commit

Permalink
Merge pull request #98 from threeplus/main
Browse files Browse the repository at this point in the history
Added binding to CanvasGroup.alpha
  • Loading branch information
AnnulusGames committed Mar 16, 2024
2 parents d7857eb + 0d0bc91 commit e21dd8c
Showing 1 changed file with 19 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,25 @@ public static MotionHandle BindToFillAmount<TOptions, TAdapter>(this MotionBuild
});
}

/// <summary>
/// Create a motion data and bind it to CanvasGroup.alpha
/// </summary>
/// <typeparam name="TOptions">The type of special parameters given to the motion data</typeparam>
/// <typeparam name="TAdapter">The type of adapter that support value animation</typeparam>
/// <param name="builder">This builder</param>
/// <param name="transform"></param>
/// <returns>Handle of the created motion data.</returns>
public static MotionHandle BindToCanvasGroupAlpha<TOptions, TAdapter>(this MotionBuilder<float, TOptions, TAdapter> builder, CanvasGroup canvasGroup)
where TOptions : unmanaged, IMotionOptions
where TAdapter : unmanaged, IMotionAdapter<float, TOptions>
{
Error.IsNull(canvasGroup);
return builder.BindWithState(canvasGroup, static (x, target) =>
{
target.alpha = x;
});
}

/// <summary>
/// Create a motion data and bind it to Text.fontSize
/// </summary>
Expand Down

0 comments on commit e21dd8c

Please sign in to comment.