Background Triggers
Not every action needs a click or hover. Sometimes you want things to happen automatically — a countdown timer, an automatic scene change when a score threshold is reached, or a sound that plays when participants enter a scene. That's what background triggers are for.
Background triggers can be attached to any element. A shape, an image, a drop, an audio element — any of them can carry timer, variable-change, or activation triggers alongside their normal click and hover actions.
Key Background Triggers
Timer Trigger
The timer trigger fires at a regular interval. It's the heartbeat of any time-based interaction.
Configuration:
- Interval: How often it fires (in milliseconds). 1000ms = once per second.
- Initial delay: Wait before the first fire. Useful for giving participants time to orient before a countdown starts.
- Repeat count: Fire exactly N times, then stop. A 10-second countdown fires 10 times at 1000ms intervals.
- Repeat while: Keep firing as long as a condition is true. The timer stops automatically when the condition becomes false.
- On stop action: An action that fires when the timer stops (either by reaching its repeat count or when the repeat-while condition becomes false).
Example — 30-second countdown:
- Select any element (e.g., a text shape that displays the time)
- Add a Set Variable action with a Timer trigger
- Set interval to 1000ms, repeat count to 30
- Operation: subtract 1 from
$timeRemaining(which starts at 30) - On stop: switch to "Time's Up" scene
Variable Change Trigger
Fires when a specific variable's value changes. This is the reactive programming model — "when this data changes, do something."
Configuration:
- Watch variable: The variable name to monitor
Example — score threshold:
- Select any element on the scene
- Add a Scene Switch action with a Variable Change trigger
- Set watch variable to
$score - Add condition:
$score >= 10 - When the score reaches 10, automatically switch to the results scene
Activation Trigger
Fires when the element becomes visible — typically when the scene containing it loads. This effectively means "when this scene starts."
Example — auto-play background music:
- Add an audio element with your background music
- Add a Sound action with an Activation trigger
- Set operation to Play, enable Loop, set volume to 0.3
Common Patterns
Countdown Timer
Setup: A text element to display the time, with a timer trigger attached.
- Create variable
$timeLeft(number, default: 60) - On the text element: Timer trigger, interval 1000ms, repeat while
$timeLeft > 0 - Action: Subtract 1 from
$timeLeft - On stop: Scene switch to "Time's Up" scene
- The text element displays
$timeLeft— updates reactively
Auto-Advance Slideshow
Setup: Any element on each scene carries the trigger.
- Add an Activation trigger with 5000ms delay to an element
- Action: Scene Switch to Next
- Set
oneTimeOnlyto prevent re-triggering if the scene is revisited
Each scene loads, waits 5 seconds, then advances to the next.
Score Tracker with Milestones
Setup: Attach variable-change triggers to the elements that react to each milestone.
- Badge image 1: Variable Change trigger watching
$score, condition$score == 5- Action: Show "Bronze Badge" layer
- Badge image 2: Variable Change trigger watching
$score, condition$score == 10- Action: Show "Silver Badge" layer + celebration (confetti)
- Badge image 3: Variable Change trigger watching
$score, condition$score == 20- Action: Show "Gold Badge" layer + celebration (explosive confetti)
Game Loop
Setup: A "Start" button element carries the timer trigger.
- Create variable
$gameRunning(boolean, default: false) - Start button: on click, set
$gameRunningto true - Same element: Timer trigger, interval 50ms, repeat while
$gameRunning == true - Action chain: Update positions, check collisions, update score
- "Stop" button: Set
$gameRunningto false (timer stops automatically)
Timed Events in Sequence
Setup: An element with an activation trigger and chained delays.
- Activation trigger, delay 0ms: Play intro sound
- Chain, delay 2000ms: Show welcome text layer
- Chain, delay 5000ms: Show instructions layer
- Chain, delay 10000ms: Start the activity timer
The activation trigger fires on scene load, then the chain plays out with precise timing.
Breakout Timer
Setup: Any element with a Breakouts Activated trigger.
- Breakouts Activated trigger on an element
- Action: Set
$breakoutTimeLeftto 300 (5 minutes) - Chain: Timer trigger, interval 1000ms, repeat while
$breakoutTimeLeft > 0 - Subtract 1 from
$breakoutTimeLefteach tick - On stop: Disable breakouts + switch to debrief scene
Tips
- Attach triggers to related elements: Put a countdown timer on the text element that displays it. Put an activation trigger on the audio element it plays. This keeps your Ripple organised and easy to debug.
- Timer intervals: For smooth animations, use 50ms intervals. For countdowns, use 1000ms. For periodic checks, 500-2000ms is usually sufficient. Avoid very fast intervals (under 50ms) as they can affect performance.
- Activation vs Timer: Use Activation for one-time scene-load actions. Use Timer for repeated actions. Don't use a Timer with repeat count of 1 — just use Activation with a delay instead.
- Variable Change is reactive: It only fires when the value actually changes. Setting a variable to its current value does not trigger it.
What's Next?
- Triggers — the complete trigger reference
- Variables and Expressions — the data that drives background logic
- Actions Overview — the full action system