Records the position and attitude history of a Mesh allowing the Mesh to be drawn in multiple historical configurations.

This class is refererce counted because it maintains a reference to a Mesh. You should call the release method when the trail is no longer required.

// The trail is constructed, at any time, on an existing mesh.
const trail = new EIGHT.Trail(mesh)

// Configure the Trail object, or use the defaults.
trail.config.enabled = true
trail.config.interval = 30
trail.config.retain = 5

// Take a snapshot of the ball position and attitude, usually each animation frame.
trail.snapshot()

// Draw the trail during the animation frame.
trail.draw(ambients)

// Release the trail when no longer required, usually in the window.onunload function.
trail.release()

Hierarchy (view full)

Implements

Constructors

Properties

config: TrailConfig = ...

The configuration that determines how the history is recorded.

Methods

  • This method is for use within constructors.

    Immediately after a call to the super class constructor, make a call to setLoggingName. This will have the effect of refining the name used for reporting reference counts.

    This method has the secondary purpose of enabling a tally of the number of classes in the constructor chain. This enables the runtime architecture to verify that destructor chains are consistent with constructor chains, which is a good practice for cleaning up resources.

    Notice that this method is intentionally protected to discourage it from being called outside of the constructor.

    Parameters

    • name: string

      This will usually be set to the name of the class.

    Returns void

  • Records the Mesh variables according to the interval property.

    Parameters

    • alpha: number = 0

    Returns void