Setup
Install Helios core and Svelte dependencies:Implementation
Store for frame synchronization
Create a Svelte readable store to subscribe to Helios frame updates:readable store initializes with the current Helios state and updates whenever Helios emits new state. The cleanup function is automatically called when all subscribers unsubscribe.
Main component
Build your composition using Svelte’s template syntax and reactive store bindings:Key Svelte patterns
Store-based state management
ThecreateHeliosStore function wraps Helios in a Svelte readable store. Use the $ prefix to automatically subscribe and access store values in templates.
Style directives
Svelte’sstyle:property syntax provides a clean way to apply dynamic styles. Each style property is independently reactive and updates only when its value changes.
Direct store access in templates
The$heliosStore syntax automatically subscribes to the store and provides reactive access to its value. No manual subscription management is needed in the component.
Global and scoped styles
Combine:global() selectors for app-level styles with component-scoped styles for encapsulated, maintainable CSS.
Usage
Run the development server:window.helios for debugging and player control.