Options
All
  • Public
  • Public/Protected
  • All
Menu

Namespace ParticleUtils

Contains helper functions for particles and emitters to use.

Index

Variables

Const DEG_TO_RADS

DEG_TO_RADS: number = Math.PI / 180

Const verbose

verbose: false = false

If errors and warnings should be logged within the library.

Functions

combineRGBComponents

  • combineRGBComponents(r: number, g: number, b: number): number
  • Combines separate color components (0-255) into a single uint color.

    Parameters

    • r: number

      The red value of the color

    • g: number

      The green value of the color

    • b: number

      The blue value of the color

    Returns number

    The color in the form of 0xRRGGBB

createSteppedGradient

  • Converts a list of {value, time} objects starting at time 0 and ending at time 1 into an evenly spaced stepped list of PropertyNodes for color values. This is primarily to handle conversion of linear gradients to fewer colors, allowing for some optimization for Canvas2d fallbacks.

    Parameters

    • list: ValueStep<string>[]

      The list of data to convert.

    • Default value numSteps: number = 10

    Returns PropertyNode<Color>

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

generateEase

getBlendMode

  • getBlendMode(name: string): number
  • Gets a blend mode, ensuring that it is valid.

    Parameters

    • name: string

      The name of the blend mode to get.

    Returns number

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

hexToRGB

  • Converts a hex string from "#AARRGGBB", "#RRGGBB", "0xAARRGGBB", "0xRRGGBB", "AARRGGBB", or "RRGGBB" to an object of ints of 0-255, as {r, g, b, (a)}.

    Parameters

    • color: string

      The input color string.

    • Optional output: Color

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

    Returns Color

    The object with r, g, and b properties, possibly with an a property.

length

  • length(point: Point): number
  • Returns the length (or magnitude) of this point.

    Parameters

    • point: Point

      The point to measure length

    Returns number

    The length of this point.

normalize

  • normalize(point: Point): void
  • Reduces the point to a length of 1.

    Parameters

    • point: Point

      The point to normalize

    Returns void

rotatePoint

  • rotatePoint(angle: number, p: Point): void
  • Rotates a point by a given angle.

    Parameters

    • angle: number

      The angle to rotate by in degrees

    • p: Point

      The point to rotate around 0,0.

    Returns void

scaleBy

  • scaleBy(point: Point, value: number): void
  • Multiplies the x and y values of this point by a value.

    Parameters

    • point: Point

      The point to scaleBy

    • value: number

      The value to scale by.

    Returns void

Generated using TypeDoc