cocos_create_animation_clip
Create animation clips for Cocos Creator projects by defining keyframes for properties like position, scale, rotation, opacity, color, and active state.
Instructions
Create a .anim AnimationClip file.
Each track dict: {path, property, keyframes: [{time, value}, ...]}. Properties: 'position' (value=[x,y,z]), 'scale' ([sx,sy,sz]), 'rotation' ([ez]), 'opacity' (0-255), 'color' ([r,g,b,a]), 'active' (bool).
Returns {path, rel_path, uuid}. Use uuid with cocos_add_animation().
Example track: {"path": "", "property": "position", "keyframes": [{"time": 0, "value": [0,0,0]}, {"time": 1, "value": [100,0,0]}]}
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| project_path | Yes | ||
| clip_name | Yes | ||
| duration | No | ||
| sample | No | ||
| tracks | No | ||
| rel_dir | No |