cocos_add_toast
Display transient notification pills with fade animations in Cocos Creator scenes. Configure text, duration, position, and semantic variants (info, success, warn, danger) for user feedback.
Instructions
Transient pill notification — fade in, hold, fade out.
variant picks the background:
"info"→ surface (neutral gray/slate)"success"/"warn"/"danger"→ matching semantic color Text usestextpreset (info) orbg(colored variants) so it always reads against the bg.
duration is total time including 0.25s fade-in + 0.25s fade-out.
Minimum 0.6s (else there's no readable hold window).
Clip plays once and holds invisible — toast stays in scene as a
zero-opacity node.
Returns {toast_node_id, label_node_id, animation_component_id}.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| scene_path | Yes | ||
| parent_node_id | Yes | ||
| text | Yes | ||
| duration | No | ||
| position | No | bottom | |
| variant | No | info | |
| width | No | ||
| height | No |