跳到主要内容

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
}
}

字段说明

字段类型必需默认值说明
eventTypestring-固定为 "FIREWORK"
beatdouble-效果触发的拍数
locationsdouble[3][]-烟花位置列表(数组的数组)
typestring-烟花类型
colorsint[3][]-主颜色列表(RGB数组)
fadeColorsint[3][][]渐变颜色列表
flickerbooleanfalse是否闪烁
trailbooleantrue是否有尾迹

烟花类型

类型说明
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
}
}

注意事项

  1. 位置坐标: 相对于游戏中心的偏移
  2. 颜色格式: RGB 数组,范围 0-255
  3. 性能影响: 大量烟花可能影响性能
  4. 物理效果: 烟花有物理模拟,会受重力影响

相关效果

相关文档