This class makes creating particle emitters designed with the particle explorer easy by using the configuration string it gives you.
The createEmitter method is where most of the magic is in this class.
protected static var rules:Object
public static function configureEmitter(emitter:GenericEmitter, params:String):IParticleEmitterParameters
Returns
public static function configureEmitterByObject(emitter:GenericEmitter, params:Object):IParticleEmitterParameters
Returns
protected static function createDotFactory(param:Object, rules:Array, initializers:Array):IParticleFactoryParameters
| param:Object |
| |
| rules:Array |
| |
| initializers:Array |
Returns
public static function createEmitter(params:Object):IParticleEmitter
Creates and returns a new particle emitter.
Parameters
| params:Object — - An associative object with a combination of any of the following options.
Available options:
pps - Particles Per Second - How many particles to spew out every second.
Paramaters: amount
Example createEmitter({ pps:50 });
scale - Creates a scale rule that causes the particles to change size over time.
Paramaters: [ time, start scale, end scale ]
Example createEmitter({ scale:[3000,1,0.2] });
lifespan - Determines how long each particle will live for, in milliseconds.
Paramaters: time
Example createEmitter({ lifespan:8000 });
gravity - Causes the particles to suffer from gravity effects.
Paramaters: amount
Example createEmitter({ gravity:3 });
fade - Causes the particle tofade out over time.
Paramaters: time
Example createEmitter({ fade:8000 });
image - Causes the particle to be rendered as a bitmap image.
Paramaters - a Class object of an embedded bitmap.
Example
[Embed(source="man.png")]
var man:Class;
createEmitter({ image:man });
x - Sets the source X coordinate of the particles.
Example createEmitter({ x:100 });
y - Sets the source Y coordinate of the particles.
Example createEmitter({ y:100 });
movement - Determines whether or not the Movement rule should be applied to particles, this rule
looks at the speed & angle of the particle and causes it to move.
Example createEmitter({ movement:true });
minAngle / maxAngle - Determines the minimum and maximum angle that the particle will be pointed in to start with, individual particles will have
values between these assigned randomly.
Example createEmitter({ minAngle:0 });
Example createEmitter({ maxAngle:360 });
minSpeed / maxSpeed - Determines the minimum and maximum speed that the particle will start with (in pixels per second), individual particles will have
values between these assigned randomly.
Example createEmitter({ minSpeed:10 });
Example createEmitter({ maxSpeed:150 });
size - For dot or line particles, this determines the size of the particle.
Example createEmitter({ size:5 });
color - For dot or line particles, this determines the color of the particle.
Example createEmitter({ color:0xff0000 });
dot - Causes the particles to be a dot shape (circle)
Example createEmitter({ dot:true });
line - Causes the particles look like a straight line
Example createEmitter({ line:true });
start - Specifies whether or not the emitter should be started right away.
Example createEmitter( { start:true } );
or
var emitter = createEmitter( { start:false } );
// sometime later...
emitter.start();
pointSwarm - Causes the particles to swarm towards a certain point.
Paramaters: point
Example: createEmitter( { pointSwarm:[x,y]} );
mouseSwarm - Causes the particles to swarm towards the mouse.
Paramaters: stage
This paramter requires a reference to the stage so it can set up a mouse listener.
Example mouseSwarm:stage,
rotateToAngle - Causes the RotateToAngleRule to be executed, this causes the particles to rotate in the direction they're traveling.
Example: createEmitter( { rotateToAngleRule:false } );
xOscillate - Causes the XOscillatorRule rule to be executed, this causes the particle to oscillate back and forth in the X direction.
Paramaters: [ amount, dampen ]
Example: createEmitter( {xOscillate:[5,100]} );
tween - Causes the TweenRule to be executed for the particles, this can tween arbitrary values of the particles.
Paramaters - [ paramater, start value, end value, duration]
Example: createEmitter( {tween:["x",1,100,3000]} );
|
Returns
protected static function createImageFactory(param:Object, rules:Array, initializers:Array):IParticleFactoryParameters
| param:Object |
| |
| rules:Array |
| |
| initializers:Array |
Returns
protected static function createLineFactory(param:Object, rules:Array, initializers:Array):IParticleFactoryParameters
| param:Object |
| |
| rules:Array |
| |
| initializers:Array |
Returns
protected static function doInitializer(ruleName:String, params:Object, currentInits:Array):BooleanParameters
| ruleName:String |
| |
| params:Object |
| |
| currentInits:Array |
Returns
protected static function doRule(ruleName:String, params:Object, currentRules:Array):BooleanParameters
| ruleName:String |
| |
| params:Object |
| |
| currentRules:Array |
Returns