CSS animations
Standard CSS@keyframes animations work natively with Helios when autoSyncAnimations is enabled.
Basic CSS animation
autoSyncAnimations: true, Helios automatically:
- Discovers all CSS animations via
document.getAnimations() - Sets
animation.currentTimeto match the timeline - Pauses animations to prevent drift
packages/core/src/drivers/DomDriver.ts:372 for the WAAPI sync implementation.
Animation timing
CSS animation duration maps directly to composition time:- Frame 0: Animation at 0% (start state)
- Frame 45: Animation at 50% (1.5 seconds)
- Frame 90: Animation at 100% (end state)
Animation delay
Multiple animations
Web Animations API (WAAPI)
The Web Animations API provides programmatic animation control while still using the browser’s rendering engine.Creating WAAPI animations
Manual WAAPI control
WithoutautoSyncAnimations, you can manually control WAAPI animations:
Shadow DOM support
Helios automatically discovers animations in Shadow DOM when using DomDriver:DomDriver.ts:120).
Animation libraries
Helios works with popular animation libraries that use WAAPI under the hood or provide time-based APIs.GSAP
- Time-based (recommended)
- With autoSyncAnimations
examples/gsap-animation/ for a complete example.
Framer Motion
examples/framer-motion-animation/ for details.
Motion One
examples/motion-one-animation/.
Lottie
examples/lottie-animation/.
Animation helpers
Helios provides utility functions for common animation patterns.Interpolate
Map input values to output values with easing:packages/core/src/animation.ts:20:
- Basic
- Multi-segment
- Extrapolation
Spring
Physics-based spring animations:animation.ts:136 for physics implementation.
Calculate spring duration
Sequencing
Coordinate animations across time.Sequence helper
packages/core/src/sequencing.ts:20 for implementation.
Series helper
Place items sequentially:Stagger helper
Stagger animations by a fixed interval:Canvas and procedural animation
For canvas-based compositions, you control the render loop:examples/p5-canvas-animation/ and examples/pixi-canvas-animation/ for library integrations.
Easing functions
Helios provides common easing functions:packages/core/src/easing.ts for the full list.
Best practices
Prefer CSS for simple animations
Use will-change for better performance
Avoid layout thrashing
Use hardware-accelerated properties
Prefertransform and opacity over layout-affecting properties:
Next steps
- Explore drivers to understand time control
- Learn about timeline control for playback
- See compositions for project structure