Packagenet.flashpunk.graphics
Classpublic class ParticleType
InheritanceParticleType Inheritance Object

Template used to define a particle type used by the Emitter class. Instead of creating this object yourself, fetch one with Emitter's add() function.



Public Properties
 PropertyDefined By
  originX : Number = 0
X origin of the frame, determines transformation point.
ParticleType
  originY : Number = 0
Y origin of the frame, determines transformation point.
ParticleType
Public Methods
 MethodDefined By
  
ParticleType(name:String, frames:Array, source:BitmapData, frameWidth:uint, frameHeight:uint)
Constructor.
ParticleType
  
setAlpha(start:Number = 1, finish:Number = 0, ease:Function = null):ParticleType
Sets the alpha range of this particle type.
ParticleType
  
setColor(start:uint = 0xFFFFFF, finish:uint = 0, ease:Function = null):ParticleType
Sets the color range of this particle type.
ParticleType
  
setGravity(gravity:Number = 0, gravityRange:Number = 0):ParticleType
Sets the gravity range of this particle type.
ParticleType
  
setMotion(angle:Number, distance:Number, duration:Number, angleRange:Number = 0, distanceRange:Number = 0, durationRange:Number = 0, ease:Function = null):ParticleType
Defines the motion range for this particle type.
ParticleType
  
setMotionVector(x:Number, y:Number, duration:Number, durationRange:Number = 0, ease:Function = null):ParticleType
Defines the motion range for this particle type based on the vector.
ParticleType
  
setRotation(startAngle:Number, spanAngle:Number, startAngleRange:Number = 0, spanAngleRange:Number = 0, smooth:Boolean = false, ease:Function = null):ParticleType
Defines the rotation range for this particle type.
ParticleType
Property Detail
originXproperty
public var originX:Number = 0

X origin of the frame, determines transformation point. Defaults to top-left corner.

originYproperty 
public var originY:Number = 0

Y origin of the frame, determines transformation point. Defaults to top-left corner.

Constructor Detail
ParticleType()Constructor
public function ParticleType(name:String, frames:Array, source:BitmapData, frameWidth:uint, frameHeight:uint)

Constructor.

Parameters
name:String — Name of the particle type.
 
frames:Array — Array of frame indices to animate through.
 
source:BitmapData — Source image.
 
frameWidth:uint — Frame width.
 
frameHeight:uint — Frame height.
Method Detail
setAlpha()method
public function setAlpha(start:Number = 1, finish:Number = 0, ease:Function = null):ParticleType

Sets the alpha range of this particle type.

Parameters

start:Number (default = 1) — The starting alpha.
 
finish:Number (default = 0) — The finish alpha.
 
ease:Function (default = null) — Optional easer function.

Returns
ParticleType — This ParticleType object.
setColor()method 
public function setColor(start:uint = 0xFFFFFF, finish:uint = 0, ease:Function = null):ParticleType

Sets the color range of this particle type.

Parameters

start:uint (default = 0xFFFFFF) — The starting color.
 
finish:uint (default = 0) — The finish color.
 
ease:Function (default = null) — Optional easer function.

Returns
ParticleType — This ParticleType object.
setGravity()method 
public function setGravity(gravity:Number = 0, gravityRange:Number = 0):ParticleType

Sets the gravity range of this particle type.

Parameters

gravity:Number (default = 0) — Gravity amount to affect to the particle y velocity.
 
gravityRange:Number (default = 0) — Random amount to add to the particle's gravity.

Returns
ParticleType — This ParticleType object.
setMotion()method 
public function setMotion(angle:Number, distance:Number, duration:Number, angleRange:Number = 0, distanceRange:Number = 0, durationRange:Number = 0, ease:Function = null):ParticleType

Defines the motion range for this particle type.

Parameters

angle:Number — Launch Direction.
 
distance:Number — Distance to travel.
 
duration:Number — Particle duration.
 
angleRange:Number (default = 0) — Random amount to add to the particle's direction.
 
distanceRange:Number (default = 0) — Random amount to add to the particle's distance.
 
durationRange:Number (default = 0) — Random amount to add to the particle's duration.
 
ease:Function (default = null) — Optional easer function.

Returns
ParticleType — This ParticleType object.
setMotionVector()method 
public function setMotionVector(x:Number, y:Number, duration:Number, durationRange:Number = 0, ease:Function = null):ParticleType

Defines the motion range for this particle type based on the vector.

Parameters

x:Number — X distance to move.
 
y:Number — Y distance to move.
 
duration:Number — Particle duration.
 
durationRange:Number (default = 0) — Random amount to add to the particle's duration.
 
ease:Function (default = null) — Optional easer function.

Returns
ParticleType — This ParticleType object.
setRotation()method 
public function setRotation(startAngle:Number, spanAngle:Number, startAngleRange:Number = 0, spanAngleRange:Number = 0, smooth:Boolean = false, ease:Function = null):ParticleType

Defines the rotation range for this particle type.

Parameters

startAngle:Number — The particle type.
 
spanAngle:Number — Starting angle.
 
startAngleRange:Number (default = 0) — Total amount of degrees to rotate.
 
spanAngleRange:Number (default = 0) — Random amount to add to the particle's starting angle.
 
smooth:Boolean (default = false) — Random amount to add to the particle's span angle.
 
ease:Function (default = null) — Whether to smooth the resulting rotated particle.

Returns
ParticleType — This ParticleType object.