| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722 |
- type EasingFunction = (amount: number) => number;
- type EasingFunctionGroup = {
- In: EasingFunction;
- Out: EasingFunction;
- InOut: EasingFunction;
- };
- /**
- * The Ease class provides a collection of easing functions for use with tween.js.
- */
- declare const Easing: Readonly<{
- Linear: Readonly<EasingFunctionGroup & {
- None: EasingFunction;
- }>;
- Quadratic: Readonly<EasingFunctionGroup>;
- Cubic: Readonly<EasingFunctionGroup>;
- Quartic: Readonly<EasingFunctionGroup>;
- Quintic: Readonly<EasingFunctionGroup>;
- Sinusoidal: Readonly<EasingFunctionGroup>;
- Exponential: Readonly<EasingFunctionGroup>;
- Circular: Readonly<EasingFunctionGroup>;
- Elastic: Readonly<EasingFunctionGroup>;
- Back: Readonly<EasingFunctionGroup>;
- Bounce: Readonly<EasingFunctionGroup>;
- generatePow(power?: number): EasingFunctionGroup;
- }>;
-
- /**
- *
- */
- type InterpolationFunction = (v: number[], k: number) => number;
- /**
- *
- */
- declare const Interpolation: {
- Linear: (v: number[], k: number) => number;
- Bezier: (v: number[], k: number) => number;
- CatmullRom: (v: number[], k: number) => number;
- Utils: {
- Linear: (p0: number, p1: number, t: number) => number;
- Bernstein: (n: number, i: number) => number;
- Factorial: (n: number) => number;
- CatmullRom: (p0: number, p1: number, p2: number, p3: number, t: number) => number;
- };
- };
-
- /**
- * Tween.js - Licensed under the MIT license
- * https://github.com/tweenjs/tween.js
- * ----------------------------------------------
- *
- * See https://github.com/tweenjs/tween.js/graphs/contributors for the full list of contributors.
- * Thank you all, you're awesome!
- */
-
- declare class Tween<T extends UnknownProps = any> {
- static autoStartOnUpdate: boolean;
- private _isPaused;
- private _pauseStart;
- private _valuesStart;
- private _valuesEnd;
- private _valuesStartRepeat;
- private _duration;
- private _isDynamic;
- private _initialRepeat;
- private _repeat;
- private _repeatDelayTime?;
- private _yoyo;
- private _isPlaying;
- private _reversed;
- private _delayTime;
- private _startTime;
- private _easingFunction;
- private _interpolationFunction;
- private _chainedTweens;
- private _onStartCallback?;
- private _onStartCallbackFired;
- private _onEveryStartCallback?;
- private _onEveryStartCallbackFired;
- private _onUpdateCallback?;
- private _onRepeatCallback?;
- private _onCompleteCallback?;
- private _onStopCallback?;
- private _id;
- private _isChainStopped;
- private _propertiesAreSetUp;
- private _object;
- private _group?;
- /**
- * @param object - The object whose properties this Tween will animate.
- * @param group - The object whose properties this Tween will animate.
- */
- constructor(object: T, group?: Group);
- /**
- * @deprecated The group parameter is now deprecated, instead use `new
- * Tween(object)` then `group.add(tween)` to add a tween to a group. Use
- * `new Tween(object, true)` to restore the old behavior for now, but this
- * will be removed in the future.
- */
- constructor(object: T, group: true);
- getId(): number;
- isPlaying(): boolean;
- isPaused(): boolean;
- getDuration(): number;
- to(target: UnknownProps, duration?: number): this;
- duration(duration?: number): this;
- dynamic(dynamic?: boolean): this;
- start(time?: number, overrideStartingValues?: boolean): this;
- startFromCurrentValues(time?: number): this;
- private _setupProperties;
- stop(): this;
- end(): this;
- pause(time?: number): this;
- resume(time?: number): this;
- stopChainedTweens(): this;
- /**
- * Removes the tween from the current group it is in, if any, then adds the
- * tween to the specified `group`.
- */
- group(group: Group): this;
- /**
- * @deprecated The argless call signature has been removed. Use
- * `tween.group(group)` or `group.add(tween)`, instead.
- */
- group(): this;
- /**
- * Removes the tween from whichever group it is in.
- */
- remove(): this;
- delay(amount?: number): this;
- repeat(times?: number): this;
- repeatDelay(amount?: number): this;
- yoyo(yoyo?: boolean): this;
- easing(easingFunction?: EasingFunction): this;
- interpolation(interpolationFunction?: InterpolationFunction): this;
- chain(...tweens: Array<Tween<any>>): this;
- onStart(callback?: (object: T) => void): this;
- onEveryStart(callback?: (object: T) => void): this;
- onUpdate(callback?: (object: T, elapsed: number) => void): this;
- onRepeat(callback?: (object: T) => void): this;
- onComplete(callback?: (object: T) => void): this;
- onStop(callback?: (object: T) => void): this;
- private _goToEnd;
- /**
- * @returns true if the tween is still playing after the update, false
- * otherwise (calling update on a paused tween still returns true because
- * it is still playing, just paused).
- *
- * @param autoStart - When true, calling update will implicitly call start()
- * as well. Note, if you stop() or end() the tween, but are still calling
- * update(), it will start again!
- */
- update(time?: number, autoStart?: boolean): boolean;
- private _updateProperties;
- private _handleRelativeValue;
- private _swapEndStartRepeatValues;
- }
- type UnknownProps = Record<string, any>;
-
- /**
- * Controlling groups of tweens
- *
- * Using the TWEEN singleton to manage your tweens can cause issues in large apps with many components.
- * In these cases, you may want to create your own smaller groups of tween
- */
- declare class Group {
- private _tweens;
- private _tweensAddedDuringUpdate;
- constructor(...tweens: Tween[]);
- getAll(): Array<Tween>;
- removeAll(): void;
- add(...tweens: Tween[]): void;
- remove(...tweens: Tween[]): void;
- /** Return true if all tweens in the group are not paused or playing. */
- allStopped(): boolean;
- update(time?: number): void;
- /**
- * @deprecated The `preserve` parameter is now defaulted to `true` and will
- * be removed in a future major release, at which point all tweens of a
- * group will always be preserved when calling update. To migrate, always
- * use `group.add(tween)` or `group.remove(tween)` to manually add or remove
- * tweens, and do not rely on tweens being automatically added or removed.
- */
- update(time?: number, preserve?: boolean): void;
- }
-
- declare const now: () => number;
-
- /**
- * Utils
- */
- declare class Sequence {
- private static _nextId;
- static nextId(): number;
- }
-
- declare const VERSION = "25.0.0";
-
- declare const nextId: typeof Sequence.nextId;
- /**
- * @deprecated The global TWEEN Group will be removed in a following major
- * release. To migrate, create a `new Group()` instead of using `TWEEN` as a
- * group.
- *
- * Old code:
- *
- * ```js
- * import * as TWEEN from '@tweenjs/tween.js'
- *
- * //...
- *
- * const tween = new TWEEN.Tween(obj)
- * const tween2 = new TWEEN.Tween(obj2)
- *
- * //...
- *
- * requestAnimationFrame(function loop(time) {
- * TWEEN.update(time)
- * requestAnimationFrame(loop)
- * })
- * ```
- *
- * New code:
- *
- * ```js
- * import {Tween, Group} from '@tweenjs/tween.js'
- *
- * //...
- *
- * const tween = new Tween(obj)
- * const tween2 = new TWEEN.Tween(obj2)
- *
- * //...
- *
- * const group = new Group()
- * group.add(tween)
- * group.add(tween2)
- *
- * //...
- *
- * requestAnimationFrame(function loop(time) {
- * group.update(time)
- * requestAnimationFrame(loop)
- * })
- * ```
- */
- declare const getAll: () => Tween<any>[];
- /**
- * @deprecated The global TWEEN Group will be removed in a following major
- * release. To migrate, create a `new Group()` instead of using `TWEEN` as a
- * group.
- *
- * Old code:
- *
- * ```js
- * import * as TWEEN from '@tweenjs/tween.js'
- *
- * //...
- *
- * const tween = new TWEEN.Tween(obj)
- * const tween2 = new TWEEN.Tween(obj2)
- *
- * //...
- *
- * requestAnimationFrame(function loop(time) {
- * TWEEN.update(time)
- * requestAnimationFrame(loop)
- * })
- * ```
- *
- * New code:
- *
- * ```js
- * import {Tween, Group} from '@tweenjs/tween.js'
- *
- * //...
- *
- * const tween = new Tween(obj)
- * const tween2 = new TWEEN.Tween(obj2)
- *
- * //...
- *
- * const group = new Group()
- * group.add(tween)
- * group.add(tween2)
- *
- * //...
- *
- * requestAnimationFrame(function loop(time) {
- * group.update(time)
- * requestAnimationFrame(loop)
- * })
- * ```
- */
- declare const removeAll: () => void;
- /**
- * @deprecated The global TWEEN Group will be removed in a following major
- * release. To migrate, create a `new Group()` instead of using `TWEEN` as a
- * group.
- *
- * Old code:
- *
- * ```js
- * import * as TWEEN from '@tweenjs/tween.js'
- *
- * //...
- *
- * const tween = new TWEEN.Tween(obj)
- * const tween2 = new TWEEN.Tween(obj2)
- *
- * //...
- *
- * requestAnimationFrame(function loop(time) {
- * TWEEN.update(time)
- * requestAnimationFrame(loop)
- * })
- * ```
- *
- * New code:
- *
- * ```js
- * import {Tween, Group} from '@tweenjs/tween.js'
- *
- * //...
- *
- * const tween = new Tween(obj)
- * const tween2 = new TWEEN.Tween(obj2)
- *
- * //...
- *
- * const group = new Group()
- * group.add(tween)
- * group.add(tween2)
- *
- * //...
- *
- * requestAnimationFrame(function loop(time) {
- * group.update(time)
- * requestAnimationFrame(loop)
- * })
- * ```
- */
- declare const add: (...tweens: Tween<any>[]) => void;
- /**
- * @deprecated The global TWEEN Group will be removed in a following major
- * release. To migrate, create a `new Group()` instead of using `TWEEN` as a
- * group.
- *
- * Old code:
- *
- * ```js
- * import * as TWEEN from '@tweenjs/tween.js'
- *
- * //...
- *
- * const tween = new TWEEN.Tween(obj)
- * const tween2 = new TWEEN.Tween(obj2)
- *
- * //...
- *
- * requestAnimationFrame(function loop(time) {
- * TWEEN.update(time)
- * requestAnimationFrame(loop)
- * })
- * ```
- *
- * New code:
- *
- * ```js
- * import {Tween, Group} from '@tweenjs/tween.js'
- *
- * //...
- *
- * const tween = new Tween(obj)
- * const tween2 = new TWEEN.Tween(obj2)
- *
- * //...
- *
- * const group = new Group()
- * group.add(tween)
- * group.add(tween2)
- *
- * //...
- *
- * requestAnimationFrame(function loop(time) {
- * group.update(time)
- * requestAnimationFrame(loop)
- * })
- * ```
- */
- declare const remove: (...tweens: Tween<any>[]) => void;
- /**
- * @deprecated The global TWEEN Group will be removed in a following major
- * release. To migrate, create a `new Group()` instead of using `TWEEN` as a
- * group.
- *
- * Old code:
- *
- * ```js
- * import * as TWEEN from '@tweenjs/tween.js'
- *
- * //...
- *
- * const tween = new TWEEN.Tween(obj)
- * const tween2 = new TWEEN.Tween(obj2)
- *
- * //...
- *
- * requestAnimationFrame(function loop(time) {
- * TWEEN.update(time)
- * requestAnimationFrame(loop)
- * })
- * ```
- *
- * New code:
- *
- * ```js
- * import {Tween, Group} from '@tweenjs/tween.js'
- *
- * //...
- *
- * const tween = new Tween(obj)
- * const tween2 = new TWEEN.Tween(obj2)
- *
- * //...
- *
- * const group = new Group()
- * group.add(tween)
- * group.add(tween2)
- *
- * //...
- *
- * requestAnimationFrame(function loop(time) {
- * group.update(time)
- * requestAnimationFrame(loop)
- * })
- * ```
- */
- declare const update: {
- (time?: number | undefined): void;
- (time?: number | undefined, preserve?: boolean | undefined): void;
- };
-
- declare const exports: {
- Easing: Readonly<{
- Linear: Readonly<EasingFunctionGroup & {
- None: EasingFunction;
- }>;
- Quadratic: Readonly<EasingFunctionGroup>;
- Cubic: Readonly<EasingFunctionGroup>;
- Quartic: Readonly<EasingFunctionGroup>;
- Quintic: Readonly<EasingFunctionGroup>;
- Sinusoidal: Readonly<EasingFunctionGroup>;
- Exponential: Readonly<EasingFunctionGroup>;
- Circular: Readonly<EasingFunctionGroup>;
- Elastic: Readonly<EasingFunctionGroup>;
- Back: Readonly<EasingFunctionGroup>;
- Bounce: Readonly<EasingFunctionGroup>;
- generatePow(power?: number): EasingFunctionGroup;
- }>;
- Group: typeof Group;
- Interpolation: {
- Linear: (v: number[], k: number) => number;
- Bezier: (v: number[], k: number) => number;
- CatmullRom: (v: number[], k: number) => number;
- Utils: {
- Linear: (p0: number, p1: number, t: number) => number;
- Bernstein: (n: number, i: number) => number;
- Factorial: (n: number) => number;
- CatmullRom: (p0: number, p1: number, p2: number, p3: number, t: number) => number;
- };
- };
- now: () => number;
- Sequence: typeof Sequence;
- nextId: typeof Sequence.nextId;
- Tween: typeof Tween;
- VERSION: string;
- /**
- * @deprecated The global TWEEN Group will be removed in a following major
- * release. To migrate, create a `new Group()` instead of using `TWEEN` as a
- * group.
- *
- * Old code:
- *
- * ```js
- * import * as TWEEN from '@tweenjs/tween.js'
- *
- * //...
- *
- * const tween = new TWEEN.Tween(obj)
- * const tween2 = new TWEEN.Tween(obj2)
- *
- * //...
- *
- * requestAnimationFrame(function loop(time) {
- * TWEEN.update(time)
- * requestAnimationFrame(loop)
- * })
- * ```
- *
- * New code:
- *
- * ```js
- * import {Tween, Group} from '@tweenjs/tween.js'
- *
- * //...
- *
- * const tween = new Tween(obj)
- * const tween2 = new TWEEN.Tween(obj2)
- *
- * //...
- *
- * const group = new Group()
- * group.add(tween)
- * group.add(tween2)
- *
- * //...
- *
- * requestAnimationFrame(function loop(time) {
- * group.update(time)
- * requestAnimationFrame(loop)
- * })
- * ```
- */
- getAll: () => Tween<any>[];
- /**
- * @deprecated The global TWEEN Group will be removed in a following major
- * release. To migrate, create a `new Group()` instead of using `TWEEN` as a
- * group.
- *
- * Old code:
- *
- * ```js
- * import * as TWEEN from '@tweenjs/tween.js'
- *
- * //...
- *
- * const tween = new TWEEN.Tween(obj)
- * const tween2 = new TWEEN.Tween(obj2)
- *
- * //...
- *
- * requestAnimationFrame(function loop(time) {
- * TWEEN.update(time)
- * requestAnimationFrame(loop)
- * })
- * ```
- *
- * New code:
- *
- * ```js
- * import {Tween, Group} from '@tweenjs/tween.js'
- *
- * //...
- *
- * const tween = new Tween(obj)
- * const tween2 = new TWEEN.Tween(obj2)
- *
- * //...
- *
- * const group = new Group()
- * group.add(tween)
- * group.add(tween2)
- *
- * //...
- *
- * requestAnimationFrame(function loop(time) {
- * group.update(time)
- * requestAnimationFrame(loop)
- * })
- * ```
- */
- removeAll: () => void;
- /**
- * @deprecated The global TWEEN Group will be removed in a following major
- * release. To migrate, create a `new Group()` instead of using `TWEEN` as a
- * group.
- *
- * Old code:
- *
- * ```js
- * import * as TWEEN from '@tweenjs/tween.js'
- *
- * //...
- *
- * const tween = new TWEEN.Tween(obj)
- * const tween2 = new TWEEN.Tween(obj2)
- *
- * //...
- *
- * requestAnimationFrame(function loop(time) {
- * TWEEN.update(time)
- * requestAnimationFrame(loop)
- * })
- * ```
- *
- * New code:
- *
- * ```js
- * import {Tween, Group} from '@tweenjs/tween.js'
- *
- * //...
- *
- * const tween = new Tween(obj)
- * const tween2 = new TWEEN.Tween(obj2)
- *
- * //...
- *
- * const group = new Group()
- * group.add(tween)
- * group.add(tween2)
- *
- * //...
- *
- * requestAnimationFrame(function loop(time) {
- * group.update(time)
- * requestAnimationFrame(loop)
- * })
- * ```
- */
- add: (...tweens: Tween<any>[]) => void;
- /**
- * @deprecated The global TWEEN Group will be removed in a following major
- * release. To migrate, create a `new Group()` instead of using `TWEEN` as a
- * group.
- *
- * Old code:
- *
- * ```js
- * import * as TWEEN from '@tweenjs/tween.js'
- *
- * //...
- *
- * const tween = new TWEEN.Tween(obj)
- * const tween2 = new TWEEN.Tween(obj2)
- *
- * //...
- *
- * requestAnimationFrame(function loop(time) {
- * TWEEN.update(time)
- * requestAnimationFrame(loop)
- * })
- * ```
- *
- * New code:
- *
- * ```js
- * import {Tween, Group} from '@tweenjs/tween.js'
- *
- * //...
- *
- * const tween = new Tween(obj)
- * const tween2 = new TWEEN.Tween(obj2)
- *
- * //...
- *
- * const group = new Group()
- * group.add(tween)
- * group.add(tween2)
- *
- * //...
- *
- * requestAnimationFrame(function loop(time) {
- * group.update(time)
- * requestAnimationFrame(loop)
- * })
- * ```
- */
- remove: (...tweens: Tween<any>[]) => void;
- /**
- * @deprecated The global TWEEN Group will be removed in a following major
- * release. To migrate, create a `new Group()` instead of using `TWEEN` as a
- * group.
- *
- * Old code:
- *
- * ```js
- * import * as TWEEN from '@tweenjs/tween.js'
- *
- * //...
- *
- * const tween = new TWEEN.Tween(obj)
- * const tween2 = new TWEEN.Tween(obj2)
- *
- * //...
- *
- * requestAnimationFrame(function loop(time) {
- * TWEEN.update(time)
- * requestAnimationFrame(loop)
- * })
- * ```
- *
- * New code:
- *
- * ```js
- * import {Tween, Group} from '@tweenjs/tween.js'
- *
- * //...
- *
- * const tween = new Tween(obj)
- * const tween2 = new TWEEN.Tween(obj2)
- *
- * //...
- *
- * const group = new Group()
- * group.add(tween)
- * group.add(tween2)
- *
- * //...
- *
- * requestAnimationFrame(function loop(time) {
- * group.update(time)
- * requestAnimationFrame(loop)
- * })
- * ```
- */
- update: {
- (time?: number | undefined): void;
- (time?: number | undefined, preserve?: boolean | undefined): void;
- };
- };
-
- export { Easing, Group, Interpolation, Sequence, Tween, VERSION, add, exports as default, getAll, nextId, now, remove, removeAll, update };
|