Skip to main content

Animations

caution

This document is a WORK IN PROGRESS

Animation via code

Animation is built on top of a generic interpolator system. The idea is that you give the system a struct of type

InterpolatorSpec<T> where T : unmanaged

or

InterpolationSpec<T, TStorage> where T : unmanaged where TStorage : unmanaged

the interpolation spec object includes some fields for customizing the animation

    Interpolator<T> interpolator -- a managed class that executes the animation
AnimationSettings settings;
int delayMS; time in milliseconds the animation should run
int iterationCount; number of times to run the animation
AnimationFillMode fillMode; when the animation starts and stops applying its properties to the element
this is a flags field so you can combine multiple values here to mix and match behavior

Default - equal to UntilCompleted
BeforeStart - apply properties while animation is the start delay phase
AfterCompleted - apply properties even after the animation finishes
WhilePlaying - apply properties while animation is running but not delayed
WhileDelaying - apply properties while animation is delaying
UntilCompleted = BeforeStart | WhileDelaying | WhilePlaying,
Always = UntilCompleted | AfterCompleted

AnimationDirection direction;

We ship with four preconfigured variations of animation. This covers 99% of the things people want to do with animations

Curve -- executes an animation along a Unity AnimationCurve asset Tween -- Standard tweening / easing implementation that accepts either a Bezier or an EasingFunction value Spring -- spring physics based animation Keyframe -- explicit keyframe interpolation

Custom