Communitygithub.com

shengdabai/Tony-Claude-Code-Skills

Anime.js 適配器模式,用於 HyperFrames。用於在 HyperFrames 組合中編寫 Anime.js 動畫或時間軸、在 window.__hfAnime 上註冊動畫、使 Anime.js 可被 seek 驅動且具確定性,或將 Anime.js 範例轉譯為渲染安全的 HyperFrames HTML。

Tony-Claude-Code-Skills 是什麼?

此技能定義了在 HyperFrames 框架內使用 Anime.js 動畫庫的標準模式與合約。核心機制是透過 HyperFrames 的 clock 來驅動 Anime.js 實例,而非讓 Anime.js 自行控制時間。主要做法是在組合初始化時同步建立動畫,設定 `autoplay: false`,並將所有動畫或時間軸實例註冊到 `window.__hfAnime` 陣列中。HyperFrames 運行時會透過 adapter 呼叫每個註冊實例的 `seek(timeMs)` 方法來控制時間進度。文件明確區分適合 Anime.js 的場景(如小型 SVG/DOM 修飾、多個獨立微型動畫)與應該避免的情況(如依賴預設的 `autoplay`、使用非確定性回呼、建立無限循環)。同時也強調,對於複雜場景,除非使用者特別指定,否則 GSAP 仍是 HyperFrames 的主要創作路徑。此技能支援 HyperFrames 平台,並提供了基本實例、時間軸以及 ES 模組建置的完整範例。

相容平台✓Claude Code~Codex CLI~Cursor
npx skills add https://github.com/shengdabai/Tony-Claude-Code-Skills/tree/HEAD/skills/hyperframes-animejs

在你喜歡的 AI 中提問

開啟一個已預先載入此 Agent Skill 的新對話。

說明文件

HyperFrames 的 Anime.js 適配器

HyperFrames 可以透過其 animejs 運行時適配器來控制 Anime.js 實例。組合擁有動畫物件,而 HyperFrames 擁有時鐘。

合約

  • 在組合初始化期間同步建立動畫或時間軸。
  • 設定 autoplay: false,以防止 Anime.js 使用自己的時鐘。
  • 將每個回傳的動畫或時間軸註冊到 window.__hfAnime。
  • 使用有限的持續時間和循環次數。
  • 避免依賴於真實時間、網路狀態或非種子隨機性來操作 DOM 的回呼。

適配器會對每個已註冊的實例呼叫 instance.seek(timeMs),其中 timeMs 是以毫秒為單位的 HyperFrames 時間。

基本模式

<script src="https://cdn.jsdelivr.net/npm/[email protected]/lib/anime.iife.min.js"></script>
<script>
  const anim = anime({
    targets: ".mark",
    translateX: 280,
    rotate: "1turn",
    opacity: [0, 1],
    duration: 1200,
    easing: "easeOutExpo",
    autoplay: false,
  });

  window.__hfAnime = window.__hfAnime || [];
  window.__hfAnime.push(anim);
</script>

時間軸模式

<script>
  const tl = anime.timeline({
    autoplay: false,
    easing: "easeOutCubic",
  });

  tl.add({
    targets: ".title",
    translateY: [40, 0],
    opacity: [0, 1],
    duration: 650,
  }).add(
    {
      targets: ".accent",
      scaleX: [0, 1],
      duration: 450,
    },
    250,
  );

  window.__hfAnime = window.__hfAnime || [];
  window.__hfAnime.push(tl);
</script>

模組建置

如果你使用 ES 模組建置,適配器不關心實例是如何建立的。它只需要回傳的物件公開 seek()、pause(),最好還有 play() 方法:

<script type="module">
  import { animate } from "https://cdn.jsdelivr.net/npm/animejs/+esm";

  const anim = animate(".chip", {
    x: "18rem",
    duration: 900,
    autoplay: false,
  });

  window.__hfAnime = window.__hfAnime || [];
  window.__hfAnime.push(anim);
</script>

適用場景

  • Anime.js 語法簡潔的小型 SVG 和 DOM 修飾。
  • 可以改造成 seek 驅動的導入式 Anime.js 範例。
  • 推入同一個註冊表的多個獨立微型動畫。

除非使用者特別要求使用 Anime.js,否則對於複雜場景序列請使用 GSAP。GSAP 仍是 HyperFrames 的主要創作路徑。

避免

  • 保留 autoplay 為 Anime.js 的預設值。
  • 依賴 anime.running 自動發現,而非明確的 window.__hfAnime.push(...)。
  • 無限循環。請根據組合持續時間計算一個有限的重複次數。
  • 在計時器、Promise、事件處理器或非同步資源載入後建立動畫。

驗證

編輯使用 Anime.js 的組合後:

npx hyperframes lint
npx hyperframes validate

鳴謝與參考

  • HyperFrames 適配器程式碼:packages/core/src/runtime/adapters/animejs.ts。
  • 關於 autoplay、pause() 和 seek() 的 Anime.js 文件:https://animejs.com/documentation/

Individual skills in this repo

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

shengdabai/Tony-Claude-Code-Skills

Downloads videos from YouTube and other platforms for offline viewing, editing, or archival. Handles various formats and quality options.

shengdabai/Tony-Claude-Code-Skills

接收抖音、小红书、微信视频号等短视频链接或分享文案,查询作品/账号数据并提取语音文字稿,按作者和标题归档为 Markdown。用户希望完整解析短视频、取得数据或文字稿时使用;运行前检查 TikHub 与轻抖使用凭证,缺少时用新手能理解的方式引导购买和安全配置。

shengdabai/Tony-Claude-Code-Skills

Read-only queue dashboard for workspace-aware ship. (gstack)

shengdabai/Tony-Claude-Code-Skills

Author a new HyperFrames registry block (caption style, VFX block, transition, lower third) or component (text effect, overlay, snippet) and ship it as an upstream PR to the hyperframes repo. Use ONLY when the user wants to CONTRIBUTE to the public catalog — for in-project caption/transition authoring use the `hyperframes` skill, for installing existing registry items use the `hyperframes-registry` skill.

shengdabai/Tony-Claude-Code-Skills

CSS animation adapter patterns for HyperFrames. Use when authoring CSS keyframes, animation-delay based timing, animation-fill-mode, animation-play-state, or CSS-only motion that HyperFrames must seek deterministically during preview and rendering.

shengdabai/Tony-Claude-Code-Skills

GSAP animation reference for HyperFrames. Covers gsap.to(), from(), fromTo(), easing, stagger, defaults, timelines (gsap.timeline(), position parameter, labels, nesting, playback), and performance (transforms, will-change, quickTo). Use when writing GSAP animations in HyperFrames compositions.

shengdabai/Tony-Claude-Code-Skills

HyperFrames CLI dev loop — `npx hyperframes` for scaffolding (init), validation (lint, inspect), preview, render, and environment troubleshooting (doctor, browser, info, upgrade). Use when running any of these commands or troubleshooting the HyperFrames build/render environment. For asset preprocessing commands (`tts`, `transcribe`, `remove-background`), invoke the `hyperframes-media` skill instead.

shengdabai/Tony-Claude-Code-Skills

Asset preprocessing for HyperFrames compositions — text-to-speech narration (Kokoro), audio/video transcription (Whisper), and background removal for transparent overlays (u2net). Use when generating voiceover from text, transcribing speech for captions, removing the background from a video or image to use as a transparent overlay, choosing a TTS voice or whisper model, or chaining these (TTS → transcribe → captions). Each command downloads its own model on first run.

相關技能