WorkletAnimation Class

A worklet animation (https://drafts.css-houdini.org/css-animation-worklet-1/#worklet-animation-desc): an animation whose current time does not determine the local time of its effects. An animator, an instance of a class registered in the animation worklet of the document (CSS.animationWorklet, Document.AnimationWorklet), gets the current time of the animation at each frame and sets the local times of the effects.

public sealed class WorkletAnimation : Animation

Remarks

The animator instance exists while the animation is not idle. An effect has no local time (it is not in effect) until the animator sets it, and keeps the last one the animator set: a worklet animation that is finished still applies its effects.

See also

Inheritance
Animation WorkletAnimation

Constructors

NameDescription
WorkletAnimation(string, AnimationEffect?)Creates a worklet animation of an effect on the default timeline of the document of the current global object (https://drafts.css-houdini.org/css-animation-worklet-1/#dom-workletanimation-workletanimation).
WorkletAnimation(string, AnimationEffect?, AnimationTimeline?)Creates a worklet animation of an effect on a timeline (null for no timeline).
WorkletAnimation(string, AnimationEffect?, AnimationTimeline?, object?)Creates a worklet animation of an effect on a timeline, with the options given to the constructor of the animator (a value of the script engine, structured cloned).
WorkletAnimation(string, IReadOnlyList<AnimationEffect>)Creates a worklet animation of a group of effects, whose local times the animator sets individually, on the default timeline of the document of the current global object.
WorkletAnimation(string, IReadOnlyList<AnimationEffect>, AnimationTimeline?)Creates a worklet animation of a group of effects on a timeline (null for no timeline).
WorkletAnimation(string, IReadOnlyList<AnimationEffect>, AnimationTimeline?, object?)Creates a worklet animation of a group of effects on a timeline, with the options given to the constructor of the animator.

WorkletAnimation overloads

WorkletAnimation(string, AnimationEffect?)

WorkletAnimation.cs

Creates a worklet animation of an effect on the default timeline of the document of the current global object (https://drafts.css-houdini.org/css-animation-worklet-1/#dom-workletanimation-workletanimation).

public WorkletAnimation(string animatorName, AnimationEffect? effects = null)
Parameters
animatorName string
The name of an animator registered in the animation worklet of the document.
effects AnimationEffect?
The effect, or null.
Exceptions
TypeErrorException
No animator of the name is registered, or its registration is invalid.
See also

WorkletAnimation(string, AnimationEffect?, AnimationTimeline?)

WorkletAnimation.cs

Creates a worklet animation of an effect on a timeline (null for no timeline).

public WorkletAnimation(string animatorName, AnimationEffect? effects, AnimationTimeline? timeline)

WorkletAnimation(string, AnimationEffect?, AnimationTimeline?, object?)

WorkletAnimation.cs

Creates a worklet animation of an effect on a timeline, with the options given to the constructor of the animator (a value of the script engine, structured cloned).

public WorkletAnimation(string animatorName, AnimationEffect? effects, AnimationTimeline? timeline, object? options)
Parameters
animatorName string
effects AnimationEffect?
timeline AnimationTimeline?
options object?
Exceptions
DomException
A DataCloneError when the options cannot be cloned.
See also

WorkletAnimation(string, IReadOnlyList<AnimationEffect>)

WorkletAnimation.cs

Creates a worklet animation of a group of effects, whose local times the animator sets individually, on the default timeline of the document of the current global object.

public WorkletAnimation(string animatorName, IReadOnlyList<AnimationEffect> effects)

WorkletAnimation(string, IReadOnlyList<AnimationEffect>, AnimationTimeline?)

WorkletAnimation.cs

Creates a worklet animation of a group of effects on a timeline (null for no timeline).

public WorkletAnimation(string animatorName, IReadOnlyList<AnimationEffect> effects, AnimationTimeline? timeline)

WorkletAnimation(string, IReadOnlyList<AnimationEffect>, AnimationTimeline?, object?)

WorkletAnimation.cs

Creates a worklet animation of a group of effects on a timeline, with the options given to the constructor of the animator.

public WorkletAnimation(string animatorName, IReadOnlyList<AnimationEffect> effects, AnimationTimeline? timeline, object? options)

Properties

NameDescription
AnimatorNameGets the name of the animator of the animation (https://drafts.css-houdini.org/css-animation-worklet-1/#dom-workletanimation-animatorname).

Gets the name of the animator of the animation (https://drafts.css-houdini.org/css-animation-worklet-1/#dom-workletanimation-animatorname).

public string AnimatorName { get; }