SkenraAnimatable

← prev index next →

The base concept for animation & effects: driving an element's properties over time.

Remarks

Almost everything in a Skenra scene is animatable — nodes, materials, paints, fields — meaning its properties can change over time. Animation follows the Web Animations model: a set of keyframes and timing (duration, iterations, direction, easing) drive an element's properties, with each keyframe setting the values at its offset.

Member elements. sk-animation is a timed keyframe track that targets the element it belongs to; sk-keyframe is one keyframe of that track. sk-keyframe-effect bundles a target, keyframes, and timing into a reusable effect; sk-group-effect runs several effects in parallel and sk-sequence-effect runs them one after another.

The example bobs a sphere up and down forever with a two-keyframe animation.

Abstract base class — not instantiated directly. Construct one of its concrete subclasses; this class contributes the members below to them.

Properties

Other Properties

PropertyTypeDefaultDescriptionDeclared by
sceneread-only any Gets the Scene this animatable belongs to, if any. SkenraAnimatable
animationsread-only SkenraAnimation[] Public getter for the animations affecting this target. SkenraAnimatable

Methods

MethodDescriptionDeclared by
animate(firstArg: TypedKeyframe<this>[] | TypedPropertyIndexedKeyframes<this> | Record<string, any> | globalThis.Keyframe[] | globalThis.PropertyIndexedKeyframes | null, secondArg?: number | KeyframeAnimationOptions | globalThis.KeyframeAnimationOptions): SkenraAnimation & Animation Creates a new SkenraAnimation for this target per Web Animations API. SkenraAnimatable
removeAnimation(animation: SkenraAnimation): boolean Removes a specific animation from this object. SkenraAnimatable
constrain(type: K, config: ConstraintConfigMap[K]): ConstraintReturnMap[K] Creates a constraint on this Animatable using a fluent API. SkenraAnimatable

Serve these docs to run the live example. WebGPU needs a secure context — open this page via grunt serve rather than double-clicking the file. The Markup tab works from disk.