Animations API
Replay requires an existing initialized entrance animation and loaded dependencies.
Container
After revealing content, dispatch:
const container = document.querySelector('.acme-revealed-content');
container?.dispatchEvent(new CustomEvent('breakdance_play_animations', {
bubbles: true,
detail: { delay: 0 }
}));
The handler includes the target and [data-entrance] descendants. breakdance_refresh_animations cleans up instances; breakdance_reset_animations resets them. None creates missing instances; target an element supporting descendant queries.
Replay the Whole Page
document.dispatchEvent(new Event('breakdance_play_animations', { bubbles: true }));
Reset Entrance Animations
Reset returns initialized animations to their initial hidden state so they can play again when entering the viewport:
const panel = document.querySelector('.bde-accordion__panel');
panel?.dispatchEvent(new Event('breakdance_reset_animations', { bubbles: true }));
Dispatch these events on the front end after the animation scripts have initialized. Events sent from a container must bubble to reach the global listener.
One Element
const element = document.querySelector('.acme-revealed-notice');
if (element?.bdAnim) {
element.bdAnim.replay(0);
}
The DOM instance's bdAnim.replay(delay = 0) restarts its effect. Reduced-motion settings may leave bdAnim absent; keep content usable without replay. Prefer a component's visibility API when it coordinates focus/layout too.
This runtime differs from the agent's set-element-animations configuration ability.
Automatic Retriggering
Since Breakdance 2.0, Slider elements, Advanced Accordion, Tabs, and Popup automatically retrigger entrance animations when their content becomes visible, such as when a slide changes or a panel opens. Use the API when integrating your own behavior.
The canonical animation reference documents replaying a container, replaying the whole page, and resetting animations.