Class: Particle

Grape2D. Particle

new Particle(options)

Particle.
Parameters:
Name Type Argument Description
options Object <optional>
Setup options. See Grape2D.Shape
Properties
Name Type Argument Description
velocity Grape2D.Vector <optional>
Particle's velocity.
acceleration Grape2D.Vector <optional>
Particle's acceleration.
lifeTime number Particle's remaining time, in milliseconds.
Source:

Extends

Members

<private> acceleration :Grape2D.Vector

Acceleration of the particle.
Type:
Source:

<private> lifeTime :number

Remaining life time of the particle in milliseconds.
Type:
  • number
Source:

<protected> position :Grape2D.Vector

Shape's position.
Type:
Inherited From:
Source:

<private> velocity :Grape2D.Vector

Velocity of the particle.
Type:
Source:

Methods

createBV(bvfactory) → {Grape2D.Shape}

Creates a bounding volume, based in this one and in a Grape2D.BVFactory.
Parameters:
Name Type Description
bvfactory Grape2D.BVFactory The bounding volume factory.
Inherited From:
Source:
Returns:
The shape created by the Grape2D.BVFactory.
Type
Grape2D.Shape

getAcceleration() → {Grape2D.Vector}

Gets the particle acceleration.
Source:
Returns:
Particle acceleration.
Type
Grape2D.Vector

getLifeTime() → {number}

Gets the particle remaining life time.
Source:
Returns:
Particle life time.
Type
number

getPosition() → {Grape2D.Vector}

Gets the position of the object.
Inherited From:
Source:
Returns:
The center position of the shape.
Type
Grape2D.Vector

getStaticType() → {string}

Gets teh static type of the shape. This method must be overriden, for specific shapes.
Inherited From:
Source:
Returns:
The type of the shape.
Type
string

getVelocity() → {Grape2D.Vector}

Gets the particle velocity.
Source:
Returns:
Particle velocity.
Type
Grape2D.Vector

isAlive() → {boolean}

Checks if the particle is in the alive state.
Source:
Returns:
True if it's alive.
Type
boolean

isDead() → {boolean}

Checks if the particle is in the dead state.
Source:
Returns:
True if it's dead.
Type
boolean

render()

Source:

revive(position, velocity, lifeTime)

Revives the particle according to a set of properties.
Parameters:
Name Type Description
position Grape2D.Vector Position of the particle.
velocity Grape2D.Vector Velocity of the particle.
lifeTime number Remaining life time of the particle.
Source:

setAcceleration(acceleration)

Sets the particle acceleration.
Parameters:
Name Type Description
acceleration Grape2D.Vector Acceleration of the particle.
Source:

setLifeTime(lifeTime)

Sets the particle remaining life time.
Parameters:
Name Type Description
lifeTime number Remaining life time of the particle.
Source:

setPosition(position)

Set the position of the shape.
Parameters:
Name Type Description
position Grape2D.Vector The new position of the shape.
Inherited From:
Source:

setVelocity(velocity)

Sets the particle velocity.
Parameters:
Name Type Description
velocity Grape2D.Vector Velocity of the particle.
Source:

submitToFields(fields)

Submits the particle to the force of fields.
Parameters:
Name Type Description
fields !Array.<!Grape2D.Field> Fields to submit.
Source:

update(dt, scene)

Updates the particle.
Parameters:
Name Type Description
dt number Time elapsed since the last update.
scene Grape2D.Scene Scene where the particle is.
Source: