mwg API
    Preparing search index...

    Class Tweener

    Runs any number of concurrent tweens; a game or a widget drives it from its own update(dt).

    import { Tweener, Easing } from '@datamoc/mw_games/core';

    const tweener = new Tweener();
    const sprite = { alpha: 0 };

    tweener.tween(0.5, (t) => { sprite.alpha = t; }, Easing.easeOutQuad);

    // in the game loop:
    tweener.update(1 / 60);
    Index
    • get isBusy(): boolean

      true while any tween is still running

      Returns boolean

    • drops every running tween without applying its end state or resolving it - a teardown, not a completion

      Returns void

    • Runs apply with progress eased from 0 to 1 over duration seconds, resolving once it reaches 1. A non-positive duration applies the end state at once rather than waiting a frame for it, and so does a decorative motion under reduced motion (core.reducedMotion); a meaningful one is shortened instead, and an alternate replaces it outright. See TweenOptions.

      Parameters

      • duration: number
      • apply: (t: number) => void
      • options: Easing | TweenOptions = Easing.linear

      Returns Promise<void>