rhodonite
    Preparing search index...

    Class AnimatedQuaternion

    An animated quaternion that can be driven by animation samplers. This class extends the base Quaternion class to provide animation capabilities, allowing quaternion values to be interpolated over time using animation tracks. Supports blending between multiple animation tracks and both local and global time management.

    Hierarchy (View Summary)

    Implements

    Index

    Constructors

    Properties

    _v: Float32Array<ArrayBufferLike> = ...

    Internal typed array storage for quaternion components [x, y, z, w].

    isLoop: boolean = true

    Whether the animation should loop when it reaches the end.

    Accessors

    • get blendingRatio(): number

      Gets the current blending ratio between animation tracks.

      Returns number

      The current blending ratio

    • set blendingRatio(value: number): void

      Sets the blending ratio between the first and second active animation tracks.

      Parameters

      • value: number

        Blending ratio (0.0 = first track only, 1.0 = second track only)

      Returns void

    • get compositionType(): CompositionTypeClass<"VEC4">

      Gets the composition type for this quaternion class.

      Returns CompositionTypeClass<"VEC4">

      CompositionType.Vec4 indicating this is a 4-component vector

    Methods

    • Deletes an animation sampler for the specified track.

      Parameters

      • trackName: string

        The animation track name to delete

      Returns void

    • Calculates the dot product between this quaternion and another quaternion. The dot product of two quaternions gives a scalar value that represents the cosine of half the angle between them when both quaternions are unit quaternions.

      Parameters

      • quat: IQuaternion

        The quaternion to compute the dot product with

      Returns number

      The dot product result

    • Gets all available animation track names.

      Returns string[]

      Array of all animation track names

    • Gets the animation sampler for the specified track.

      Parameters

      • trackName: string

        The animation track name

      Returns AnimationSampler

      The animation sampler for the track

      When the specified animation track is not found

    • Gets the name of the first active animation track.

      Returns string

      The first active animation track name

    • Gets the maximum end time for the specified animation track.

      Parameters

      • trackName: string

        The animation track name

      Returns number

      The end time of the animation track

      When the specified animation track is not found

    • Gets the minimum start time for the specified animation track.

      Parameters

      • trackName: string

        The animation track name

      Returns number

      The start time of the animation track

      When the specified animation track is not found

    • Returns the quaternion values as a number array.

      Returns number[]

      Array containing the x, y, z, w components of the quaternion

    • Gets the name of the second active animation track.

      Returns string | undefined

      The second active animation track name, or undefined if not set

    • Checks if this quaternion is approximately equal to another quaternion within a tolerance.

      Parameters

      • quat: IQuaternion

        The quaternion to compare with

      • delta: number = Number.EPSILON

        The tolerance value (default: Number.EPSILON)

      Returns boolean

      True if all components are within the tolerance, false otherwise

    • Sets or updates an animation sampler for the specified track.

      Parameters

      • animationTrackName: string

        The animation track name

      • animationSampler: AnimationSampler

        The animation sampler to set

      Returns void

    • Sets the first active animation track.

      Parameters

      • animationTrackName: string

        The name of the animation track to set as the first active track

      Returns void

    • Sets the quaternion values from a Float32Array.

      Parameters

      • array: Float32Array

        Float32Array containing the quaternion components [x, y, z, w]

      Returns void

    • Sets the second active animation track for blending.

      Parameters

      • animationTrackName: string

        The name of the animation track to set as the second active track

      Returns void

    • Sets the local animation time for this quaternion. When set, this time will be used instead of the global animation time.

      Parameters

      • time: number

        The animation time in seconds

      Returns void

    • Updates the quaternion values based on the current animation time and active tracks. This method interpolates values from animation samplers and handles blending between tracks. If looping is enabled, the time will wrap around the animation duration.

      Returns void

    • Switches to using global animation time instead of local time. Resets the local time and triggers an update.

      Returns void

    • Creates a quaternion from individual component values.

      Parameters

      • x: number

        The x component

      • y: number

        The y component

      • z: number

        The z component

      • w: number

        The w component

      Returns Quaternion

      A new quaternion with the specified components