粒子
Particle
此类描述json 粒子相关字段
Fields | |
---|---|
Particle | batchNum分布加载批次id |
Particle | acceleration 粒子沿着x,y,z三个方向的加速度分量 |
Particle | accelerationVar 粒子沿着x,y,z三个方向的加速度分量的变化值 |
Particle | billboardType 粒子渲染朝向 billboard |
Particle | blendMode 混合模式 |
Particle | boxLengthX box发射器x方向长度 |
Particle | boxLengthY box发射器y方向长度 |
Particle | boxLengthZ box发射器z方向长度 |
Particle | circleInRadius 圆环发射器的内圆半径 |
Particle | circleOutRadius 圆环发射器的外圆半径 |
Particle | colorEnd 粒子在生命周期末期时的颜色值 |
Particle | colorEndVar 粒子在生命周期末期时的颜色值的变化值 |
Particle | colorStart 粒子在生命周期初期时的颜色值 |
Particle | colorStartVar 粒子在生命周期初期时的颜色值的变化值 |
Particle | coneAngle 圆锥发射器的角度 |
Particle | coneRadius 圆锥发射器的半径 |
Particle | cylinderHeight 圆柱发射器高 |
Particle | cylinderRadius 圆柱发射器半径 |
Particle | emissionAccelecationMode 加速度产生方式 |
Particle | emissionDuration 发射器每次发射时长 |
Particle | emissionIdleDuration 发射间隔时长 |
Particle | emissionIdleDurationVar 发射间隔时长变化系数 |
Particle | emissionLoop 发射次数 |
Particle | emissionRate 每秒发射粒子数 |
Particle | emissionVelocityMode 速度的产生方式 |
Particle | emitterPosition 发射器位置 |
Particle | emitterRotationAxisAngleMax 发射器绕轴旋转参数 |
Particle | emitterRotationAxis 发射器绕轴旋转角度最大值 |
Particle | emitterRotationAxisAngleMin 发射器绕轴旋转角度最小值 |
Particle | emitterRotationAxisVar 发射器绕轴旋转参数变化系数 |
Particle | emitterShape 发射器形状 |
Particle | emitterShapeParam 发射器形状具体参数 |
Particle | emitterShapeStrectchScale 发射器形状的xyz的拉伸系数 |
Particle | frameAnimated 是否采用序列帧动画 |
Particle | frameColums 序列帧帧列数 |
Particle | frameCount 总序列帧数 |
Particle | frameDuration 每帧显示时长 |
Particle | frameLoop 是否循环播放序列帧 |
Particle | frameRandomOffset 初始序列帧随机范围 |
Particle | frameRows 序列帧行数 |
Particle | hemisphereRadius 半球发射器半径 |
Particle | imuType IMU类型 |
Particle | lifeTimeMax 粒子生命时间的最大值 |
Particle | lifeTimeMin 粒子生命时间的最小值 |
Particle | MainStruct 粒子配置文件整体结构 |
Particle | meshRadius 圆环发射器的内圆半径 |
Particle | particleCountMax 粒子最大数 |
Particle | particlePath 粒子json配置路径 |
Particle | particleSystemSuppl particleSystemSuppl配置 |
Particle | rotationAxis 粒子在运动过程中存在公转轴,所有粒子都会沿着这个轴进行公转,本字段表示这个轴在xyz三个轴的分量 |
Particle | rotationAxisAngleMax 粒子在运动过程中绕公转轴每秒转过的角度的最大值 |
Particle | rotationAxisAngleMin 粒子在运动过程中绕公转轴每秒转过的角度的最小值 |
Particle | rotationAxisVar 粒子在运动过程中存在公转轴,所有粒子都会沿着这个轴进行公转,本字段表示这个轴在xyz三个轴的分量的变化值 |
Particle | sizeEndMax 粒子在生命周期末期的尺寸的最大值 |
Particle | sizeEndMin 粒子在生命周期末期的尺寸的最小值 |
Particle | sizeStartMax 粒子在生命周期初期的尺寸的最大值 |
Particle | sizeStartMin 粒子在生命周期初期的尺寸的最小值 |
Particle | sphereRadius 球体发射器半径 |
Particle | spinAlignToSpeedDirection 粒子朝向 |
Particle | spinAngleMax 粒子在存活过程中自转时每秒转过的角度的最大值 |
Particle | spinAngleMin 粒子在存活过程中自转时每秒转过的角度的最小值 |
Particle | stretchScale 粒子渲染时沿着x,y,z轴拉伸,由于粒子是二维,z无意义,仅为参数统一 |
Particle | stretchType 拉伸方式 |
Particle | textureName 纹理名称 |
Particle | velocity 粒子沿着x,y,z三个方向的速度分量 |
Particle | velocityVar 粒子沿着x,y,z三个方向的速度分量的变化值 |
Particle | children 子节点 |
Particle | name 开发者自定义,建议名称有具体含义 |
Particle | position 模型在三维空间的位置 |
Particle | rotation 模型旋转角度 |
Particle | scale 模型在各个方向放大或缩小倍数 |
Particle | touchable 是否可点击 |
Particle | type 当前节点类型 |
Particle | visible 是否显示 |
Public methods | |
---|---|
Particle | ParticleDemo() Particle示例(simple_scene) |
Particle | ParticleSelfDemo() Particle示例(particle_custom) |
ParticleDemo ()
Particle示例(simple_scene)
sample:
{
"name": "custom",
"type": "particle",
"visible": 1,
"touchable": 0,
"batchNum":1,
"position": "0,0,0",
"scale": "1, 1, 1",
"rotation": "0,0,0",
"particleSystemSuppl":
{
"particlePath": "res/particle_custom.json"
},
"children": []
}
ParticleSelfDemo
Particle示例(particle_custom)
sample:
{
"name": "liuxing",
"particleCountMax": 3,
"material":
{
"blendMode": "additive",
"textureName": "star5.png",
"frameAnimated": 0,
"frameLoop": 0,
"frameCount": 1,
"frameColums": 1,
"frameRows": 1,
"frameRandomOffset": 0,
"frameDuration": 300
},
"emission":
{
"emissionLoop": -1,
"emissionRate": 1,
"emissionDuration": 3000,
"emissionIdleDuration": 0,
"emissionIdleDurationVar": 0,
"emitterPosition": "500, 1700, 200",
"emitterRotationAxisAngleMin": 0,
"emitterRotationAxisAngleMax": 0,
"emitterRotationAxis": "0, 0, 0",
"emitterRotationAxisVar": "0, 0, 0",
"emitterShape": "box",
"emitterShapeStrectchScale": "1,1,1",
"emissionVelocityMode": "axis",
"emissionAccelecationMode": "axis",
"emitterShapeParam":
{
"box":
{
"boxLengthX": 100,
"boxLengthY": 400,
"boxLengthZ": 5
}
}
},
"particle":
{
"lifeTimeMin": 2000,
"lifeTimeMax": 3000,
"sizeStartMin": 5,
"sizeStartMax": 5,
"sizeEndMin": 5,
"sizeEndMax": 5,
"colorStart": "255, 255, 255, 128",
"colorStartVar": "0, 0, 0, 0",
"colorEnd": "255, 255, 255, 255",
"colorEndVar": "0, 0, 0, 0",
"velocity": "-800, -400, 0",
"velocityVar": "0, 0, 0",
"acceleration": "0, -80, 0",
"accelerationVar": "0, 0, 0",
"spinAngleMin": 0,
"spinAngleMax": 0,
"rotationAxisAngleMin": 0,
"rotationAxisAngleMax": 0,
"rotationAxis": "0, 0, 0",
"rotationAxisVar": "0, 0, 0"
},
"render":
{
"imuType": 0,
"billboardType": "billboard",
"stretchScale": "0,0,0",
"stretchType": "speed",
"spinAlignToSpeedDirection": 1
},
"subEmitter":
{
"birth": [
{
"name": "trail_1",
"particleCountMax": 50,
"material":
{
"blendMode": "additive",
"textureName": "star5.png",
"frameAnimated": 0,
"frameLoop": 0,
"frameCount": 1,
"frameColums": 1,
"frameRows": 1,
"frameRandomOffset": 0,
"frameDuration": 500
},
"emission":
{
"emissionLoop": -1,
"emissionRate": 80,
"emissionDuration": 0,
"emissionIdleDuration": 0,
"emissionIdleDurationVar": 0,
"emitterPosition": "0, 0, 0",
"emitterRotationAxisAngleMin": 0,
"emitterRotationAxisAngleMax": 0,
"emitterRotationAxis": "0, 0, 0",
"emitterRotationAxisVar": "0, 0, 0",
"emitterShape": "box",
"emitterShapeStrectchScale": "1,1,1",
"emissionVelocityMode": "axis",
"emissionAccelecationMode": "axis",
"emitterShapeParam":
{
"box":
{
"boxLengthX": 1,
"boxLengthY": 1,
"boxLengthZ": 1
}
}
},
"particle":
{
"lifeTimeMin": 200,
"lifeTimeMax": 500,
"sizeStartMin": 5,
"sizeStartMax": 10,
"sizeEndMin": 1,
"sizeEndMax": 1,
"colorStart": "255, 255, 255, 255",
"colorStartVar": "0, 0, 0, 0",
"colorEnd": "255, 255, 255, 0",
"colorEndVar": "0, 0, 0, 0",
"velocity": "400, 200, 0",
"velocityVar": "0, 0, 0",
"acceleration": "0, 0, 0",
"accelerationVar": "0, 0, 0",
"spinAngleMin": 0,
"spinAngleMax": 0,
"rotationAxisAngleMin": 0,
"rotationAxisAngleMax": 0,
"rotationAxis": "0, 0, 0",
"rotationAxisVar": "0, 0, 0"
},
"render":
{
"imuType": 0,
"billboardType": "billboard",
"stretchScale": "0,0.05,0",
"stretchType": "speed",
"spinAlignToSpeedDirection": 1
},
"subEmitter":
{
"birth": [],
"collision": [],
"deadth": []
}
}
],
"collision": [],
"deadth": []
}
}
batchNum
version 23
分布加载批次id
sample:
"batchNum":1
acceleration
version 16
粒子沿着x、y、z三个方向的加速度分量
sample:
"acceleration" : "0, 0, 0"
accelerationVar
version 16
粒子沿着x、y、z三个方向的加速度分量的变化值
sample:
"accelerationVar" : "0, 0, 0"
billboardType
version 16
粒子渲染朝向。billboard:面向camera; horizontalBillboard:水平放置; verticalBillboard:垂直放置; none:不进行修正
sample:
"billboardType" : "billboard"
blendMode
version 16
混合模式。支持additive、multiply、alpha,默认additive
sample:
"blendMode" : "alpha"
boxLengthX
version 16
box发射器x方向长度
sample:
"boxLengthX" : 1500
boxLengthY
version 16
box发射器y方向长度
sample:
"boxLengthY" : 1500
boxLengthZ
version 16
box发射器z方向长度
sample:
"boxLengthZ" : 10
circleInRadius
version 16
圆环发射器的内圆半径
sample:
"circleInRadius" : 29
circleOutRadius
version 16
圆环发射器的外圆半径
sample:
"circleOutRadius" : 30
colorEnd
version 16
粒子在生命周期末期时的颜色值。四个分量分别代表r、g、b、a,参数范围:0~255
sample:
"colorEnd" : "255, 255, 255, 255"
colorEndVar
version 16
粒子在生命周期末期时的颜色值的变化值。四个分量分别代表r、g、b、a,参数范围:0~255
sample:
"colorEnd" : "255, 255, 255, 255"
colorStart
version 16
粒子在生命周期初期时的颜色值。四个分量分别代表r、g、b、a,参数范围:0~255
sample:
"colorStart" : "255, 255, 255, 255"
colorStartVar
version 16
粒子在生命周期初期时的颜色值的变化值。四个分量分别代表r、g、b、a,参数范围:0~255
sample:
"colorStartVar" : "0, 0, 0, 0"
coneAngle
version 16
圆锥发射器的角度
sample:
"coneAngle" : 110
coneRadius
version 16
圆锥发射器的半径
sample:
"coneRadius" : 500
cylinderHeight
version 16
圆柱发射器高
sample:
"cylinderHeight" : 500
cylinderRadius
version 16
圆柱发射器半径
sample:
"cylinderRadius" : 200
emissionAccelecationMode
version 16
加速度产生方式。axis:表示沿着xyz三个轴的方向去产生; shape:表示速度会沿着粒子初始位置与发射器位置连线方向产生; camera:粒子速度与相机的朝向一致 (值可通过accelecation和accelecationVar产生一定随机性)
sample:
"emissionAccelecationMode" : "axis"
emissionDuration
version 16
发射器每次发射时长。单位毫秒,参数范围:>0整数
sample:
"emissionDuration" : 3000
emissionIdleDuration
version 16
发射间隔时长。单位毫秒,参数范围:>0整数
sample:
"emissionIdleDuration" : 0
emissionIdleDurationVar
version 16
发射间隔时长变化系数。单位毫秒
sample:
"emissionIdleDurationVar" : 0
emissionLoop
version 16
发射次数。-1:无限循环; 0:一次; n:n次
sample:
"emissionLoop" : -1
emissionRate
version 16
每秒发射粒子数。参数范围:1~n
sample:
"emissionRate" : 200
emissionVelocityMode
version 16
速度的产生方式。axis:表示沿着xyz三个轴的方向去产生; shape:表示速度会沿着粒子初始位置与发射器位置连线方向产生(如:circle发射器形状下,当velocity的三个分量之和大于0时,会向外扩散,三个分量之和小于0时会向内收拢,其速度大小为velocity向量的模加上velocity_var的模范围内随机值); camera:粒子速度与相机的朝向一致 (值可通过velocity和velocity_var产生一定随机性)
sample:
"emissionVelocityMode" : "axis"
emitterPosition
version 16
发射器位置
sample:
"emitterPosition" : "500, 0, 2500"
emitterRotationAxis
version 16
发射器绕轴旋转参数
sample:
"emitterRotationAxis" : "0, 0, 0"
emitterRotationAxisAngleMax
version 16
发射器绕轴旋转角度最大值。参数范围: 0~n(度)
sample:
"emitterRotationAxisAngleMax" : 0
emitterRotationAxisAngleMin
version 16
发射器绕轴旋转角度最小值。参数范围: 0~n(度)
sample:
"emitterRotationAxisAngleMin" : 0
emitterRotationAxisVar
version 16
发射器绕轴旋转参数变化系数
sample:
"emitterRotationAxisVar" : "0, 0, 0"
emitterShape
version 16
发射器形状。box:长方体; sphere:球体; hemisphere 半球; cone:圆锥; cylinder:圆柱; circle :圆环; mesh:模型表面
sample:
"emitterShape" : "box"
emitterShapeParam
version 16
发射器形状具体参数。在选定形状之后要在这里配置相应的详细参数(数组类型)
sample:
"emitterShapeParam" :
{
"box":
{
"boxLengthX": 1,
"boxLengthY": 1,
"boxLengthZ": 1
},
"sphere":
{
"sphereRadius": 500
},
"hemisphere":
{
"hemisphereRadius": 50
},
"cylinder":
{
"cylinderRadius": 200,
"cylinderHeight": 500
},
"cone":
{
"coneRadius": 500,
"coneAngle": 110
},
"circle":
{
"circleOutRadius": 450,
"circleInRadius": 350
},
"mesh":
{
"meshRadius": 150
}
}
emitterShapeStrectchScale
version 16
发射器形状的xyz的拉伸系。(用于制作椭圆等效果),参数范围:1~n
sample:
"emitterShapeStrectchScale" : "1,1,1"
frameAnimated
version 16
是否采用序列帧动画。1:采用;0:不采用
sample:
"frameAnimated" : 0
frameColums
version 16
序列帧帧列数。参数范围:1~n
sample:
"frameColums" : 3
frameCount
version 16
总序列帧数。参数范围:1~n
sample:
"frameCount" : 12
frameDuration
version 16
每帧显示时长。单位毫秒,参数范围:1~n
sample:
"frameDuration" : 100
frameLoop
version 16
是否循环播放序列帧。1:是; 0:否
sample:
"frameLoop" : 1
frameRandomOffset
version 16
初始序列帧随机范围。参数范围:0~frameCount
sample:
"frameRandomOffset" : 12
frameRows
version 16
序列帧行数。参数范围:1~n
sample:
"frameRows" : 4
hemisphereRadius
version 16
半球发射器半径
sample:
"hemisphereRadius" : 50
imuType
version 16
IMU类型。0:以地理坐标打开imu;1:以手机坐标打开imu。slam下打开imu的方式为0
sample:
"imuType" : 0
lifeTimeMax
version 16
粒子生命时间的最大值。单位毫秒,参数范围:1~n
sample:
"lifeTimeMax" : 6000
lifeTimeMin
version 16
粒子生命时间的最小值。单位毫秒,参数范围:1~n
sample:
"lifeTimeMin" : 3000
MainStruct
version 16
粒子配置文件整体结构,除个别独立参数(如name)外其他分属于以下5个部分: material为粒子贴图素材相关配置,如帧图片的配置等; emission为粒子发射器相关配置,如发射器位置、形状等; particle为粒子具体属性配置,如粒子颜色、速度、加速度等; render为粒子渲染相关配置,如渲染朝向、拉伸、贴图朝向等; subEmitter为子粒子系统相关配置
sample:
{
"material": {
},
"emission":{
},
"particle":{
},
"render":{
},
"subEmitter":{
}
}
meshRadius
version 16
圆环发射器的内圆半径
sample:
"meshRadius" : 150
particleCountMax
version 16
粒子最大数。指可在屏幕上显示的最大数量,参数范围:0~n
sample:
"particleCountMax" : 1000
particlePath
version 16
粒子json配置路径
sample:
使用见:particleSystemSuppl字段 code
particleSystemSuppl
version 16
particleSystemSuppl配置
sample:
"particleSystemSuppl":
{
"particlePath": "res/particle_kongmingdeng.json"
},
rotationAxis
version 16
粒子在运动过程中存在公转轴,所有粒子都会沿着这个轴进行公转,本字段表示这个轴在xyz三个轴的分量
sample:
"rotationAxis" : "0, 0, 0"
rotationAxisAngleMax
version 16
粒子在运动过程中绕公转轴每秒转过的角度的最大值。参数范围:0~n(度)
sample:
"rotationAxisAngleMax" : 0
rotationAxisAngleMin
version 16
粒子在运动过程中绕公转轴每秒转过的角度的最小值。参数范围:0~n(度)
sample:
"rotationAxisAngleMin" : 0
rotationAxisVar
version 16
粒子在运动过程中存在公转轴,所有粒子都会沿着这个轴进行公转,本字段表示这个轴在xyz三个轴的分量的变化值
sample:
"rotationAxisVar" : "0, 0, 0"
sizeEndMax
version 16
粒子在生命周期末期的尺寸的最大值。参数范围:1~n
sample:
"sizeEndMax" : 40
sizeEndMin
version 16
粒子在生命周期末期的尺寸的最小值。参数范围:1~n
sample:
"sizeEndMin" : 40
sizeStartMax
version 16
粒子在生命周期初期的尺寸的最大值。参数范围:1~n
sample:
"sizeStartMax" : 60
sizeStartMin
version 16
粒子在生命周期初期的尺寸的最小值。参数范围:1~n
sample:
"sizeStartMin" : 60
sphereRadius
version 16
球体发射器半径
sample:
"sphereRadius" : 500
spinAlignToSpeedDirection
version 16
粒子朝向。1:表示粒子贴图与粒子速度方向同向; -1:表示粒子贴图与粒子速度方向反向; 0:表示粒子贴图方向始终是初始位置
sample:
"spinAlignToSpeedDirection" : 0
spinAngleMax
version 16
粒子在存活过程中自转时每秒转过的角度的最大值。参数范围:0~n(度)
sample:
"spinAngleMax" : 120
spinAngleMin
version 16
粒子在存活过程中自转时每秒转过的角度的最小值。参数范围:0~n(度)
sample:
"spinAngleMin" : 30
stretchScale
version 16
粒子渲染时沿着x,y,z轴拉伸。由于粒子是二维,z无意义,仅为参数统一
sample:
"stretchScale" : "0,0,0"
stretchType
version 16
拉伸方式。speed:根据速度大小拉伸;position:根据距离远近拉伸;constant:直接根据stretchScale的大小进行拉伸
sample:
"stretchType" : "speed"
textureName
version 16
纹理名称
sample:
"textureName" : "yinhua3.png"
velocity
version 16
粒子沿着xyz三个方向的速度分量
sample:
"velocity" : "-120, 0, -350"
velocityVar
version 16
粒子沿着xyz三个方向的速度分量的变化值
sample:
"velocityVar" : "70, 100, 100"
children
version 8
子节点,里面元素也是node,可以是任意类型(比如pod,particle),子节点格式同对应类型的配置一样
sample:
"children":[]
name
version 8
开发者自定义。建议名称有具体含义
sample:
"name":"xxx"
position
version 8
模型在三维空间的位置。三个数分别对应x、y、z坐标,如"1,1,0",默认为"0,0,0"
sample:
"position":"1,1,1"
rotation
version 8
模型旋转角度。三个数依次表示绕x、y、z轴的旋转角度,默认为"0,0,0"
sample:
"rotation":"0,0,0"
scale
version 8
模型在各个方向放大或缩小倍数。默认为"1,1,1",放大(scale > 1),缩小 (0 < scale < 1)
sample:
"scale":"1,1,1"
touchable
version 8
是否可点击。1:可点击;0:不可点击
sample:
"visible":0
type
version 8
当前节点类型
sample:
"type":"particle"
visible
version 8
是否显示。1:显示;0:隐藏
sample:
"visible":0