Skip to main content
This example demonstrates how to use CSS animations with React components in Helios. By enabling autoSyncAnimations, Helios automatically controls all CSS animations on the page, making them frame-perfect and renderable.

Overview

The React CSS animation example shows how to:
  • Use standard CSS keyframes with React
  • Enable automatic animation synchronization
  • Create declarative animations without hooks or refs
  • Build reusable animated components

Setup

1

Create the HTML structure

Set up a basic HTML file with a root element for React:
2

Initialize Helios with auto sync

Configure Helios to automatically sync all CSS animations:
3

Create your React component

Build a simple component with CSS classes - no refs or hooks needed:
4

Define CSS keyframe animations

Create your animations using standard CSS:

How it works

Auto sync animations

When you enable autoSyncAnimations: true, Helios:
  1. Intercepts CSS animations: Automatically detects and controls all CSS animations and transitions
  2. Synchronizes timing: Binds animation progress to the Helios timeline
  3. Enables seeking: Allows jumping to any point in the animation
  4. Frame-perfect rendering: Ensures consistent output for video export

No hooks required

Unlike imperative animation approaches, CSS animations with Helios are completely declarative:
No need for:
  • useVideoFrame hook
  • useRef for elements
  • Manual animation calculations
  • Effect hooks for initialization

React integration benefits

  • Component-based: Encapsulate animations within components
  • Reusable: Share animated components across projects
  • Props-driven: Control animations with component props
  • SSR compatible: Works with server-side rendering

Advanced patterns

Conditional animations

Use props to conditionally apply animation classes:

Multiple animations

Combine multiple animations on a single element:

Animation composition

Sequence animations using delays:

Key concepts

  • autoSyncAnimations: Helios automatically controls all CSS animations
  • Declarative approach: Use className instead of imperative animation code
  • Zero hooks: No need for useVideoFrame or useRef
  • Standard CSS: Use regular @keyframes and animation properties

Performance considerations

  1. GPU acceleration: Use transform and opacity for best performance
  2. Avoid layout triggers: Don’t animate width, height, or position
  3. Will-change: Add will-change for complex animations
  4. Animation count: Limit simultaneous animations for smooth playback

Complete example

View the complete source code in the react-css-animation directory.

Next steps