Communitygithub.com

BintzGavin/helios-skills

用于将 Helios 与 Framer Motion 结合使用的模式。当您希望利用 Framer Motion 的物理引擎和过渡效果,同时需要与 Helios 保持逐帧完美同步时使用。

helios-skills 是什么?

该技能提供了一套清晰的集成模式,用于将 Helios(基于帧且可擦洗的动画系统)与 Framer Motion(基于时间的动画库)同步。核心方法是使用 `useVideoFrame` Hook 获取 Helios 的当前帧,然后通过 `useMotionValue` 和 `useTransform` 将这些帧数据映射为 Framer Motion 的动画值,例如旋转角度或透明度。此外,还介绍了高级用法:通过直接在 Helios 订阅中更新共享的 `MotionValue`,可以避免 React 组件不必要的重新渲染,从而在深层组件树中获得更好的性能。该技能适用于 React 项目,并提供了完整的代码示例和示例源文件。

兼容平台✓Claude Code~Codex CLI~Cursor
npx skills add https://github.com/BintzGavin/helios-skills/tree/HEAD/skills/examples/framer-motion

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

Framer Motion 集成

Framer Motion 动画通常是基于时间的。为了将它们与 Helios(基于帧且可擦洗的)同步,您必须将 Helios 的帧状态映射到 MotionValue。

快速开始

1. useVideoFrame Hook

确保您拥有 useVideoFrame Hook(参见 examples/react/SKILL.md)。

2. 将帧映射到 MotionValues

使用 useTransform 将当前帧(来自 useVideoFrame)映射到动画值。

import { useMotionValue, useTransform, motion } from 'framer-motion';
import { useVideoFrame } from './hooks/useVideoFrame';

export const MyComponent = ({ helios }) => {
  // 1. 获取当前帧
  const frame = useVideoFrame(helios);

  // 2. 为帧创建一个 MotionValue
  const frameMv = useMotionValue(0);

  // 每当帧变化时同步 MotionValue
  useEffect(() => {
    frameMv.set(frame);
  }, [frame, frameMv]);

  // 3. 将帧转换为动画值
  // 示例:在 60 帧(0 到 60)内旋转 360 度
  const rotate = useTransform(frameMv, [0, 60], [0, 360]);

  // 示例:在前 30 帧内淡入
  const opacity = useTransform(frameMv, [0, 30], [0, 1]);

  return (
    <motion.div
      style={{
        width: 100,
        height: 100,
        background: 'blue',
        rotate,   // 绑定转换后的值
        opacity
      }}
    />
  );
};

高级:手动设置 MotionValue

为了在深层树中获得更好的性能,可以直接在订阅中更新共享的 MotionValue,从而避免 React 状态更新。

const frameMv = useMotionValue(0);

useEffect(() => {
  const unsubscribe = helios.subscribe((state) => {
    // 直接更新 MotionValue - 无需 React 重新渲染!
    frameMv.set(state.currentFrame);
  });
  return unsubscribe;
}, [helios, frameMv]);

const x = useTransform(frameMv, [0, 100], [0, 500]);

return <motion.div style={{ x }} />;

源文件

  • 示例:examples/framer-motion-animation/

Individual skills in this repo

This repo contains 9 individual skills — each has its own dedicated page.

BintzGavin/helios-skills

Make a video, MP4, GIF, animation, music video, short film, explainer, chart animation, product demo, logo reveal or social clip from code. Write one HTML page that draws any frame from its time t, render it frame-exact to MP4 with Helios, check stills and contact sheets, and add a soundtrack. Use whenever the user asks for a video or an animation file.

BintzGavin/helios-skills

>- Story-first motion design philosophy for animated video: motion must earn its place; arc (establish, complicate, resolve); show vs tell; shots as units of thought; quiet vs loud motion; Disney principles with restraint; timing heuristics; composition; grammar by medium (product demos, logos, data viz, explainers); technical commitments (deterministic time, scrubbability, refs); cutting discipline; explicit anti-patterns. Use when planning, storyboarding, critiquing, or implementing programmatic or motion-driven video (Helios, Remotion, explainers, loops, UI capture, logo reveals), or when the user asks for motion direction, pacing, or visual-story structure.

BintzGavin/helios-skills

>- End-to-end production plan template for feeling-first cinematic product promos: brief interrogation, 45s beat structure (cold open through brand), hero-element metaphor, storyboard fidelity ladder, visual system (palette, type, camera, texture), motion mix and easing vocabulary, audio and captions, tooling (animatic through HTML or AE), deliverables matrix, accessibility, review milestones, and compromises to accept or refuse. Use when planning, pitching, storyboarding, or producing polished brand films for any SaaS or consumer product—not category-specific; pair with skills/design/animated-video-philosophy for broader motion principles.

BintzGavin/helios-skills

Patterns for using Helios with GSAP (GreenSock). Use when integrating GSAP timelines with the Helios timeline for precise scrubbing and rendering.

BintzGavin/helios-skills

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.

BintzGavin/helios-skills

Motion design framework for programmatic video. Defines anti-slideshow architecture, visual layering, physics-based easing, choreography rules, and quality validation. Reference this skill from any guided video skill.

BintzGavin/helios-skills

End-to-end guided workflow for creating a promotional hype video. Extracts brand identity from the repo, generates beat-synced music, and produces a high-energy motion.dev composition rendered via Helios CLI. Use when making brand-aligned promo or hype videos.

BintzGavin/helios-skills

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.

BintzGavin/helios-skills

Workflow for rendering a Helios composition to a video file. Use when you need to automate video production or export a high-quality animation.

相关技能