A type of ping that produces a pulsing animation.

Param: origin

The canvas coordinates of the origin of the ping.

Param: options

Additional options to configure the ping animation.

Hierarchy (view full)

Methods

  • Start the ping animation.

    Returns Promise<boolean>

    Returns true if the animation ran to completion, false otherwise.

  • On each tick, advance the animation.

    Parameters

    • dt: any

      The number of ms that elapsed since the previous frame.

    • animation: any

      The animation state.

    Returns void

  • Parameters

    • options: {} = {}

      Returns void

      Inherit Doc

    • Protected

      Draw the shape for this ping.

      Parameters

      • g: Graphics

        The graphics object to draw to.

      • color: number

        The color of the shape.

      • alpha: number

        The alpha of the shape.

      • size: number

        The size of the shape to draw.

      Returns void

    • Private

      Initialize some time slice variables that will be used to control the animation.

      The animation for each ring can be separated into two consecutive stages. Stage 1: Fade in a white ring with radius r0. Stage 2: Expand radius outward. While the radius is expanding outward, we have two additional, consecutive animations: Stage 2.1: Transition color from white to the configured color. Stage 2.2: Fade out. 1/5th of the animation time is allocated to Stage 1. 4/5ths are allocated to Stage 2. Of those 4/5ths, 2/5ths are allocated to Stage 2.1, and 2/5ths are allocated to Stage 2.2.

      Returns void

    • Private

      Transition linearly from one color to another.

      Parameters

      • from: typeof Color

        The color to transition from.

      • to: typeof Color

        The color to transition to.

      • duration: number

        The length of the transition in milliseconds.

      • t: number

        The current time along the duration.

      Returns number

      The incremental color between from and to.