t1k:cocos:playable:animation-core
| Field | Value |
|---|---|
| Module | playable |
| Version | 0.15.0 |
| Effort | high |
| Tools | — |
Keywords: ads, animation, cocos, flying, object pool, playable, 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.
Import paths:
db://assets/PLAGameFoundation/animations/FlyingAnimationdb://assets/PLAGameFoundation/animations/FlyingAnimationController
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.