Interaction examples
A complete create call for each trigger type. For every field and value, see Interaction schema.
Each example assumes the site has exactly one hero-btn class, and limits the interaction to the current page.
Click
A from-to fade that starts at 0% keeps the element hidden until the first click.
Hover
Two triggers, one for enter and one for leave. Each routes to its own timeline with assignedGroupId.
The same result with one trigger and two timeline roles:
Page load
Scroll
Play once as the element enters the viewport. The from tween (tt: 1) starts the element hidden.
Scrub with the scroll position. A scrub needs canvasDuration: 1 on the timeline and duration: 1 on the action.
Mouse move
wf:viewport tracks the cursor across the whole page. Each timeline has its own role.
Custom event
Fire the event from code on the published page, after interactions load. A DOM event does not play it.
Class change
A Set action (tt: 3) that adds a class. selectors takes style block ids, not class slugs.
When a saved interaction does not play
- A custom event trigger has no
eventName, or the page dispatches a DOM event instead of callingemit. - The action has
hidden: true. - A from-to fade starts at
0%, so the element stays hidden until the trigger fires. This is expected.