Index of every page on this site: llms.txt
All skills
oahc09 avatar

/cocosair-animation-tween

@ed38648
by oahc09oahc09/cocosairjs3 stars
2
Run it yourself

Animate tweens and AnimationClip tracks with one step clock. Use to loop a sequence on a target, reverseTime, clean up playback or diagnose unavailable pose graphs.

  • 9 files
  • 52.5 KB
  • MIT
  • Updated last month
  • GitHub
Use this Skill: https://skilld.dev/gh/oahc09/cocosairjs/cocosair-animation-tween

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

referencescommon-mistakes.md

≈807 tokens on demand. Your agent reads this file only when SKILL.md points to it.

Derived from the cocosair-animation-tween skill and its canonical docs/source pointers; reorganized on 2026-10-11. Source annotations below identify repository inputs, not files guaranteed to ship to npm consumers.

Common Mistakes

[HIGH] Importing track classes by name

Wrong:

import { VectorTrack, TrackPath, WrapMode } from 'cocosair';   // none of these are top-level exports
const track = new VectorTrack();

Correct:

import { animation, AnimationClip } from 'cocosair';
const track = new animation.VectorTrack();
track.path = new animation.TrackPath().toProperty('position');
const clip = new AnimationClip();
clip.wrapMode = AnimationClip.WrapMode.Loop;                   // WrapMode lives on AnimationClip

The track classes are frozen into the animation namespace (build/cocosair.module.js, currently :57866-57889) and excluded from the runtime export block (:161574); WrapMode is reachable only as the AnimationClip.WrapMode static (src/cocos/animation/animation-clip.ts:104).

[HIGH] Running the real pacer and the step clock at once

Wrong:

const clock = createStepClock();
await clock.step(1 / 60);          // never called begin(): game is still running -> throws "dual clock"

Correct:

const clock = createStepClock();
clock.begin();                     // game.pause() first
for (let i = 0; i < 90; i++) { await clock.step(1 / 60); }
clock.end();                       // game.resume() when done

step() asserts the game is paused and throws if rAF is still driving frames (src/air/step-clock.ts:68-75, :85-86); concurrent real-clock and manual stepping is forbidden by contract (docs/manual/how-to-update-things.md).

[HIGH] Assuming reverseTime(embedTween) returns to the start

Wrong:

tween(node).by(1, { position: new Vec3(2, 0, 0) }).reverseTime(tween(node).by(1, { position: new Vec3(2, 0, 0) })).start();
// expects the node back at its origin; GAP-T1 lands it on the wrong end point

Correct:

tween(node).by(1, { position: new Vec3(2, 0, 0) }).reverseTime().start();   // bare path is browser-verified

The embedded-sequence branch has an open end-point defect (docs/reference/api-scenario-gap-matrix.md:483-485); method-level verified evidence covers only the bare by(...).reverseTime() path.

[MEDIUM] Setting wrapMode every frame to keep a clip looping

Wrong:

class Looper extends Component { update() { state.wrapMode = AnimationClip.WrapMode.Loop; } }   // resets time each frame

Correct:

clip.wrapMode = AnimationClip.WrapMode.Loop;   // set once, before play
anim.play(clip.name);

The wrapMode setter assigns time = 0 and rewrites repeatCount (src/cocos/animation/animation-state.ts:119-129), so a per-frame assignment freezes playback at the first frame.

[MEDIUM] Citing marionette or pose-graph animation as available

Wrong:

import { AnimationGraph } from 'cocosair';   // not exported; the feature is not in the default build

Correct: use tween or a code-first AnimationClip; pose-graph state machines are unpublished (src/cc.config.json:59-70, tools/build/build.cjs:24-44, docs/notes/pose-graph-notes.md:151-155).

Source: SKILL.md on GitHub

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

No third-party reports yet.

Signed by skilld at ed38648. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub yesterday.

Activeupdated last month
layer
subsystem
All 1 allowed tools
Read Edit Write Bash
Other metadata
compatibility
Cocos AIR source checkout or installed cocosair.js package. Browser rendering requires WebGL 2; source tooling requires Node.js >=18. Use the host-provided tools and user-authorized workspace.
when_to_use
[
  "move or rotate a node over time",
  "a clip plays once instead of looping",
  "a tween will not reverse",
  "track classes fail to import by name",
  "step deterministic frames without a second live clock"
]
owns
[
  "tween",
  "animation-clip",
  "track-path",
  "wrap-mode",
  "step-clock",
  "pose-graph-limits"
]
not_for
[
  "glTF loading and instance setup -> cocosair-gltf",
  "skeletal binding and morph weights -> cocosair-skinning-morph",
  "scalar easing calculations -> cocosair-math"
]
metadata
{
  "author": "oahc09@gmail.com",
  "version": "1.0.0",
  "last-updated": "2026-10-13",
  "description_zh": "使用 AnimationClip、Animation 和 tween,管理播放模式、组合及单一时钟。用于动画播放、补间回收或确定性步进问题。"
}

README badge

README badge for oahc09/cocosairjs/cocosair-animation-tween