Orientation3DTween

View source

ExtendsTween

Associates an entity’s Orientation3D component with 3D orientation tweening.

Attach Orientation3DTween alongside Orientation3D. Register DefaultTweenPlugin for the built-in transform pairing, or a TweenPlugin configured for this pair, so the orientation is interpolated over time using the inherited Tween behavior. Without a matching plugin, this component only stores tween data and does not update the orientation.

Examples

import { World } from '@wimaengine/ecs'
import { Orientation3D } from '@wimaengine/transform'
import { Orientation3DTween } from '@wimaengine/tween'

// Register DefaultTweenPlugin on the app that runs this world.
const world = new World()
world.spawn([
  new Orientation3D(),
  new Orientation3DTween(
    new Orientation3D(0, Math.SQRT1_2, 0, Math.SQRT1_2),
    new Orientation3D(),
    1
  )
])

Constructor


constructor(to: Orientation3D, from: Orientation3D, duration: number, repeat?: boolean, flip?: boolean, easing?: EasingFn)

View source

Creates tween state for an ending value, starting value, and duration.

Values are assigned directly; the constructor does not clone to or from, or validate duration. The optional booleans are stored on the instance; use TweenRepeat and TweenFlip to opt into repeated cycles and endpoint swapping.

Parameters

NameDescriptionDefault
to

Value passed to interpolation at progress 1.

—
from

Value passed to interpolation at progress 0.

—
duration

Total tween duration in seconds.

—
repeat?

Stored repeat option.

false
flip?

Stored flip option.

true
easing?

Function applied to normalized progress.

Easing.linear