The keyframe effect — the target, keyframes, and timing that together make up one
animation, the unit the SkenraAnimatable family composes.
JavaScript API:
SkenraKeyframeEffect
A keyframe effect bundles what is animated (a target and its keyframes) with how
long it takes (the timing). It has no element of its own: a single top-level effect
is transparent — an sk-animation directly IS the keyframe effect, with its
sk-keyframe children as the keyframes, its timing as the effect's timing, and
its host node as the target.
Key attributes. The effect's controls are the animation's timing (duration,
iterations, direction, easing, delay) plus its keyframes; the target is the
element the animation applies to. composite decides how the effect stacks with
others on the same property (replace, add, accumulate) when several animate it at
once.
Related. It is embodied by an sk-animation with sk-keyframe
children. Multiple effects compose in parallel via sk-group-effect or in
sequence via sk-sequence-effect.
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.
<!-- A keyframe effect is the target + keyframes + timing of an animation.
Declaratively it IS the <sk-animation> element: its <sk-keyframe>
children are the keyframes, its attributes are the timing, and its host
element is the target. -->
<sk-scene>
<sk-plain-material id="mat" base-color="#7fa8d8"></sk-plain-material>
<sk-sphere radius="1" segments="6">
<sk-surface-paint material="#mat"></sk-surface-paint>
<sk-animation duration="1000ms" iterations="Infinity" direction="alternate">
<sk-keyframe offset="0" x="0"></sk-keyframe>
<sk-keyframe offset="1" x="2"></sk-keyframe>
</sk-animation>
</sk-sphere>
</sk-scene>
| Attribute | Type | Default | Description |
|---|---|---|---|
id |
<id> |
— | The element's unique identifier — the standard HTML global id attribute. |
iterations |
<iteration-count> (<number> | |
— | attribute only |
direction |
<playback-direction> ("normal" | "reverse" | "alternate" | "alternate-reverse") |
— | attribute only |
fill |
<fill-mode> ("none" | "forwards" | "backwards" | "both" | "auto") |
— | attribute only |
easing |
<easing-function> |
— | attribute only |
composite |
<composite-operation> ("replace" | "add" | "accumulate") |
— | Gets the composite operation for this effect per Web Animations spec §5.3.2. |