AnimationWorkletGlobalScope Class

The global object of an animation worklet (https://drafts.css-houdini.org/css-animation-worklet-1/#animationworkletglobalscope): the scripts added to CSS.animationWorklet register the animators of the WorkletAnimation objects.

public sealed class AnimationWorkletGlobalScope : WorkletGlobalScope
Inheritance
WorkletGlobalScope AnimationWorkletGlobalScope

Methods

NameDescription
RegisterAnimator(string, WorkletClassConstructor)Registers a class whose instances drive the effects of the worklet animations of the name (https://drafts.css-houdini.org/css-animation-worklet-1/#dom-animationworkletglobalscope-registeranimator).

RegisterAnimator(string, WorkletClassConstructor)

AnimationWorklet.cs

Registers a class whose instances drive the effects of the worklet animations of the name (https://drafts.css-houdini.org/css-animation-worklet-1/#dom-animationworkletglobalscope-registeranimator).

public void RegisterAnimator(string name, WorkletClassConstructor animatorCtor)

Parameters

name string
The name of the animator: an identifier.
animatorCtor WorkletClassConstructor
The class: its prototype has the animate callback, and a state function when the animator is stateful.

Exceptions

TypeErrorException
The name is not an identifier, the value is not a constructor, or its prototype has no animate function.
DomException
A NotSupportedError when the name is already registered in the global scope.

See also