ParticleBehavior Documentation

Author: senocular
Last Modified: 05/03/05 14:20:10


Summary

ParticleBehavior class:

- description

ParticleBehavior Methods:

- [ Behavior Generation ]
- create
- multiple
- [ Motion Behaviors ]
- fall
- slide
- bounce
- bounce3D
- size
- transparency
- repel
- avoid
- constrain
- [ Removal Behaviors ]
- boundsRemove
- timedRemove
- framesRemove
- changeInPositionRemove
- distanceRemove
- distanceTraveledRemove
- sizeRemove


ParticleBehavior class

version: 0.1.1

description:

Creates functions to be used for independantly moving particle movie clips. Functions (or "behaviors" created with the ParticleBehavior class are self- contained and are typically assigned to a particle movie clip's onEnterFrame event handler. Particle movie clips you would create on your own

usage:

See: create, multiple.

ParticleBehavior Methods:

[ Behavior Generation ]

description: The following methods generate behavior functions for your particles

usage: Static

returns: behavior functions

create

description: Returns an instance of the behavior function specified. Each time create is called, a new instance of the behavior specified is created with the properties specified in the optionsObject. For those options not specified in the optionsObject, defaults are provided

usage:

myParticle.onEnterFrame = ParticleBehavior.create("behaviorname" [, optionsObject]);

parameters:

returns: behavior function

multiple

description: Returns an instance of a function that combines each behavior passed

usage:

myParticle.onEnterFrame = ParticleBehavior.multiple(behavior [, behavior...]);

parameters:

returns: a single behavior function representing the actions of each passed

[ Motion Behaviors ]

description: The following behaviors generate motion for particles

usage: Created through create or multiple

returns: behavior functions

fall

description: Falling motion behavior. Moves a movie clip down (or up) along the y axis every frame with a speed yvelocity. Each frame yvelocity increases by gravity

usage:

ParticleBehavior.create("fall", {gravity:2, yvelocity:5});

parameters:

returns: behavior function

slide

description: Sliding motion behavior. Moves a movie clip in any direction with a speed based on xvelocity and yvelocity. Each frame the velocities increase by x and y increases (yvelocity is also increased by gravity) through an additive process and are further affected by friction through a multiplication.

usage:

ParticleBehavior.create("slide", {xvelocity:1, xincrease:1, xfriction:.9});

parameters:

returns: behavior function.

bounce

description: Bouncing motion behavior (2D). Moves a movie clip in any direction with a speed based on xvelocity and yvelocity. Each frame the velocities increase by x and y increases (yvelocity is also increased by gravity) through an additive process and are further affected by friction through a multiplication. When the movie clip reaches the bounds, velocity is reversed creating a bounce.

usage:

ParticleBehavior.create("bounce", {xvelocity:20, yvelocity:2, xfriction:.8, bounds:myClip.getBounds()});

parameters:

returns: behavior function.

bounce3D

description: Bouncing motion behavior (3D). Moves a movie clip in any direction with a speed based on xvelocity, yvelocity and zvelocity within 3D space. Each frame the velocities increase by x, y, and z increases (yvelocity is also increased by gravity) through an additive process and are further affected by friction through a multiplication. When the movie clip reaches the bounds, velocity is reversed creating a bounce.

usage:

ParticleBehavior.create("bounce3D", {xvelocity:1, yvelocity:10, swap:true});

parameters:

returns: behavior function.

size

description: Sizing behavior. Scales a movie clip.

usage:

ParticleBehavior.create("size", {xincrease:2, yincrease:2, use:"value"});

parameters:

returns: behavior function

transparency

description: Transparency behavior. Fades a movie clip.

usage:

ParticleBehavior.create("transparency", {increase:-5});

parameters:

returns: behavior function

repel

description: Repelling motion behavior. Creates a behavior that causes a movie clip to repel from a central location when a "repeller" (either the mouse or a movie clip) approches

usage:

ParticleBehavior.create("repel", {x:100, y:100, repeller:my_mc});

parameters:

returns: behavior function

avoid

description: Avoiding motion behavior. Creates a behavior that causes a movie clip to avoid a movie clip or the mouse.

usage:

ParticleBehavior.create("avoid", {velocity:2, range:50, avoid:my_mc});

parameters:

returns: behavior function

constrain

description: Constraining behavior. Constrains a movieclip within a boundary.

usage:

ParticleBehavior.create("constrain", {bounds:my_mc.getBounds(), use:"bounds"});

parameters:

returns: behavior function

[ Removal Behaviors ]

description: The following behaviors are used to remove particles

usage: Created through create or multiple

returns: behavior functions

boundsRemove

description: Removal behavior. Removes a movie clip if it is no longer within the specified bounds.

usage:

ParticleBehavior.create("boundsRemove", {bounds:my_mc.getBounds(), use:"bounds"});

parameters:

returns: behavior function

timedRemove

description: Removal behavior. Removes a movie clip after a specified time (ms).

usage:

ParticleBehavior.create("timedRemove", {time:3000});

parameters:

returns: behavior function

framesRemove

description: Removal behavior. Removes a movie clip after a specified frames.

usage:

ParticleBehavior.create("framesRemove", {frames:60});

parameters:

returns: behavior function

changeInPositionRemove

description: Removal behavior. Removes a movie clip after a specified frames.

usage:

ParticleBehavior.create("changeInPositionRemove", {distance:100, check:"less"});

parameters:

returns: behavior function

distanceRemove

description: Removal behavior. Removes a movie clip after its a certain distance from a point.

usage:

ParticleBehavior.create("distanceRemove", {x:50, y75, distance:50});

parameters:

returns: behavior function

distanceTraveledRemove

description: Removal behavior. Removes a movie clip after it has traveled a certain distance.

usage:

ParticleBehavior.create("distanceTraveledRemove", {distance:600});

parameters:

returns: behavior function

sizeRemove

description: Removal behavior. Removes a movie clip after it reaches a certain size. Size is based on local coordinate space

usage:

ParticleBehavior.create("sizeRemove", {distance:600});

parameters:

returns: behavior function




generated with AS2docGenerator beta 0.5.3