shadow
wje-animation is a lightweight wrapper for playing Animate.css animations around slotted content. It applies keyframes to the first element in the default slot and plays them through the Web Animations API.
The example below wraps a wje-avatar in wje-animation and shows both basic animation setup through the name attribute and imperative control through play() and cancel().
- The animation is applied to the first assigned element from the default slot, so it works best with one main wrapper.
- The default animation name is
heartBeat.
- The current implementation uses
endDelay and iterationStart as camelCase attribute names.
- The host itself is not interactive; it sets
role="presentation".
- Use
getAnimationsArray() when you need to surface the available animation names in your own UI.
- Animation should support meaning, not replace it.
- In important flows, consider reduced-motion behavior.
- If the animated content is interactive, accessibility is handled by the slotted child.
- Use
play() and cancel() for repeated control.
- If you change
name at runtime, verify that the component refreshes correctly in your specific use case.
- For long-running or infinite animations, evaluate both distraction and performance, especially inside lists.
| Description | The delay before the animation starts. |
| Attribute | delay |
| Type | number |
| Default | 0 |
| Description | The playback direction of the animation. |
| Attribute | direction |
| Type | string |
| Default | normal |
| Description | The animation playback duration in milliseconds. |
| Attribute | duration |
| Type | number |
| Default | 1000 |
| Description | The easing function used by the animation playback. |
| Attribute | easing |
| Type | string |
| Default | linear |
| Description | The delay applied after the animation completes. |
| Attribute | endDelay |
| Type | number |
| Default | 0 |
| Description | The fill mode used by the animation playback. |
| Attribute | fill |
| Type | string |
| Default | auto |
| Description | The number of animation repetitions. |
| Attribute | iterations |
| Type | string|number |
| Default | - |
| Description | The starting offset for the first animation iteration. |
| Attribute | iterationStart |
| Type | number |
| Default | 0 |
| Description | The Animate.css animation name played on the slotted element. |
| Attribute | name |
| Type | string |
| Default | heartBeat |
No events available for this component.
| Description | Method to fetch and parse the animations array from a CSS file. |
| Signature | () => Array |
| Description | Terminates and cleans up the currently active animation if it exists. Calls the cancel method to stop the animation process. |
| Signature | () => void |
| Description | Plays the currently assigned animation, if available. |
| Signature | () => void |
| Description | Cancels the current animation if it is initialized and has a cancel method. Logs a warning if the animation is not initialized or the cancel method is unavailable. |
| Signature | () => void |
No CSS shadow parts available for this component.
No CSS custom properties available for this component.
| Name | Description |
|---|
default | Default slot for the main component content. |