Class: ParticleSystem

Grape2D. ParticleSystem

new ParticleSystem()

Particle system.
Source:

Extends

Members

<private> boundingBox :Grape2D.Shape

Object's bounding box.
Type:
Inherited From:
Source:

<private> boundingBoxOffset :Grape2D.Vector

Bounding box offset.
Type:
Inherited From:
Source:

<private> castShadow :boolean

Object cast shadow.
Type:
  • boolean
Inherited From:
Source:

<private> emitters :!Array.<!Grape2D.Emitter>

Emitters of particles of the system.
Type:
Source:

<private> fields :!Array.<!Grape2D.Field>

Fields that interact with the particles of the system.
Type:
Source:

<private> maxx :number

Value of the maximum x coordinate of the particles of the system. Used for a faster creation of the bounding box of the system.
Type:
  • number
Source:

<private> maxy :number

Value of the maximum y coordinate of the particles of the system. Used for a faster creation of the bounding box of the system.
Type:
  • number
Source:

<private> minx :number

Value of the minimum x coordinate of the particles of the system. Used for a faster creation of the bounding box of the system.
Type:
  • number
Source:

<private> miny :number

Value of the minimum y coordinate of the particles of the system. Used for a faster creation of the bounding box of the system.
Type:
  • number
Source:

<private> position :Grape2D.Vector

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

<private> receiveLight :boolean

Object can receive light.
Type:
  • boolean
Inherited From:
Source:

<private> texture :Grape2D.Texture

The texture of the object.
Type:
Inherited From:
Source:

<private> textureOffset :Grape2D.Vector

The offset of the texture.
Type:
Inherited From:
Source:

<private> texturePosition :Grape2D.Vector

The position of the texture. It is computed from the object's position and the texture offset.
Type:
Inherited From:
Source:

<private> visible :boolean

Visible property.
Type:
  • boolean
Inherited From:
Source:

Methods

addEmitter(emitter)

Adds an emitter to the system.
Parameters:
Name Type Description
emitter Grape2D.Emitter Emitter to add.
Source:

addField(field)

Adds a field to the system.
Parameters:
Name Type Description
field Grape2D.Field Field to add.
Source:

canCastShadow() → {boolean}

Checks if the object can cast shadows.
Inherited From:
Source:
Returns:
True if it cast shadows, false otherwise.
Type
boolean

canReceiveLight() → {boolean}

Checks if an object can receive light.
Inherited From:
Source:
Returns:
True if it receives light.
Type
boolean

<protected> computeBoundingBoxPosition()

Computes the bounding box position, from the object's position and bounding box offset.
Inherited From:
Source:

<protected> computeTexturePosition()

Computes the texture position of the object, from the object's position and texture offset.
Inherited From:
Source:

getBoundingBox() → {Grape2D.Shape}

Gets the bounding box of the object.
Inherited From:
Source:
Returns:
The shape of the object.
Type
Grape2D.Shape

getBoundingBoxOffset() → {Grape2D.Vector}

Gets the bounding box offset
Inherited From:
Source:
Returns:
The bounding box offset.
Type
Grape2D.Vector

getBoundingBoxPosition() → {Grape2D.Vector}

Gets the bounding box position.
Inherited From:
Source:
Returns:
The center position of the bounding box.
Type
Grape2D.Vector

getEmitters() → {!Array.<!Grape2D.Emitter>}

Gets the emitter list.
Source:
Returns:
Emitters of the system.
Type
!Array.<!Grape2D.Emitter>

getFields() → {!Array.<!Grape2D.Field>}

Gets the fields list.
Source:
Returns:
Fields of the system.
Type
!Array.<!Grape2D.Field>

getPosition()

Source:

getTexture() → {Grape2D.Texture}

Gets the texture of the object.
Inherited From:
Source:
Returns:
The texture of the object.
Type
Grape2D.Texture

getTextureOffset() → {Grape2D.Vector}

Gets the texture offset
Inherited From:
Source:
Returns:
The texture offset.
Type
Grape2D.Vector

getTexturePosition() → {Grape2D.Vector}

Gets the texture position.
Inherited From:
Source:
Returns:
The position of the texture
Type
Grape2D.Vector

isVisible() → {boolean}

Checks if the object should be rendered.
Inherited From:
Source:
Returns:
True if it can be rendered.
Type
boolean

process(processor)

Processes this object thought a processor. Same as a visitor pattern.
Parameters:
Name Type Description
processor Grape2D.Object2DProcessor A processor.
Inherited From:
Source:

removeEmitter(emitter)

Removes an emitter from the system.
Parameters:
Name Type Description
emitter Grape2D.Emitter An emitter that is in the system.
Source:

removeField(field)

Removes a field from the system.
Parameters:
Name Type Description
field Grape2D.Field A field that is in the system.
Source:

render()

Source:

setBoundingBox(boundingBox)

Sets the bounding box of the object. Also, the position of the new bounding box, will be transformed in the default offset of the bounding box.
Parameters:
Name Type Description
boundingBox Grape2D.Shape The bounding box.
Inherited From:
Source:

setBoundingBoxOffset(offset)

Sets the bounding box offset.
Parameters:
Name Type Description
offset Grape2D.Vector The offset of the bounding box, from the object's position.
Inherited From:
Source:

setCastShadow(castShadow)

Sets if an object can cast shadows.
Parameters:
Name Type Description
castShadow boolean True to cast shadows, false otherwise.
Inherited From:
Source:

setPosition(position)

Sets the object position.
Parameters:
Name Type Description
position Grape2D.Vector The position of the object.
Inherited From:
Source:

setReceiveLight(receiveLight)

Sets if the object can receive light.
Parameters:
Name Type Description
receiveLight boolean True if it receives light.
Inherited From:
Source:

setTexture(texture)

Sets the texture of the object.
Parameters:
Name Type Description
texture Grape2D.Texture The texture.
Inherited From:
Source:

setTextureOffset(offset)

Sets the texture offset.
Parameters:
Name Type Description
offset Grape2D.Vector The offset of the texture, from the object's position.
Inherited From:
Source:

setVisible(visible)

Sets if an object should be rendered.
Parameters:
Name Type Description
visible boolean True, so that it renders, false otherwise.
Inherited From:
Source:

submitParticle(particle)

Submits a particle to the system. This method is used mainly to keep an updated bounding box.
Parameters:
Name Type Description
particle Grape2D.Particle Particle inside the system.
Source:

update()

Source: