# ParticleSystem

Inheritance ParticleSystem Container View Module hilo/game/ParticleSystem Requires hilo/core/Hilo, hilo/core/Class, hilo/view/View, hilo/view/Container, hilo/view/Drawable, hilo/util/util Source ParticleSystem.js
ParticleSystem A particle system.

### Properties

Show Inherited Properties

| Property | Defined
--- | --- | ---
| emitNum:Number Emit number. | ParticleSystem
| emitNumVar:Number Emit number variances. | ParticleSystem
| emitterX:Number The emitter x position. | ParticleSystem
| emitterY:Number The emitter y position. | ParticleSystem
| emitTime:Number Emit time interval(in second). | ParticleSystem
| emitTimeVar:Number Emit time interval variances. | ParticleSystem
| gx:Number The gravity x value. | ParticleSystem
| gy:Number The gravity y value. | ParticleSystem
| totalTime:Number Total time. | ParticleSystem
| align:String|Function The alignment of the view, the value must be one of Hilo.align enum. | View
| alpha:Number The opacity of the view, default value is 1. | View
| background:Object The background style to fill the view, can be css color, gradient or pattern of canvas | View
| boundsArea:Array The vertex points of the view, the points are relative to the center point. | View
| children:Array List of children elements of the container, readonly! | Container
| clipChildren:Boolean Whether clip children elements which are out of the container, default value is false. | Container
| depth:Number The z index of the view, readonly! | View
| drawable:Drawable The drawable object of the view. | View
| height:Number The height of the view, default value is 0. | View
| id:String The identifier for the view. | View
| mask:Graphics Sets a mask for the view. | View
| parent:Container The parent view of this view, readonly! | View
| pivotX:Number Position of the center point on the x axis of the view, default value is 0. | View
| pivotY:Number Position of the center point on the y axis of the view, default value is 0. | View
| pointerChildren:Boolean Whether children elements of the container can response to user interactive events, default value is true. | Container
| pointerEnabled:Boolean Is the view can receive DOM events, default value is true. | View
| rotation:Number The rotation of the view in angles, default value is 0. | View
| scaleX:Number The x axis scale factor of the view, default value is 1. | View
| scaleY:Number The y axis scale factor of the view, default value is 1. | View
| tint:Number The tint applied to the view，default is 0xFFFFFF.Only support in WebGL mode. | View
| transform:Matrix The transform of the view.If set the transform, x, y, scaleX, scaleY, rotation, pivotX, pivotY will be ignored.default is null. | View
| visible:Boolean The visibility of the view. | View
| width:Number The width of the view, default value is 0. | View
| x:Number The position of the view on the x axis relative to the local coordinates of the parent, default value is 0. | View
| y:Number The position of the view on the y axis relative to the local coordinates of the parent, default value is 0. | View

### Methods

Show Inherited Methods

| Method | Defined
--- | --- | ---
| ParticleSystem(properties:Object) Constructor | ParticleSystem
| onUpdate(dt:Number) 更新 | ParticleSystem
| reset(cfg:Object) Reset the properties. | ParticleSystem
| start() Start emit particles. | ParticleSystem
| stop(clear:Boolean) Stop emit particles. | ParticleSystem
| addChild(child:View) Add child element at the top. | Container
| addChildAt(child:View, index:Number) Add child element at given index. | Container
| addTo(container:Container, index:Uint):View Add current view to a Contaner. | View
| contains(child:View) Return whether this container contains the parameter described child element. | Container
| fire(type:String, detail:Object):Boolean Send events. | View
| getBounds():Array Get the bounds of the view as a circumscribed rectangle and all vertex points relative to the coordinates of the stage. | View
| getChildAt(index:Number) Return child element at the given index. | Container
| getChildById(id:String) Return child element at the given id. | Container
| getChildIndex(child:View) Return index value of the given child element. | Container
| getNumChildren():Uint Return the amount of the children elements of the container. | Container
| getScaledHeight():Number Get the scaled height of the view. | View
| getScaledWidth():Number Get the scaled width of the view. | View
| getStage():Stage Get the stage object of the view. | View
| getViewAtPoint(x:Number, y:Number, usePolyCollision:Boolean, global:Boolean, eventMode:Boolean) Return object at the point positioned by given values on x axis and y axis. | Container
| hitTestObject(object:View, usePolyCollision:Boolean) Determining whether an object is in the circumscribed rectangle of current view. | View
| hitTestPoint(x:Number, y:Number, usePolyCollision:Boolean):Boolean Determining whether a point is in the circumscribed rectangle of current view. | View
| off(type:String, listener:Function):Object Remove one event listener. | View
| on(type:String, listener:Function, once:Boolean):Object Add an event listenser. | View
| removeAllChildren():Container Remove all children elements. | Container
| removeChild(child:View):View Remove the given child element. | Container
| removeChildAt(index:Int):View Remove element at the index. | Container
| removeChildById(id:String):View Remove child element by its id. | Container
| removeFromParent():View Remove current view from it's parent container | View
| render(renderer:Renderer, delta:Number) The render method of current view. | View
| setChildIndex(child:View, index:Number) Set the index of child element. | Container
| sortChildren(keyOrFunction:Object) Sort children elements by the given key or function. | Container
| swapChildren(child1:View, child2:View) Swap index between two child elements. | Container
| swapChildrenAt(index1:Number, index2:Number) Swap two children elements at given indexes. | Container
| toString():String Get a string representing current view. | View

### Property Detail

emitNum:Number
Emit number.

  Default: 10

emitNumVar:Number
Emit number variances.

  Default: 0

emitterX:Number
The emitter x position.

  Default: 0

emitterY:Number
The emitter y position.

  Default: 0

emitTime:Number
Emit time interval(in second).

  Default: 0.2

emitTimeVar:Number
Emit time interval variances.

  Default: 0

gx:Number
The gravity x value.

  Default: 0

gy:Number
The gravity y value.

  Default: 0

totalTime:Number
Total time.

  Default: Infinity

### Constructor

ParticleSystem(properties:Object)

parameters
properties:Object — properties The properties to create a view object, contains all writeable props of this class
properties.particle:Object — The config of particle.
properties.particle.x:Number Optional, Default: 0 — The x position.
properties.particle.y:Number Optional, Default: 0 — The y position
properties.particle.vx:Number Optional, Default: 0 — The x velocity.
properties.particle.vy:Number Optional, Default: 0 — The y velocity.
properties.particle.ax:Number Optional, Default: 0 — The x acceleration.
properties.particle.ay:Number Optional, Default: 0 — The y acceleration.
properties.particle.life:Number Optional, Default: 1 — The time particle lives(in second).
properties.particle.alpha:Number Optional, Default: 1 — The alpha.
properties.particle.alphaV:Number Optional, Default: 0 — The alpha decline rate.
properties.particle.scale:Number Optional, Default: 1 — The scale.
properties.particle.scaleV:Number Optional, Default: 0 — The scale decline rate.

### Method Detail

onUpdate(dt:Number)
更新

parameters
dt:Number — delta time(in milliseconds)

reset(cfg:Object)
Reset the properties.

parameters
cfg:Object —

start()
Start emit particles.
stop(clear:Boolean)
Stop emit particles.

parameters
clear:Boolean — Whether or not clear all the particles.