FIREWORK - 烟花效果
概述
在指定位置释放烟花。
技术规格
| 属性 | 值 |
|---|---|
| 效果类型 | FIREWORK |
| Java 枚举 | EffectType.FIREWORK |
| 实现类 | FireworkEffectEffect |
JSON 格式
{
"eventType": "FIREWORK",
"beat": 4.0,
"properties": {
"locations": [[0.0, 10.0, 0.0], [1.0, 10.0, 0.0]],
"type": "BALL_LARGE",
"colors": [[255, 0, 0], [0, 0, 255]],
"fadeColors": [[255, 255, 255]],
"flicker": false,
"trail": true
}
}
字段说明
| 字段 | 类型 | 必需 | 默认值 | 说明 |
|---|---|---|---|---|
| eventType | string | 是 | - | 固定为 "FIREWORK" |
| beat | double | 是 | - | 效果触发的拍数 |
| locations | double[3][] | 是 | - | 烟花位置列表(数组的数组) |
| type | string | 是 | - | 烟花类型 |
| colors | int[3][] | 是 | - | 主颜色列表(RGB数组) |
| fadeColors | int[3][] | 否 | [] | 渐变颜色列表 |
| flicker | boolean | 否 | false | 是否闪烁 |
| trail | boolean | 否 | true | 是否有尾迹 |
烟花类型
| 类型 | 说明 |
|---|---|
| BALL | 球形 |
| BALL_LARGE | 大球形 |
| STAR | 星形 |
| CREEPER | 苦力怕形 |
| BURST | 爆炸形 |
使用示例
单个烟花
{
"eventType": "FIREWORK",
"beat": 4.0,
"properties": {
"locations": [[0.0, 10.0, 0.0]],
"type": "BALL_LARGE",
"colors": [[255, 0, 0]],
"fadeColors": [[255, 255, 255]],
"flicker": true,
"trail": true
}
}
多个烟花
{
"eventType": "FIREWORK",
"beat": 8.0,
"properties": {
"locations": [
[0.0, 10.0, 0.0],
[2.0, 10.0, 0.0],
[-2.0, 10.0, 0.0]
],
"type": "STAR",
"colors": [[255, 0, 0], [0, 255, 0], [0, 0, 255]],
"fadeColors": [[255, 255, 255]],
"flicker": false,
"trail": true
}
}
彩色烟花
{
"eventType": "FIREWORK",
"beat": 12.0,
"properties": {
"locations": [[0.0, 15.0, 0.0]],
"type": "BURST",
"colors": [
[255, 0, 0],
[0, 255, 0],
[0, 0, 255],
[255, 255, 0],
[255, 0, 255]
],
"fadeColors": [[255, 255, 255]],
"flicker": true,
"trail": true
}
}
注意事项
- 位置坐标: 相对于游戏中心的偏移
- 颜色格式: RGB 数组,范围 0-255
- 性能影响: 大量烟花可能影响性能
- 物理效果: 烟花有物理模拟,会受重力影响
相关效果
- HOLOGRAM - 全息图效果
- TEXT_DISPLAY - 文本显示效果