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}.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"scene_path": "<scene_path>",
"parent_node_id": "<parent_node_id>",
"text": "<text>"
},
"name": "cocos_add_toast"
}
}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 |