Class R.particles.AbstractParticle
Extends
R.engine.PooledObject.
Base particle class. A particle only needs to implement the
draw() method. The remainder of the functionality is
handled by this abstract class.
Defined in: abstractparticle.js.
Constructor Attributes | Constructor Name and Description |
---|---|
R.particles.AbstractParticle(lifetime)
Create a particle
|
Method Attributes | Method Name and Description |
---|---|
destroy()
Destroy the particle
|
|
draw(renderContext, time, dt)
[ABSTRACT] Draw the particle
|
|
getBirth()
Get the time at which the particle was created
|
|
Get the class name of this object
|
|
Get the current position of the particle
|
|
getTTL()
Get the time-to-live for the particle (when it will expire)
|
|
release()
Release the particle back into the pool.
|
|
setPosition(x, y)
Set the X and Y world coordinates of the particle
|
|
update(renderContext, time, dt)
Update the particle in the render context, calling its draw method.
|
- Methods borrowed from class R.engine.PooledObject:
- clearObjectDataModel, getId, getName, getObjectDataModel, getProperties, isDestroyed, setName, setObjectDataModel, toString, toXML
Class Detail
R.particles.AbstractParticle(lifetime)
Create a particle
- Parameters:
- lifetime
- {Number} The life of the particle, in milliseconds
Method Detail
destroy()
Destroy the particle
draw(renderContext, time, dt)
[ABSTRACT] Draw the particle
- Parameters:
- renderContext
- {R.rendercontexts.AbstractRenderContext} The context to render the particle to
- time
- {Number} The world time, in milliseconds
- dt
- {Number} The delta between the world time and the last time the world was updated in milliseconds.
{Number}
getBirth()
Get the time at which the particle was created
- Returns:
- {Number} milliseconds
{String}
getClassName()
Get the class name of this object
- Returns:
- {String} "R.particles.AbstractParticle"
{R.math.Point2D}
getPosition()
Get the current position of the particle
- Returns:
- {R.math.Point2D}
{Number}
getTTL()
Get the time-to-live for the particle (when it will expire)
- Returns:
- {Number} milliseconds
release()
Release the particle back into the pool.
setPosition(x, y)
Set the X and Y world coordinates of the particle
- Parameters:
- x
- {R.math.Point2D|Number} A R.math.Point2D, or the X world coordinate
- y
- {Number} Y world coordinate
update(renderContext, time, dt)
Update the particle in the render context, calling its draw method.
- Parameters:
- renderContext
- {R.rendercontexts.AbstractRenderContext} The context where the particle is drawn
- time
- {Number} The world time, in milliseconds
- dt
- {Number} The delta between the world time and the last time the world was updated in milliseconds.