effectFx

A helper object for creating special effects such as lens flare.

Summary
effectFxA helper object for creating special effects such as lens flare.
Preference DialogNone.
Properties
positionobject, ( w )
colorobject, ( w )
callbackobject, ( r )
Functions
effectFx
add
start
stop

Preference Dialog

None.

Properties

position

object, ( w )

Sets the position of this special effect.

color

object, ( w )

Specifies the default color associate with this special effect.  The input should be in the format of {r: rv, g: gv, b: bv} where rv, gv, and bv are floats between 0 and 255.

callback

object, ( r )

Specifies a script molecule as callback.  Certain special effect requires adjustment when the camera/view location changes during runtime.  For example, lens flare effect need correct screen position of each flare during rendering.  This should be accomplished within the callback.

For lens flare effect, the callback is passed the following object as params.

var params = {lensFlares: [ {x: 100, y: 100, rotation: rad },  // size and rotaion of each flare
                            {x: 100, y: 100, rotation: rad },
                            ... ],
              positionScreen: {x: 0, y: 0} }; // effect position on screen

Implementer should update these values within the callback to achieve the best effect.

Functions

effectFx

effectFx(type);

EffectFx constructor.

Parameters

type(string) special effect name (e.g.  lens flare.)

Returns

(object) an effectFx object of the requested type.

add

add(material, size, distance);

Specifies an effect layer made of given material with given size and distance between effect origin and view.

Parameters

material(object) a material.
size(int) layer size, -1 to use texture width.
distance(float) between 0 and 1.  0 at effect origin.

Returns

N/A

start

start(scene);

Start this effect.

Parameters

scene(object) a scene.  (see Camera Molecule.scene.)  Nor required if a callback has been given.

Returns

N/A

stop

stop(scene);

Stop this effect.

Parameters

scene(object) a scene.  (see Camera Molecule.scene.)  Nor required if a callback has been given.

Returns

N/A

object, ( r )
object, ( r )
Close