Skip to content

Latest commit

 

History

History
81 lines (58 loc) · 2.53 KB

Particle.md

File metadata and controls

81 lines (58 loc) · 2.53 KB

Particle

Kind: global class

new Particle()

This Particle class is used along with ParticleModel and Emitter class.

import { Particle } from 'ad-particles'

Particle.update()

Updates the properties of the particle

Kind: static method of Particle

Particle.getAnimationStyle()

Update the animated style of a particle

Kind: static method of Particle

Particle.render()

Renders the particle onto the canvas context.

Kind: static method of Particle

Particle.applyForce()

Applies force to the particle.

Kind: static method of Particle

Particle.isDead() ⇒ boolean

Returns a boolean of is the particle is dead depending on two situations:

  1. if it has reaches its lifespan, or
  2. if it is out of the canvas and if EmitterData.killIfOutOfCanvas is set to true

Kind: static method of Particle

Particle.checkWorld(w)

Remains the particle in the defined world boundaries by its body size and bounces it when it hits the boundaries.

Kind: static method of Particle

Param Type Description
w array an array that contains left X, right X, top Y, bottom Y as values for the boundary

Particle._checkBorder(axis, val)

Check it the particle location reaches the border, if ture, it bounces to it.

Kind: static method of Particle

Param Type Description
axis string String 'x' or 'y'
val number the location of the border on the X or Y axis