# Common模块

# 概述

Common(粒子系统通用模块),用于设定粒子的初始属性值,如初速度、旋转、颜色、生命时间等。

image.png

# 属性描述

属性 功能 类型
startLifeTime 粒子的生命时长。 number
scalingMode 缩放模式。 engine.Particle.ParticleCommon.ScalingMode
    Hierarchy 表示粒子的大小受自身和所有父节点的缩放值的叠加影响。
(对于2d粒子,粒子大小会受到设计宽高的变化而影响,需要将transform2D.scale设为较大的值才能显示出来)
engine.Particle.ParticleCommon.ScalingMode.Hierarchy
    Local Local表示粒子的大小仅受自身缩放值影响。
(对于2d粒子,粒子大小不受设计宽高变化的影响,粒子的size值直接设置到裁剪空间)
engine.Particle.ParticleCommon.ScalingMode.Local
    Shape Shape表示粒子的大小不受自身和父节点缩放值的影响。
(对于2d粒子,粒子大小不受设计宽高变化的影响,粒子的size值直接设置到裁剪空间)
engine.Particle.ParticleCommon.ScalingMode.Shape
simulationSpace 模拟粒子所在的空间。 engine.Particle.ParticleCommon.SimulationSpace
    Local 粒子在局部空间中。 engine.Particle.ParticleCommon.SimulationSpace.Local
    World 粒子在世界空间中。 engine.Particle.ParticleCommon.SimulationSpace.World
startSpeed 每个粒子的初始速度大小。 engine.Particle.AdvancedProperty.ConstantProperty
engine.Particle.AdvancedProperty.TwoConstantsProperty
engine.Particle.AdvancedProperty.CurveProperty
engine.Particle.AdvancedProperty.TwoCurvesProperty
startSize3D 是否开启XYZ三个方向的大小设置。 boolean
startSize 若startSize3D为false时,每个粒子的初始大小。 engine.Particle.AdvancedProperty.ConstantProperty
engine.Particle.AdvancedProperty.TwoConstantsProperty
engine.Particle.AdvancedProperty.CurveProperty
engine.Particle.AdvancedProperty.TwoCurvesProperty
startSizeX 若startSize3D为true时,粒子的X轴方向初始大小。 engine.Particle.AdvancedProperty.ConstantProperty
engine.Particle.AdvancedProperty.TwoConstantsProperty
engine.Particle.AdvancedProperty.CurveProperty
engine.Particle.AdvancedProperty.TwoCurvesProperty
startSizeY 若startSize3D为true时,粒子的Y轴方向初始大小。 engine.Particle.AdvancedProperty.ConstantProperty
engine.Particle.AdvancedProperty.TwoConstantsProperty
engine.Particle.AdvancedProperty.CurveProperty
engine.Particle.AdvancedProperty.TwoCurvesProperty
startSizeZ 若startSize3D为true时,粒子的Z轴方向初始大小。 engine.Particle.AdvancedProperty.ConstantProperty
engine.Particle.AdvancedProperty.TwoConstantsProperty
engine.Particle.AdvancedProperty.CurveProperty
engine.Particle.AdvancedProperty.TwoCurvesProperty
startRotation3D 是否开启XYZ三个方向的旋转设置。 boolean
startRotation 若startSize3D为false时,每个粒子的初始旋转角度。 engine.Particle.AdvancedProperty.ConstantProperty
engine.Particle.AdvancedProperty.TwoConstantsProperty
engine.Particle.AdvancedProperty.CurveProperty
engine.Particle.AdvancedProperty.TwoCurvesProperty
startRotationX 若startSize3D为true时,每个粒子在X轴的初始旋转角度。 engine.Particle.AdvancedProperty.ConstantProperty
engine.Particle.AdvancedProperty.TwoConstantsProperty
engine.Particle.AdvancedProperty.CurveProperty
engine.Particle.AdvancedProperty.TwoCurvesProperty
startRotationY 若startSize3D为true时,每个粒子在Y轴的初始旋转角度。 engine.Particle.AdvancedProperty.ConstantProperty
engine.Particle.AdvancedProperty.TwoConstantsProperty
engine.Particle.AdvancedProperty.CurveProperty
engine.Particle.AdvancedProperty.TwoCurvesProperty
startRotationZ 若startSize3D为true时,每个粒子在Z轴的初始旋转角度。 engine.Particle.AdvancedProperty.ConstantProperty
engine.Particle.AdvancedProperty.TwoConstantsProperty
engine.Particle.AdvancedProperty.CurveProperty
engine.Particle.AdvancedProperty.TwoCurvesProperty
startColor 每个粒子的初始颜色。 engine.Particle.AdvancedProperty.OneColorProperty
engine.Particle.AdvancedProperty.TwoColorsProperty
engine.Particle.AdvancedProperty.GradientProperty
engine.Particle.AdvancedProperty.TwoGradientsProperty

注意:

对于2d粒子来说,transform2d的size属性不会对粒子大小产生任何影响。2d粒子的缩放取决于common模块中的scalingMode属性。当scalingMode为Local和Shape时,粒子不受世界矩阵的影响,所以不会随设计宽高的变化而变化,直接进入裁剪空间。当scalingMode为Hierarchy时,粒子会受到世界矩阵的影响,因为2d的世界矩阵会根据设计宽高进行了相应的缩放,所以transform2D的scale属性需要设大相应的倍数才能看到粒子。