API Docs for: 2.2.1
Show:

PathParticle Class

An particle that follows a path defined by an algebraic expression, e.g. "sin(x)" or "5x + 3". To use this class, the particle config must have a "path" string in the "extraData" parameter. This string should have "x" in it to represent movement (from the speed settings of the particle). It may have numbers, parentheses, the four basic operations, and the following Math functions or properties (without the preceding "Math."): "pow", "sqrt", "abs", "floor", "round", "ceil", "E", "PI", "sin", "cos", "tan", "asin", "acos", "atan", "atan2", "log". The overall movement of the particle and the expression value become x and y positions for the particle, respectively. The final position is rotated by the spawn rotation/angle of the particle.

Some example paths:

"sin(x/10) * 20" // A sine wave path.
                        "cos(x/100) * 30" // Particles curve counterclockwise (for medium speed/low lifetime particles)
                        "pow(x/10, 2) / 2" // Particles curve clockwise (remember, +y is down).
                        

Constructor

PathParticle

(
  • emitter
)

Parameters:

  • emitter Emitter

    The emitter that controls this PathParticle.

Item Index

Methods

Methods

combineRGBComponents

(
  • r
  • g
  • b
)
Int static

Combines separate color components (0-255) into a single uint color.

Parameters:

  • r Int

    The red value of the color

  • g Int

    The green value of the color

  • b Int

    The blue value of the color

Returns:

Int:

The color in the form of 0xRRGGBB

destroy

()

Destroys the particle, removing references and preventing future use.

generateEase

(
  • segments
)
Float->Float static

Generates a custom ease function, based on the GreenSock custom ease, as demonstrated by the related tool at http://www.greensock.com/customease/.

Parameters:

Returns:

Float->Float:

A function that calculates the percentage of change at a given point in time (0-1 inclusive).

getBlendMode

(
  • name
)
Int static

Gets a blend mode, ensuring that it is valid.

Parameters:

  • name String

    The name of the blend mode to get.

Returns:

Int:

The blend mode as specified in the PIXI.blendModes enumeration.

hexToRGB

(
  • color
  • output
)
Array static

Converts a hex string from "#AARRGGBB", "#RRGGBB", "0xAARRGGBB", "0xRRGGBB", "AARRGGBB", or "RRGGBB" to an array of ints of 0-255 or Numbers from 0-1, as [r, g, b, (a)].

Parameters:

  • color String

    The input color string.

  • output Array

    An array to put the output in. If omitted, a new array is created.

Returns:

Array:

The array of numeric color values.

init

()

Initializes the particle for use, based on the properties that have to have been set already on the particle.

length

(
  • point
)
Float static

Returns the length (or magnitude) of this point.

Parameters:

  • point pixi.geom.Point

    The point to measure length

Returns:

Float:

The length of this point.

normalize

(
  • point
)
static

Reduces the point to a length of 1.

Parameters:

  • point pixi.geom.Point

    The point to normalize

rotatePoint

(
  • angle
  • p
)
static

Rotates a point by a given angle.

Parameters:

  • angle Float

    The angle to rotate by in degrees

  • p pixi.geom.Point

    The point to rotate around 0,0.

scaleBy

(
  • point
  • value
)
static

Multiplies the x and y values of this point by a value.

Parameters:

  • point pixi.geom.Point

    The point to scaleBy

  • value Float

    The value to scale by.

Properties

initialPosition

pixi.geom.Point

The initial position of the particle, as all path movement is added to that.

initialRotation

Float

The initial rotation in degrees of the particle, because the direction of the path is based on that.

movement

Float

Total single directional movement, due to speed.

path

Float->Float

The function representing the path the particle should take.