Moai SDK  1.5 revision 1 (MoaiEdition)
MOAIParticleScript Class Reference

Inherits MOAILuaObject.

List of all members.

Function List

  add
  angleVec
  cos
  cycle
  div
  ease
  easeDelta
  mul
  norm
  packConst
  packReg
  rand
  randVec
  set
  sin
  sprite
  sub
  tan
  time
  vecAngle
  wrap

Function Documentation

add

r0 = v0 + v1


function add ( MOAIParticleScript self, number r0, number v0, number v1 )
Parameters:
self ( MOAIParticleScript )
r0 ( number )
v0 ( number )
v1 ( number )
Returns:
nil

Load two registers with the X and Y components of a unit vector with a given angle.


function angleVec ( MOAIParticleScript self, number r0, number r1, number v0 )
Parameters:
self ( MOAIParticleScript )
r0 ( number ) Register to store result X.
r1 ( number ) Register to store result Y.
v0 ( number ) Angle of vector (in degrees).
Returns:
nil
cos

r0 = cos(v0)


function cos ( MOAIParticleScript self, number r0, number v0 )
Parameters:
self ( MOAIParticleScript )
r0 ( number )
v0 ( number )
Returns:
nil

Cycle v0 between v1 and v2.


function cycle ( MOAIParticleScript self, number r0, number v0, number v1, number v2 )
Parameters:
self ( MOAIParticleScript )
r0 ( number )
v0 ( number )
v1 ( number )
v2 ( number )
Returns:
nil
div

r0 = v0 / v1


function div ( MOAIParticleScript self, number r0, number v0, number v1 )
Parameters:
self ( MOAIParticleScript )
r0 ( number )
v0 ( number )
v1 ( number )
Returns:
nil

Load a register with a value interpolated between two numbers using an ease curve.


function ease ( MOAIParticleScript self, number r0, number v0, number v1, number easeType )
Parameters:
self ( MOAIParticleScript )
r0 ( number ) Register to store result.
v0 ( number ) Starting value of the ease.
v1 ( number ) Ending value of the ease.
easeType ( number ) See MOAIEaseType for a list of ease types.
Returns:
nil

Load a register with a value interpolated between two numbers using an ease curve. Apply as a delta.


function easeDelta ( MOAIParticleScript self, number r0, number v0, number v1, number easeType )
Parameters:
self ( MOAIParticleScript )
r0 ( number ) Register to store result.
v0 ( number ) Starting value of the ease.
v1 ( number ) Ending value of the ease.
easeType ( number ) See MOAIEaseType for a list of ease types.
Returns:
nil
mul

r0 = v0 * v1


function mul ( MOAIParticleScript self, number r0, number v0, number v1 )
Parameters:
self ( MOAIParticleScript )
r0 ( number )
v0 ( number )
v1 ( number )
Returns:
nil

r0 = v0 / |v|

r1 = v1 / |v|

Where |v| == sqrt( v0^2 + v1^2)


function norm ( MOAIParticleScript self, number r0, number r1, number v0, number v1 )
Parameters:
self ( MOAIParticleScript )
r0 ( number )
r1 ( number )
v0 ( number )
v1 ( number )
Returns:
nil

Pack a const value into a particle script param.


function packConst ( number const )
Parameters:
const ( number ) Const value to pack.
Returns:
packed ( The )

Pack a register index into a particle script param.


function packReg ( number regIdx )
Parameters:
regIdx ( number ) Register index to pack.
Returns:
packed ( The )

Load a register with a random number from a range.


function rand ( MOAIParticleScript self, number r0, number v0, number v1 )
Parameters:
self ( MOAIParticleScript )
r0 ( number ) Register to store result.
v0 ( number ) Range minimum.
v1 ( number ) Range maximum.
Returns:
nil

Load two registers with the X and Y components of a vector with randomly chosen direction and length.


function randVec ( MOAIParticleScript self, number r0, number r1, number v0, number v1 )
Parameters:
self ( MOAIParticleScript )
r0 ( number ) Register to store result X.
r1 ( number ) Register to store result Y.
v0 ( number ) Minimum length of vector.
v1 ( number ) Maximum length of vector.
Returns:
nil
set

Load a value into a register.


function set ( MOAIParticleScript self, number r0, number v0 )
Parameters:
self ( MOAIParticleScript )
r0 ( number ) Register to store result.
v0 ( number ) Value to load.
Returns:
nil
sin

r0 = sin(v0)


function sin ( MOAIParticleScript self, number r0, number v0 )
Parameters:
self ( MOAIParticleScript )
r0 ( number )
v0 ( number )
Returns:
nil

Push a new sprite for rendering. To render a particle, first call 'sprite' to create a new sprite at the particle's location. Then modify the sprite's registers to create animated effects based on the age of the particle (normalized to its term).


function sprite ( MOAIParticleScript self )
Parameters:
self ( MOAIParticleScript )
Returns:
nil
sub

r0 = v0 - v1


function sub ( MOAIParticleScript self, number r0, number v0, number v1 )
Parameters:
self ( MOAIParticleScript )
r0 ( number )
v0 ( number )
v1 ( number )
Returns:
nil
tan

r0 = tan(v0)


function tan ( MOAIParticleScript self, number r0, number v0 )
Parameters:
self ( MOAIParticleScript )
r0 ( number )
v0 ( number )
Returns:
nil

Load the normalized age of the particle into a register.


function time ( MOAIParticleScript self, number r0 )
Parameters:
self ( MOAIParticleScript )
r0 ( number )
Returns:
nil

Compute angle (in degrees) between v0 and v1.


function vecAngle ( MOAIParticleScript self, number r0, number v0, number v1 )
Parameters:
self ( MOAIParticleScript )
r0 ( number )
v0 ( number )
v1 ( number )
Returns:
nil

Wrap v0 between v1 and v2.


function wrap ( MOAIParticleScript self, number r0, number v0, number v1, number v2 )
Parameters:
self ( MOAIParticleScript )
r0 ( number )
v0 ( number )
v1 ( number )
v2 ( number )
Returns:
nil