Scale3DTween

View source

ExtendsTween

Associates an entity’s Scale3D component with 3D scale tweening.

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

Examples

import { World } from '@wimaengine/ecs'
import { Scale3D } from '@wimaengine/transform'
import { Scale3DTween } from '@wimaengine/tween'

// Register DefaultTweenPlugin on the app that runs this world.
const world = new World()
world.spawn([
  new Scale3D(1, 1, 1),
  new Scale3DTween(
    new Scale3D(2, 2, 2),
    new Scale3D(1, 1, 1),
    0.5
  )
])

Constructor


constructor(to: Scale3D, from: Scale3D, 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