TweenRepeat

View source

Marks an entity’s concrete tween for marker-driven repeat behavior.

Attach this empty component alongside a concrete tween such as Position2DTween. When the matching TweenPlugin is registered, the tween starts a new cycle whenever its elapsed time reaches its duration. Add this marker to opt the entity into repeated cycles.

TweenRepeat has no fields or constructor options. If your app uses reflection, registering tween marker metadata during startup exposes this component as an empty reflected type with copy and clone support.

Examples

import { World } from '@wimaengine/ecs'
import { Position2D } from '@wimaengine/transform'
import { Position2DTween, TweenRepeat } from '@wimaengine/tween'

// Register the tween plugin on the app that runs this world.
const world = new World()
world.spawn([
  new Position2D(0, 0),
  new Position2DTween(
    new Position2D(100, 0),
    new Position2D(0, 0),
    2
  ),
  new TweenRepeat()
])

Constructor


constructor()

Methods


staticcopy(source: TweenRepeat, target?: TweenRepeat): TweenRepeat

View source

Returns a marker target without copying any state.

TweenRepeat has no fields, so source is not read. When target is omitted, a new marker is returned; otherwise the exact target is returned unchanged.

Parameters

NameDescriptionDefault
source

Marker source; it has no state to read.

—
target?

Marker to return unchanged.

...

Returns

The supplied target or a new empty marker.

staticclone(target: TweenRepeat): TweenRepeat

View source

Creates an empty marker because there is no state to clone.

This delegates to TweenRepeat.copy without a target, so the result is always a new TweenRepeat instance.

Parameters

NameDescriptionDefault
target

Marker source; it is not read.

—

Returns

A new empty marker.