Communitygithub.com

shengdabai/Tony-Claude-Code-Skills

用于 HyperFrames 的 Anime.js 适配器模式。在编写 HyperFrames 合成中的 Anime.js 动画或时间线时使用,注册动画到 window.__hfAnime,使 Anime.js 变为基于 seek 驱动且确定性的,或将 Anime.js 示例转换为渲染安全的 HyperFrames HTML。

Tony-Claude-Code-Skills 是什么?

该技能描述了如何在 HyperFrames 中正确集成和使用 Anime.js 动画库。HyperFrames 通过其运行时适配器接管动画时钟,开发者需要在合成初始化期间创建动画实例,并设置 autoplay: false 以便由 HyperFrames 驱动 seek。所有创建的动画必须显式注册到 window.__hfAnime 数组中,适配器会通过 seek(timeMs) 方法控制动画进度,其中 timeMs 是 HyperFrames 的时间毫秒数。支持独立动画和时间线模式,同时兼容 ES 模块构建。该技能适用于需要在 HyperFrames 中使用 Anime.js 进行小型 SVG 和 DOM 效果渲染的场景,是让外部动画库在 HyperFrames 确定性时钟下工作的标准化方法。

兼容平台✓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 运行时适配器来 seek Anime.js 实例。合成过程拥有动画对象;HyperFrames 拥有时钟。

约定

  • 在合成初始化期间同步创建动画或时间线。
  • 设置 autoplay: false,以便 Anime.js 不在其自己的时钟上推进。
  • 将每个返回的动画或时间线注册到 window.__hfAnime 上。
  • 使用有限的持续时间和循环次数。
  • 避免基于挂钟时间、网络状态或未播种随机数来突变 DOM 的回调。

适配器通过 instance.seek(timeMs) 来 seek 每个注册的实例,其中 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>

良好用途

  • 小型 SVG 和 DOM 装饰,其中 Anime.js 语法简洁。
  • 导入的 Anime.js 示例,可以使其变为基于 seek 驱动。
  • 多个独立的微动画推入同一个注册表中。

对于复杂的场景序列,除非用户特别要求使用 Anime.js,否则请使用 GSAP。GSAP 仍然是 HyperFrames 主要的创作路径。

避免

  • 将 autoply 保留为 Anime.js 的默认值。
  • 依赖 anime.running 自动发现而不是显式的 window.__hfAnime.push(...)。
  • 无限循环。从合成持续时间计算出有限的重复次数。
  • 在定时器、Promise、事件处理器或异步资源加载后构建动画。

验证

编辑使用 Anime.js 的合成后:

npx hyperframes lint
npx hyperframes validate

致谢与参考

  • HyperFrames 适配器源代码:packages/core/src/runtime/adapters/animejs.ts。
  • Anime.js 关于 autoplay、pause() 和 seek() 的文档: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.

相关技能