Communitygithub.com

BintzGavin/helios-skills

使用 Framer Motion 的物理引擎與轉場效果,並與 Helios 保持幀同步的模式。

helios-skills 是什麼?

此技能提供將 Framer Motion 動畫與 Helios 幀同步的整合模式。Framer Motion 通常是基於時間的動畫,但 Helios 是基於幀且可來回拖曳的。透過將 Helios 的幀狀態映射到 Framer Motion 的 MotionValue,開發者可以實現幀完美同步的動畫。此技能支援 React 環境,並提供 `useVideoFrame` Hook 與 `useTransform` 的實作範例。它還包含進階效能優化技巧,例如直接在 Helios 訂閱中手動更新 MotionValue,以跳過 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. 將幀映射到 MotionValue

使用 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 幀內旋轉 360 度(0 到 60)
  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.

相關技能