Cocos Creator API

1.4.x

Cocos Creator is a highly customizable game development tool that utilizes the power of cocos2d-x.

ParticleSystem

Module: cc

Particle System base class.
Attributes of a Particle System:

  • emmision rate of the particles
  • Gravity Mode (Mode A):
  • gravity
  • direction
  • speed +- variance
  • tangential acceleration +- variance
  • radial acceleration +- variance
  • Radius Mode (Mode B):
  • startRadius +- variance
  • endRadius +- variance
  • rotate +- variance
  • Properties common to all modes:
  • life +- life variance
  • start spin +- variance
  • end spin +- variance
  • start size +- variance
  • end size +- variance
  • start color +- variance
  • end color +- variance
  • life +- variance
  • blending function
  • texture

    cocos2d also supports particles generated by Particle Designer (http://particledesigner.71squared.com/).
    'Radius Mode' in Particle Designer uses a fixed emit rate of 30 hz. Since that can't be guarateed in cocos2d,
    cocos2d uses a another approach, but the results are almost identical.
    cocos2d supports all the variables used by Particle Designer plus a bit more:
  • spinning particles (supported when using ParticleSystem)
  • tangential acceleration (Gravity mode)
  • radial acceleration (Gravity mode)
  • radius direction (Radius mode) (Particle Designer supports outwards to inwards direction only)
    It is possible to customize any of the above mentioned properties in runtime. Example:

examples:

emitter.radialAccel = 15;
emitter.startSpin = 0;

Properties

preview Boolean

Play particle in edit mode.

custom Boolean

If set custom to true, then use custom properties insteadof read particle file.

file string

The plist file.

texture Texture2D

.

particleCount Number

Current quantity of particles that are being simulated.

srcBlendFactor BlendFactor

Specify the source Blend Factor.

dstBlendFactor BlendFactor

Specify the destination Blend Factor.

playOnLoad Boolean

If set to true, the particle system will automatically start playing on onLoad.

autoRemoveOnFinish Boolean

Indicate whether the owner node will be auto-removed when it has no particles left.

active Boolean readOnly

Indicate whether the particle system is activated.

totalParticles Number

Maximum particles of the system.

duration Number

How many seconds the emitter wil run. -1 means 'forever'.

emissionRate Number

Emission rate of the particles.

life Number

Life of each particle setter.

lifeVar Number

Variation of life.

startColor Color

Start color of each particle.

startColorVar Color

Variation of the start color.

endColor Color

Ending color of each particle.

endColorVar Color

Variation of the end color.

angle Number

Angle of each particle setter.

angleVar Number

Variation of angle of each particle setter.

startSize Number

Start size in pixels of each particle.

startSizeVar Number

Variation of start size in pixels.

endSize Number

End size in pixels of each particle.

endSizeVar Number

Variation of end size in pixels.

startSpin Number

Start angle of each particle.

startSpinVar Number

Variation of start angle.

endSpin Number

End angle of each particle.

endSpinVar Number

Variation of end angle.

sourcePos Vec2

Source position of the emitter.

posVar Vec2

Variation of source position.

positionType ParticleSystem.PositionType

Particles movement type.

emitterMode ParticleSystem.EmitterMode

Particles emitter modes.

gravity Vec2

Gravity of the emitter.

speed Number

Speed of the emitter.

speedVar Number

Variation of the speed.

tangentialAccel Number