Skip to main content

Custom Animation Handler Function

In addition to relying on Milease to compute animation operations, you can insert a custom animation handler function at any point:

text.Milease((e) =>
{
e.Target.text = $"Current animation progress: {e.Progress:P}...";
}, [resetFunction], [duration], [offset], [easeFunction], [easeType])

Milease will process the animation progress using the provided easeFunction and easeType, and then pass it to your custom handler function.

The custom handler function receives a MilHandleFunctionArgs context, which includes:

  • Progress: Animation progress (0–1)
  • Target: The target object specified when constructing the animation
  • Animation: Additional animation-related information
  • Animator: The associated animation controller
info
  • During a reset operation, the custom handler function will invoke the resetFunction. You must implement the reset logic within this function. If null is passed, no operation will be performed during reset.

  • If you need to use the same handleFunction for a specific class of objects or properties, refer to Custom Converters.