public sealed class AnimatorRuns transitions, and hands the cascade the values they are currently at.
No guide page documents this yet — the page shows what the code says about itself.
Remarks
A transition is started by a comparison, not by an event. When an element's style is resolved, the animator is shown the value the cascade arrived at and the value the element is currently displaying; where they differ and a transition rule covers the property, it starts one. That is what makes transitions work for any cause of change — a class toggled, a stylesheet reloaded, a parent's inherited colour moving — rather than only for the ones somebody remembered to hook.
Interrupting one is the case that separates a good implementation from a bad one. Hovering away halfway through a fade must reverse from where it actually is, not from where it started, and must not take the full duration to travel the half it has left. A new transition therefore begins at the running one's current value and is given a duration scaled by how far it still has to go.
Time is passed in rather than read. The animator has no clock, which is what lets a test step it through a fade deterministically and what lets the engine drive it from the fixed step in Vixen.Engine without this project knowing that exists.
Fields and properties (4)
public int RunningCountHow many transitions are running.
public int AnimationCountHow many animations are running, over every element.
public int AnimatedElementCountHow many elements have an animation on them.
public bool IsIdleWhether anything is running, and therefore whether a frame needs to restyle.
Methods (8)
public Animator(NameTable properties, NameTable values, NameTable keywords, KeyframesTable keyframes)Creates an animator.
public void Observe(StyleNodeId element, ComputedStyle? before, ComputedStyle after, float now)Notices what a newly resolved style changed, and starts transitions for it.
public int Advance(float now)Discards everything that has arrived.
public bool TryGetAnimated(StyleNodeId element, int property, float now, out StyleValue value)The value a keyframe animation puts a property at, if one does.
public bool TryGetCurrent(StyleNodeId element, int property, float now, out StyleValue value)The value a property is currently displaying, if it is mid-transition.
public ComputedStyle Apply(StyleNodeId element, ComputedStyle style, float now)Overlays the running transitions onto a style, as CSS's transition tier.
public void Clear()Forgets everything, as a stylesheet reload must.
public void Compact(ReadOnlySpan<int> remap)Moves what is running to follow a compacted tree.
Used by (4)
- AnimationTestsVixen.Ui.Styling.Tests
- CompactionTestsVixen.Ui.Styling.Tests
- MultipleAnimationTestsVixen.Ui.Styling.Tests
- TransitionTestsVixen.Ui.Styling.Tests