cocos-creator-tween-anim

cocos-creator-tween-anim is a skill for Claude Code, Codex from Wade-DevCode/awesome-coding-skills-cn. It costs 33 tokens per session (4,469 once invoked), scanned A, original, MIT.

Guidance for creating and managing animations in Cocos Creator, a game-development tool. It covers tweens, frame and Spine skeletal animations, performance, and cleanup when objects are destroyed.

In plain words
What is it for?
Use it when adding interface effects, button feedback, moving rewards, frame animations, or Spine characters. It also helps investigate animation timing, frame-rate problems, and cleanup errors.
Why use it?
It helps prevent delayed animations from using deleted game objects, animations from stacking in object pools, and inconsistent or slow motion on different devices.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/wade-devcode/awesome-coding-skills-cn/cocos-creator-tween-anim
Any agent
npx skills add Wade-DevCode/awesome-coding-skills-cn --skill cocos-creator-tween-anim
Clone the repo
git clone --depth 1 https://github.com/Wade-DevCode/awesome-coding-skills-cn

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for cocos-creator-tween-anim

README.md
[![agentmods](https://agentmods.dev/badge/skills/wade-devcode/awesome-coding-skills-cn/cocos-creator-tween-anim.svg)](https://agentmods.dev/skills/wade-devcode/awesome-coding-skills-cn/cocos-creator-tween-anim)
Your own site
<a href="https://agentmods.dev/skills/wade-devcode/awesome-coding-skills-cn/cocos-creator-tween-anim"><img src="https://agentmods.dev/badge/skills/wade-devcode/awesome-coding-skills-cn/cocos-creator-tween-anim.svg" alt="Measured on agentmods" height="20"></a>
Per session 33 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 4,469 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00033 $0.04469
Opus 5 $0.00016 $0.02235
Sonnet 5 $0.00007 $0.00894
Haiku 4.5 $0.00003 $0.00447

Measured 5d ago against content hash b3a618afb4c1, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-05, from the pricing page.

Security

Grade A, and why

cocos-creator-tween-anim scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 5d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/cocos-creator-tween-anim/SKILL.md · 278 lines

How it starts

The opening of the file, as written. The whole thing — 278 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Cocos Creator 动画与缓动

何时用

  • tween 做 UI 弹出、飞金币、按钮点击反馈等动效时。
  • 使用 Animation 组件播放帧动画,或在动画结束时触发游戏逻辑时。
  • 集成 Spine 骨骼动画,遇到性能问题或换装需求时。
  • 节点销毁后控制台仍然报错(回调访问已销毁节点、tween 继续运行)时。
  • 动效卡顿、帧率与期望不符,或动画在不同帧率设备上速度不一致时。

核心规则

1. tween 用法:链式 API 做 UI 动效,销毁前必须 stopAllByTarget

规则: UI 动效优先用 tween(node).to(...).call(...).start() 链式写法;节点销毁、场景切换、或主动取消动效时,必须调用 Tween.stopAllByTarget(node) 停止该节点上所有正在运行的 tween;不要把 tween 的 .call() 回调里对节点的访问放在延迟后,而不先判断节点有效性。

为什么: 这是 Creator 项目里最高频的运行时报错来源之一。典型场景:UI 弹窗弹出动画还没播完(0.3s tween),玩家点了关闭按钮,弹窗节点被 destroy,0.3s 后 tween 的 .call() 回调执行——此时 this 或捕获的节点引用已销毁,访问任何属性都抛出 Cannot read properties of null,且错误栈指向 tween 引擎内部,极难定位。另一个常见错误:节点池归还时没有停止节点上的 tween,下次取出时旧 tween 仍在运行,与新 tween 叠加,节点产生错乱的双重动画。

怎么做:

  • 启动:tween(this.node).to(0.3, { scale: new Vec3(1,1,1) }, { easing: 'backOut' }).call(() => { this.onShowComplete(); }).start();
  • 节点销毁时:onDestroy() { Tween.stopAllByTarget(this.node); }
  • 节点池归还时(unuse):Tween.stopAllByTarget(this.node);
  • 回调内访问组件:先判断 if (!this.isValid) return;,防止节点已销毁后回调被延迟触发。
  • 需要保留 tween 引用以便手动取消:this._showTween = tween(node).to(...).start();,取消时 this._showTween?.stop();

2. Animation 组件:帧/骨骼动画播放,关键时机用帧事件而非硬编码计时

规则: 帧动画和骨骼动画的时机逻辑(播放完毕后跳转状态、攻击动画命中帧触发伤害)用 Animation 的帧事件(AnimationEvent)或 finished 事件回调触发,不用 scheduleOnce(callback, duration) 硬编码时长。

为什么: scheduleOnce(this.onAttackHit, 0.35) 是新手最常写的"动画同步"方案。问题一:动画时长一旦被美术调整(0.35s 改 0.4s),程序代码里的数字忘了改,命中判定就永远提前或延后。问题二:设备帧率波动导致动画实际播放时长和计时器有微小偏差,在帧率不稳定的低端机上累积误差很明显。问题三:两处(动画文件和代码)维护同一个时间点,必然随着版本迭代出现不同步。帧事件直接嵌入动画文件,时机和动画帧绑定,美术改动画时机会自然跟随,不需要程序同步修改代码。

怎么做:

  • 在 Creator 动画编辑器里,在攻击命中帧添加帧事件,函数名填 onHitFrame
  • 对应组件添加 onHitFrame() { this._combatSystem.applyDamage(this._target); }
  • 监听动画结束:this._anim.on(Animation.EventType.FINISHED, this.onAnimFinished, this);,在 onDestroyoff
  • 播放指定动作:this._anim.play('attack'); — 状态机切换时用 crossFade 避免切换时的一帧跳变。
  • 不在代码里硬编码任何动画时长常量,时长属于动画资源的职责,不属于逻辑代码。

3. Spine/骨骼:复用 SkeletonData,移动端控制骨骼数与换装 Mesh 合批

Read the full file on GitHub · 278 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 5d ago First seen · 278 lines · 33 tokens per session scan A b3a618afb4c1

Subscribe to this mod's changes

cocos-creator-tween-anim is a skill published in the GitHub repository Wade-DevCode/awesome-coding-skills-cn (6 stars, last pushed 2mo ago), licensed MIT. It adds 33 tokens to every session and 4,469 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

chinese-git-workflow

国内 Git 平台配置参考——Gitee、Coding.net、极狐 GitLab、CNB 的 SSH/HTTPS/凭据/CI 接入差异与镜像同步配置。仅在用户显式 /chinese-git-workflow 时调用,不要根据上下文自动触发。.

jnMetaCode/superpowers-zh · 69 tokens

brainstorming

在任何创造性工作之前必须使用此技能——创建功能、构建组件、添加功能或修改行为。在实现之前先探索用户意图、需求和设计。.

jnMetaCode/superpowers-zh · 40 tokens

chinese-commit-conventions

中文 commit 与 changelog 配置参考——Conventional Commits 中文适配、commitlint/husky/commitizen 中文模板、conventional-changelog 中文配置。仅在用户显式 /chinese-commit-conventions 时调用,不要根据上下文自动触发。.

jnMetaCode/superpowers-zh · 65 tokens

chinese-documentation

中文文档排版参考——中英文空格、全半角标点、术语保留、链接格式、中文文案排版指北约定。仅在用户显式 /chinese-documentation 时调用,不要根据上下文自动触发。.

jnMetaCode/superpowers-zh · 62 tokens

chinese-code-review

中文 review 沟通参考——话术模板、分级标注(必须修复/建议修改/仅供参考)、国内团队常见反模式应对。仅在用户显式 /chinese-code-review 时调用,不要根据上下文自动触发。.

jnMetaCode/superpowers-zh · 62 tokens

mcp-builder

MCP 服务器构建方法论 — 系统化构建生产级 MCP 工具,让 AI 助手连接外部能力.

jnMetaCode/superpowers-zh · 32 tokens