t1k:cocos:playable:animation-core
| Field | Value |
|---|---|
| Module | playable |
| Version | 2.14.4 |
| Effort | high |
| Tools | — |
Keywords: animation, flying, object pool, tween
How to invoke
Section titled “How to invoke”/t1k:cocos:playable:animation-coreFlyingAnimation & FlyingAnimationController
Section titled “FlyingAnimation & FlyingAnimationController”Pooled particle-like animation system built on Cocos tween(). FlyingAnimation is the per-node Component; FlyingAnimationController is the scene singleton that manages spawning and pooling. See also: t1k-cocos-playable-signalbus.
Not available in the vendored CPM packages.
FlyingAnimationandFlyingAnimationControllershipped from the oldassets/PLAGameFoundation/animations/folder. Neither symbol exists in@playablelabs/game-foundation,@playablelabs/parameter-tool, or@playablelabs/motion(checked against 1.1.4 / 1.0.7 / 0.1.3), and there is no drop-in successor. Everything below describes legacy embedded source — it applies only to a project that still carries its ownanimations/folder.For new work, drive flying/reward motion with
@playablelabs/motion(db://assets/packages/@playablelabs/motion) and pool the spawned nodes throught1k-cocos-playable-object-pool.
Details
Section titled “Details”- API reference: animation types, config interface, controller API, tween patterns
- Usage examples: collect effect, explosion, float-up text
Common Mistakes
Section titled “Common Mistakes”- Not calling
Tween.stopAllByTarget(node)before replaying on a pooled node — old tweens persist after recycle. - Setting
autoDestroy = truewhen using the controller — controller handles pooling;autoDestroymust stayfalse. - Passing
targetNodefor a non-target animation type — ignored silently; check enum group. - Forgetting
UIOpacitycomponent on prefab —FlyingAnimation.onLoadauto-adds it, but only after the node is active in the scene.
Gotchas
Section titled “Gotchas”- Animation clip references hold scene assets — they don’t unload until the component is destroyed — disable doesn’t free.
- Skeletal animation events fire on the animation thread; UI mutation must marshal to main.
- Inspector-wired callback params must guard with
typeof param === 'function', never bare?.()or a truthy check. Any public method whose callback param may also be fired from a Cocos InspectorEventHandler(animation FINISHED handlers, button clicks, custom[EventHandler]arrays) receives the EventHandler’s CustomEventData string as its FIRST argument — it is NOTundefined. SoonComplete?.()(guards only null/undefined) ANDif (onComplete) onComplete()(a non-empty string is truthy) both throwonComplete is not a function. Guard withif (typeof onComplete === 'function') onComplete();so the SAME method is safe called from code (anim.PlayReverse(() => {...})) OR from the Inspector (string arg ignored, no crash). This bug recurs because devs assume the only “absent” case isundefined; Inspector EventHandlers violate that.