example-framer-motion
Framer Motion Integration
Framer Motion animations are typically time-based. To synchronize them with Helios (which is frame-based and scrubbable), you must map the Helios frame state to MotionValues.
Quick Start
1. useVideoFrame Hook
Ensure you have the useVideoFrame hook (see examples/react/SKILL.md).
2. Map Frames to MotionValues
Use useTransform to map the current frame (from useVideoFrame) to animation values.
import { useMotionValue, useTransform, motion } from 'framer-motion';
import { useVideoFrame } from './hooks/useVideoFrame';
export const MyComponent = ({ helios }) => {
// 1. Get current frame
const frame = useVideoFrame(helios);
// 2. Create a MotionValue for the frame
const frameMv = useMotionValue(0);
// Sync MotionValue whenever frame changes
useEffect(() => {
frameMv.set(frame);
}, [frame, frameMv]);
// 3. Transform Frame -> Animation Value
// Example: Rotate 360 degrees over 60 frames (0 to 60)
const rotate = useTransform(frameMv, [0, 60], [0, 360]);
// Example: Opacity fade in over first 30 frames
const opacity = useTransform(frameMv, [0, 30], [0, 1]);
return (
<motion.div
style={{
width: 100,
height: 100,
background: 'blue',
rotate, // Bind transformed value
opacity
}}
/>
);
};
Advanced: Manual MotionValue Setting
For better performance in deep trees, update a shared MotionValue directly in the subscription, bypassing React state.
const frameMv = useMotionValue(0);
useEffect(() => {
const unsubscribe = helios.subscribe((state) => {
// Update MotionValue directly - no React re-render!
frameMv.set(state.currentFrame);
});
return unsubscribe;
}, [helios, frameMv]);
const x = useTransform(frameMv, [0, 100], [0, 500]);
return <motion.div style={{ x }} />;
Source Files
- Example:
examples/framer-motion-animation/
More from bintzgavin/helios-skills
helios-skills
Collection of agent skills for Helios video engine. Use when working with programmatic video creation, browser-native animations, or Helios compositions. Install individual skills by path for specific capabilities.
69render-video
Workflow for rendering a Helios composition to a video file. Use when you need to automate video production or export a high-quality animation.
4guided-explainer-video
End-to-end guided workflow for creating an explainer or walkthrough video. Extracts brand identity from the repo, generates a measured soundtrack, and produces a narrative-driven motion.dev composition rendered via Helios CLI. Use when making how-it-works, feature walkthrough, or educational videos.
4guided-testimonial-video
End-to-end guided workflow for creating a social proof or testimonial video. Extracts brand identity from the repo, generates a warm soundtrack, and produces a trust-building motion.dev composition rendered via Helios CLI. Use when making customer testimonial, review highlight, or social proof videos.
4guided-social-clip
End-to-end guided workflow for creating a short-form social media clip (Reels, TikTok, Shorts). Extracts brand identity from the repo, generates a punchy soundtrack, and produces a vertical 9:16 motion.dev composition rendered via Helios CLI. Use when making Instagram Reels, TikTok videos, YouTube Shorts, or other vertical short-form content.
4helios-getting-started
Installation and quick start guide for Helios video engine. Use when setting up a new Helios project, installing packages, or creating your first composition. Covers package installation, requirements, basic setup, and initial composition structure.
2