@flighthq/tween 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/colorTween.d.ts +14 -0
- package/dist/colorTween.d.ts.map +1 -0
- package/dist/colorTween.js +28 -0
- package/dist/colorTween.js.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -0
- package/dist/internal.d.ts +3 -0
- package/dist/internal.d.ts.map +1 -0
- package/dist/internal.js +18 -0
- package/dist/internal.js.map +1 -0
- package/dist/timer.d.ts +3 -0
- package/dist/timer.d.ts.map +1 -0
- package/dist/timer.js +5 -0
- package/dist/timer.js.map +1 -0
- package/dist/tween.d.ts +20 -0
- package/dist/tween.d.ts.map +1 -0
- package/dist/tween.js +194 -0
- package/dist/tween.js.map +1 -0
- package/dist/tweenManager.d.ts +5 -0
- package/dist/tweenManager.d.ts.map +1 -0
- package/dist/tweenManager.js +10 -0
- package/dist/tweenManager.js.map +1 -0
- package/dist/tweenProgress.d.ts +33 -0
- package/dist/tweenProgress.d.ts.map +1 -0
- package/dist/tweenProgress.js +87 -0
- package/dist/tweenProgress.js.map +1 -0
- package/dist/tweenStagger.d.ts +27 -0
- package/dist/tweenStagger.d.ts.map +1 -0
- package/dist/tweenStagger.js +51 -0
- package/dist/tweenStagger.js.map +1 -0
- package/dist/updateTweens.d.ts +4 -0
- package/dist/updateTweens.d.ts.map +1 -0
- package/dist/updateTweens.js +78 -0
- package/dist/updateTweens.js.map +1 -0
- package/package.json +39 -0
- package/src/colorTween.test.ts +48 -0
- package/src/timer.test.ts +56 -0
- package/src/tween.test.ts +385 -0
- package/src/tweenManager.test.ts +52 -0
- package/src/tweenProgress.test.ts +197 -0
- package/src/tweenStagger.test.ts +94 -0
- package/src/updateTweens.test.ts +292 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Tween, TweenManager, TweenOptions } from '@flighthq/types';
|
|
2
|
+
type ColorComponents = {
|
|
3
|
+
b: number;
|
|
4
|
+
g: number;
|
|
5
|
+
r: number;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* Tween a packed 0xRRGGBB color property on target.
|
|
9
|
+
* Components are interpolated in float space; the composed value written on each
|
|
10
|
+
* update is always a rounded integer.
|
|
11
|
+
*/
|
|
12
|
+
export declare function createColorTween(manager: TweenManager, target: Record<string, number>, property: string, duration: number, toColor: number, options?: Readonly<TweenOptions>): Tween<ColorComponents>;
|
|
13
|
+
export {};
|
|
14
|
+
//# sourceMappingURL=colorTween.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"colorTween.d.ts","sourceRoot":"","sources":["../src/colorTween.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAIzE,KAAK,eAAe,GAAG;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAE3D;;;;GAIG;AACH,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,YAAY,EACrB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAC9B,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE,QAAQ,CAAC,YAAY,CAAC,GAC/B,KAAK,CAAC,eAAe,CAAC,CAyBxB"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { connectSignal } from '@flighthq/signals';
|
|
2
|
+
import { createTween } from './tween';
|
|
3
|
+
/**
|
|
4
|
+
* Tween a packed 0xRRGGBB color property on target.
|
|
5
|
+
* Components are interpolated in float space; the composed value written on each
|
|
6
|
+
* update is always a rounded integer.
|
|
7
|
+
*/
|
|
8
|
+
export function createColorTween(manager, target, property, duration, toColor, options) {
|
|
9
|
+
const fromColor = target[property] ?? 0;
|
|
10
|
+
const components = {
|
|
11
|
+
b: fromColor & 0xff,
|
|
12
|
+
g: (fromColor >> 8) & 0xff,
|
|
13
|
+
r: (fromColor >> 16) & 0xff,
|
|
14
|
+
};
|
|
15
|
+
const tween = createTween(manager, components, duration, {
|
|
16
|
+
b: toColor & 0xff,
|
|
17
|
+
g: (toColor >> 8) & 0xff,
|
|
18
|
+
r: (toColor >> 16) & 0xff,
|
|
19
|
+
}, options);
|
|
20
|
+
connectSignal(tween.onUpdate, () => {
|
|
21
|
+
target[property] =
|
|
22
|
+
((Math.round(components.r) & 0xff) << 16) |
|
|
23
|
+
((Math.round(components.g) & 0xff) << 8) |
|
|
24
|
+
(Math.round(components.b) & 0xff);
|
|
25
|
+
});
|
|
26
|
+
return tween;
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=colorTween.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"colorTween.js","sourceRoot":"","sources":["../src/colorTween.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAGlD,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAItC;;;;GAIG;AACH,MAAM,UAAU,gBAAgB,CAC9B,OAAqB,EACrB,MAA8B,EAC9B,QAAgB,EAChB,QAAgB,EAChB,OAAe,EACf,OAAgC;IAEhC,MAAM,SAAS,GAAG,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IACxC,MAAM,UAAU,GAAoB;QAClC,CAAC,EAAE,SAAS,GAAG,IAAI;QACnB,CAAC,EAAE,CAAC,SAAS,IAAI,CAAC,CAAC,GAAG,IAAI;QAC1B,CAAC,EAAE,CAAC,SAAS,IAAI,EAAE,CAAC,GAAG,IAAI;KAC5B,CAAC;IACF,MAAM,KAAK,GAAG,WAAW,CACvB,OAAO,EACP,UAAU,EACV,QAAQ,EACR;QACE,CAAC,EAAE,OAAO,GAAG,IAAI;QACjB,CAAC,EAAE,CAAC,OAAO,IAAI,CAAC,CAAC,GAAG,IAAI;QACxB,CAAC,EAAE,CAAC,OAAO,IAAI,EAAE,CAAC,GAAG,IAAI;KAC1B,EACD,OAAO,CACR,CAAC;IACF,aAAa,CAAC,KAAK,CAAC,QAAQ,EAAE,GAAG,EAAE;QACjC,MAAM,CAAC,QAAQ,CAAC;YACd,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;gBACzC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC;gBACxC,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;IACtC,CAAC,CAAC,CAAC;IACH,OAAO,KAAK,CAAC;AACf,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../src/internal.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAE7C,wBAAgB,eAAe,CAAC,CAAC,SAAS,MAAM,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,GAAG,IAAI,CAevE"}
|
package/dist/internal.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export function initializeTween(tween) {
|
|
2
|
+
const target = tween.target;
|
|
3
|
+
const propertyMap = tween.propertyMap;
|
|
4
|
+
for (const detail of tween.properties) {
|
|
5
|
+
const start = target[detail.key] ?? 0;
|
|
6
|
+
const end = propertyMap[detail.key] ?? 0;
|
|
7
|
+
detail.start = start;
|
|
8
|
+
detail.change = end - start;
|
|
9
|
+
if (tween.smartRotation) {
|
|
10
|
+
let change = ((detail.change % 360) + 360) % 360;
|
|
11
|
+
if (change > 180)
|
|
12
|
+
change -= 360;
|
|
13
|
+
detail.change = change;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
tween.initialized = true;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=internal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../src/internal.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,eAAe,CAAmB,KAAe;IAC/D,MAAM,MAAM,GAAG,KAAK,CAAC,MAAgC,CAAC;IACtD,MAAM,WAAW,GAAG,KAAK,CAAC,WAAqC,CAAC;IAChE,KAAK,MAAM,MAAM,IAAI,KAAK,CAAC,UAAU,EAAE,CAAC;QACtC,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QACtC,MAAM,GAAG,GAAG,WAAW,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QACzC,MAAM,CAAC,KAAK,GAAG,KAAK,CAAC;QACrB,MAAM,CAAC,MAAM,GAAG,GAAG,GAAG,KAAK,CAAC;QAC5B,IAAI,KAAK,CAAC,aAAa,EAAE,CAAC;YACxB,IAAI,MAAM,GAAG,CAAC,CAAC,MAAM,CAAC,MAAM,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC;YACjD,IAAI,MAAM,GAAG,GAAG;gBAAE,MAAM,IAAI,GAAG,CAAC;YAChC,MAAM,CAAC,MAAM,GAAG,MAAM,CAAC;QACzB,CAAC;IACH,CAAC;IACD,KAAK,CAAC,WAAW,GAAG,IAAI,CAAC;AAC3B,CAAC"}
|
package/dist/timer.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"timer.d.ts","sourceRoot":"","sources":["../src/timer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAIzE,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,YAAY,EACrB,QAAQ,EAAE,MAAM,EAChB,OAAO,CAAC,EAAE,QAAQ,CAAC,YAAY,CAAC,GAC/B,KAAK,CAAC,MAAM,CAAC,CAEf"}
|
package/dist/timer.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"timer.js","sourceRoot":"","sources":["../src/timer.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAEtC,MAAM,UAAU,gBAAgB,CAC9B,OAAqB,EACrB,QAAgB,EAChB,OAAgC;IAEhC,OAAO,WAAW,CAAC,OAAO,EAAE,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,OAAO,CAAC,CAAC;AACzD,CAAC"}
|
package/dist/tween.d.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { NumericProps, StopTweenOptions, Tween, TweenManager, TweenOptions } from '@flighthq/types';
|
|
2
|
+
export type { NumericProps, StopTweenOptions, Tween, TweenManager, TweenOptions } from '@flighthq/types';
|
|
3
|
+
export declare function applyTween<T extends object>(manager: TweenManager, target: T, propertyMap: Readonly<NumericProps<T>>): void;
|
|
4
|
+
export declare function createTween<T extends object>(manager: TweenManager, target: T, duration: number, propertyMap: Readonly<NumericProps<T>>, options?: Readonly<TweenOptions>): Tween<T>;
|
|
5
|
+
export declare function createTween<T extends object>(target: T, duration: number, propertyMap: Readonly<NumericProps<T>>, options?: Readonly<TweenOptions>): Tween<T>;
|
|
6
|
+
export declare function getActiveTweenCount(manager: TweenManager): number;
|
|
7
|
+
export declare function getTweensOf(manager: TweenManager, target: object): readonly Tween<any>[];
|
|
8
|
+
export declare function hasTweensOf(manager: TweenManager, target: object): boolean;
|
|
9
|
+
export declare function killTweensOfProperty(manager: TweenManager, key: string): void;
|
|
10
|
+
export declare function pauseAllTweens(manager: TweenManager): void;
|
|
11
|
+
export declare function pauseTween(tween: Tween<any>): void;
|
|
12
|
+
export declare function pauseTweens(manager: TweenManager, target: object): void;
|
|
13
|
+
export declare function resetAllTweens(manager: TweenManager): void;
|
|
14
|
+
export declare function resumeAllTweens(manager: TweenManager): void;
|
|
15
|
+
export declare function resumeTween(tween: Tween<any>): void;
|
|
16
|
+
export declare function resumeTweens(manager: TweenManager, target: object): void;
|
|
17
|
+
export declare function stopAllTweens(manager: TweenManager, options?: Readonly<StopTweenOptions>): void;
|
|
18
|
+
export declare function stopTween(tween: Tween<any>, options?: Readonly<StopTweenOptions>): void;
|
|
19
|
+
export declare function stopTweens(manager: TweenManager, target: object, propertyMap?: Readonly<NumericProps<any>>, options?: Readonly<StopTweenOptions>): void;
|
|
20
|
+
//# sourceMappingURL=tween.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tween.d.ts","sourceRoot":"","sources":["../src/tween.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAEV,YAAY,EACZ,gBAAgB,EAChB,KAAK,EACL,YAAY,EACZ,YAAY,EAEb,M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wBAAgB,UAAU,CAAC,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,GAAG,IAAI,CAElD;AAED,wBAAgB,WAAW,CAAC,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAIvE;AAyBD,wBAAgB,cAAc,CAAC,OAAO,EAAE,YAAY,GAAG,IAAI,CAE1D;AAED,wBAAgB,eAAe,CAAC,OAAO,EAAE,YAAY,GAAG,IAAI,CAI3D;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,GAAG,IAAI,CAEnD;AAED,wBAAgB,YAAY,CAAC,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAIxE;AAED,wBAAgB,aAAa,CAAC,OAAO,EAAE,YAAY,EAAE,OAAO,CAAC,EAAE,QAAQ,CAAC,gBAAgB,CAAC,GAAG,IAAI,CAI/F;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,EAAE,OAAO,CAAC,EAAE,QAAQ,CAAC,gBAAgB,CAAC,GAAG,IAAI,CAkBvF;AAED,wBAAgB,UAAU,CACxB,OAAO,EAAE,YAAY,EACrB,MAAM,EAAE,MAAM,EACd,WAAW,CAAC,EAAE,QAAQ,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,EACzC,OAAO,CAAC,EAAE,QAAQ,CAAC,gBAAgB,CAAC,GACnC,IAAI,CAoBN"}
|
package/dist/tween.js
ADDED
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
+
import { createSignal, emitSignal } from '@flighthq/signals';
|
|
3
|
+
import { initializeTween } from './internal';
|
|
4
|
+
import { defaultManager } from './tweenManager';
|
|
5
|
+
export function applyTween(manager, target, propertyMap) {
|
|
6
|
+
stopTweens(manager, target, propertyMap);
|
|
7
|
+
const t = target;
|
|
8
|
+
const p = propertyMap;
|
|
9
|
+
for (const key of Object.keys(p)) {
|
|
10
|
+
const val = p[key];
|
|
11
|
+
if (val !== undefined)
|
|
12
|
+
t[key] = val;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
export function createTween(managerOrTarget, targetOrDuration, durationOrProps, propsOrOptions, maybeOptions) {
|
|
16
|
+
let manager;
|
|
17
|
+
let target;
|
|
18
|
+
let duration;
|
|
19
|
+
let propertyMap;
|
|
20
|
+
let options;
|
|
21
|
+
if (isTweenManager(managerOrTarget)) {
|
|
22
|
+
manager = managerOrTarget;
|
|
23
|
+
target = targetOrDuration;
|
|
24
|
+
duration = durationOrProps;
|
|
25
|
+
propertyMap = propsOrOptions;
|
|
26
|
+
options = maybeOptions;
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
manager = defaultManager;
|
|
30
|
+
target = managerOrTarget;
|
|
31
|
+
duration = targetOrDuration;
|
|
32
|
+
propertyMap = durationOrProps;
|
|
33
|
+
options = propsOrOptions;
|
|
34
|
+
}
|
|
35
|
+
const tween = makeTween(target, duration, propertyMap, options, manager.defaultEase);
|
|
36
|
+
registerTween(manager, tween, options?.overwrite ?? true);
|
|
37
|
+
return tween;
|
|
38
|
+
}
|
|
39
|
+
export function getActiveTweenCount(manager) {
|
|
40
|
+
let count = 0;
|
|
41
|
+
for (const list of manager.tweens.values())
|
|
42
|
+
count += list.length;
|
|
43
|
+
return count;
|
|
44
|
+
}
|
|
45
|
+
export function getTweensOf(manager, target) {
|
|
46
|
+
return manager.tweens.get(target) ?? [];
|
|
47
|
+
}
|
|
48
|
+
export function hasTweensOf(manager, target) {
|
|
49
|
+
const list = manager.tweens.get(target);
|
|
50
|
+
return list !== undefined && list.length > 0;
|
|
51
|
+
}
|
|
52
|
+
function isTweenManager(value) {
|
|
53
|
+
return typeof value === 'object' && value !== null && value.__brand === 'TweenManager';
|
|
54
|
+
}
|
|
55
|
+
export function killTweensOfProperty(manager, key) {
|
|
56
|
+
for (const list of manager.tweens.values()) {
|
|
57
|
+
for (const tween of list) {
|
|
58
|
+
const p = tween.propertyMap;
|
|
59
|
+
if (key in p)
|
|
60
|
+
tween.complete = true;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
function makeTween(target, duration, propertyMap, options, defaultEase) {
|
|
65
|
+
const keys = Object.keys(propertyMap);
|
|
66
|
+
const properties = keys.map((key) => ({ change: 0, key, start: 0 }));
|
|
67
|
+
return {
|
|
68
|
+
complete: false,
|
|
69
|
+
delay: options?.delay ?? 0,
|
|
70
|
+
duration,
|
|
71
|
+
ease: options?.ease ?? defaultEase,
|
|
72
|
+
elapsed: 0,
|
|
73
|
+
initialized: false,
|
|
74
|
+
onComplete: createSignal(),
|
|
75
|
+
onRepeat: createSignal(),
|
|
76
|
+
onUpdate: createSignal(),
|
|
77
|
+
onYoyo: createSignal(),
|
|
78
|
+
paused: false,
|
|
79
|
+
properties,
|
|
80
|
+
propertyMap,
|
|
81
|
+
reflect: options?.reflect ?? false,
|
|
82
|
+
repeat: options?.repeat ?? 0,
|
|
83
|
+
reverse: options?.reverse ?? false,
|
|
84
|
+
smartRotation: options?.smartRotation ?? false,
|
|
85
|
+
snapping: options?.snapping ?? false,
|
|
86
|
+
target,
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
export function pauseAllTweens(manager) {
|
|
90
|
+
for (const list of manager.tweens.values()) {
|
|
91
|
+
for (const tween of list)
|
|
92
|
+
tween.paused = true;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
export function pauseTween(tween) {
|
|
96
|
+
tween.paused = true;
|
|
97
|
+
}
|
|
98
|
+
export function pauseTweens(manager, target) {
|
|
99
|
+
const list = manager.tweens.get(target);
|
|
100
|
+
if (list === undefined)
|
|
101
|
+
return;
|
|
102
|
+
for (const tween of list)
|
|
103
|
+
tween.paused = true;
|
|
104
|
+
}
|
|
105
|
+
function registerTween(manager, tween, overwrite) {
|
|
106
|
+
let list = manager.tweens.get(tween.target);
|
|
107
|
+
if (list === undefined) {
|
|
108
|
+
list = [];
|
|
109
|
+
manager.tweens.set(tween.target, list);
|
|
110
|
+
}
|
|
111
|
+
if (overwrite) {
|
|
112
|
+
for (let i = list.length - 1; i >= 0; i--) {
|
|
113
|
+
const existing = list[i];
|
|
114
|
+
const existingMap = existing.propertyMap;
|
|
115
|
+
let overlaps = false;
|
|
116
|
+
for (const detail of tween.properties) {
|
|
117
|
+
if (detail.key in existingMap) {
|
|
118
|
+
overlaps = true;
|
|
119
|
+
break;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
if (overlaps)
|
|
123
|
+
existing.complete = true;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
list.push(tween);
|
|
127
|
+
}
|
|
128
|
+
export function resetAllTweens(manager) {
|
|
129
|
+
manager.tweens.clear();
|
|
130
|
+
}
|
|
131
|
+
export function resumeAllTweens(manager) {
|
|
132
|
+
for (const list of manager.tweens.values()) {
|
|
133
|
+
for (const tween of list)
|
|
134
|
+
tween.paused = false;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
export function resumeTween(tween) {
|
|
138
|
+
tween.paused = false;
|
|
139
|
+
}
|
|
140
|
+
export function resumeTweens(manager, target) {
|
|
141
|
+
const list = manager.tweens.get(target);
|
|
142
|
+
if (list === undefined)
|
|
143
|
+
return;
|
|
144
|
+
for (const tween of list)
|
|
145
|
+
tween.paused = false;
|
|
146
|
+
}
|
|
147
|
+
export function stopAllTweens(manager, options) {
|
|
148
|
+
for (const list of manager.tweens.values()) {
|
|
149
|
+
for (const tween of list)
|
|
150
|
+
stopTween(tween, options);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
export function stopTween(tween, options) {
|
|
154
|
+
const doComplete = options?.complete ?? false;
|
|
155
|
+
const doSendEvent = options?.sendEvent ?? true;
|
|
156
|
+
if (doComplete) {
|
|
157
|
+
if (!tween.initialized)
|
|
158
|
+
initializeTween(tween);
|
|
159
|
+
const effectiveT = tween.reverse ? 0 : 1;
|
|
160
|
+
const easedT = tween.ease(effectiveT);
|
|
161
|
+
const t = tween.target;
|
|
162
|
+
for (const detail of tween.properties) {
|
|
163
|
+
let value = detail.start + detail.change * easedT;
|
|
164
|
+
if (tween.snapping)
|
|
165
|
+
value = Math.round(value);
|
|
166
|
+
t[detail.key] = value;
|
|
167
|
+
}
|
|
168
|
+
if (doSendEvent)
|
|
169
|
+
emitSignal(tween.onComplete);
|
|
170
|
+
}
|
|
171
|
+
tween.complete = true;
|
|
172
|
+
}
|
|
173
|
+
export function stopTweens(manager, target, propertyMap, options) {
|
|
174
|
+
const list = manager.tweens.get(target);
|
|
175
|
+
if (list === undefined)
|
|
176
|
+
return;
|
|
177
|
+
for (const tween of list) {
|
|
178
|
+
if (propertyMap !== undefined) {
|
|
179
|
+
const p = propertyMap;
|
|
180
|
+
const tweenMap = tween.propertyMap;
|
|
181
|
+
let overlaps = false;
|
|
182
|
+
for (const key of Object.keys(p)) {
|
|
183
|
+
if (key in tweenMap) {
|
|
184
|
+
overlaps = true;
|
|
185
|
+
break;
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
if (!overlaps)
|
|
189
|
+
continue;
|
|
190
|
+
}
|
|
191
|
+
stopTween(tween, options);
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
//# sourceMappingURL=tween.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tween.js","sourceRoot":"","sources":["../src/tween.ts"],"names":[],"mappings":"AAAA,uDAAuD;AAEvD,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAW7D,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAIhD,MAAM,UAAU,UAAU,CACxB,OAAqB,EACrB,MAAS,EACT,WAAsC;IAEtC,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,WAAW,CAAC,CAAC;IACzC,MAAM,CAAC,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MAAM,CAAC,MAAM,GAAG,MAAM,CAAC;YAClD,IAAI,KAAK,CAAC,QAAQ;gBAAE,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;YAC9C,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;QACxB,CAAC;QACD,IAAI,WAAW;YAAE,UAAU,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;IAChD,CAAC;IAED,KAAK,CAAC,QAAQ,GAAG,IAAI,CAAC;AACxB,CAAC;AAED,MAAM,UAAU,UAAU,CACxB,OAAqB,EACrB,MAAc,EACd,WAAyC,EACzC,OAAoC;IAEpC,MAAM,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IACxC,IAAI,IAAI,KAAK,SAAS;QAAE,OAAO;IAE/B,KAAK,MAAM,KAAK,IAAI,IAAI,EAAE,CAAC;QACzB,IAAI,WAAW,KAAK,SAAS,EAAE,CAAC;YAC9B,MAAM,CAAC,GAAG,WAAsC,CAAC;YACjD,MAAM,QAAQ,GAAG,KAAK,CAAC,WAAsC,CAAC;YAC9D,IAAI,QAAQ,GAAG,KAAK,CAAC;YACrB,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC;gBACjC,IAAI,GAAG,IAAI,QAAQ,EAAE,CAAC;oBACpB,QAAQ,GAAG,IAAI,CAAC;oBAChB,MAAM;gBACR,CAAC;YACH,CAAC;YACD,IAAI,CAAC,QAAQ;gBAAE,SAAS;QAC1B,CAAC;QAED,SAAS,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IAC5B,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { TweenManager, TweenManagerOptions } from '@flighthq/types';
|
|
2
|
+
export type { TweenManagerOptions } from '@flighthq/types';
|
|
3
|
+
export declare function createTweenManager(options?: Readonly<TweenManagerOptions>): TweenManager;
|
|
4
|
+
export declare const defaultManager: TweenManager;
|
|
5
|
+
//# sourceMappingURL=tweenManager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tweenManager.d.ts","sourceRoot":"","sources":["../src/tweenManager.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAEzE,YAAY,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAE3D,wBAAgB,kBAAkB,CAAC,OAAO,CAAC,EAAE,QAAQ,CAAC,mBAAmB,CAAC,GAAG,YAAY,CAMxF;AAED,eAAO,MAAM,cAAc,EAAE,YAAmC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { easeOutExponential } from '@flighthq/easing';
|
|
2
|
+
export function createTweenManager(options) {
|
|
3
|
+
return {
|
|
4
|
+
__brand: 'TweenManager',
|
|
5
|
+
defaultEase: options?.defaultEase ?? easeOutExponential,
|
|
6
|
+
tweens: new Map(),
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
export const defaultManager = createTweenManager();
|
|
10
|
+
//# sourceMappingURL=tweenManager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tweenManager.js","sourceRoot":"","sources":["../src/tweenManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAKtD,MAAM,UAAU,kBAAkB,CAAC,OAAuC;IACxE,OAAO;QACL,OAAO,EAAE,cAAc;QACvB,WAAW,EAAE,OAAO,EAAE,WAAW,IAAI,kBAAkB;QACvD,MAAM,EAAE,IAAI,GAAG,EAAE;KAClB,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,MAAM,cAAc,GAAiB,kBAAkB,EAAE,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { Tween } from '@flighthq/types';
|
|
2
|
+
/**
|
|
3
|
+
* Return the normalized playback progress of a tween in the range 0..1.
|
|
4
|
+
* Returns 0 if the tween is still in its delay phase; returns 1 when complete.
|
|
5
|
+
* Does not account for repeat; each cycle starts at 0 and ends at 1.
|
|
6
|
+
*/
|
|
7
|
+
export declare function getTweenProgress(tween: Tween<any>): number;
|
|
8
|
+
/**
|
|
9
|
+
* Drop all captured start values so the next update re-captures them from the current
|
|
10
|
+
* target state. Equivalent to GSAP `invalidate()`. Resets elapsed and complete state.
|
|
11
|
+
*/
|
|
12
|
+
export declare function invalidateTween(tween: Tween<any>): void;
|
|
13
|
+
/**
|
|
14
|
+
* Rewind and replay a tween from the beginning. Re-initializes start values from the
|
|
15
|
+
* current target state. Optionally keeps the initial delay.
|
|
16
|
+
*/
|
|
17
|
+
export declare function restartTween(tween: Tween<any>, includeDelay?: boolean): void;
|
|
18
|
+
/**
|
|
19
|
+
* Jump the tween to an absolute elapsed time and immediately apply the resulting
|
|
20
|
+
* property values to the target. The time is measured from the start of the tween
|
|
21
|
+
* (before any delay). Clamps to 0..delay+duration.
|
|
22
|
+
*
|
|
23
|
+
* This is alias-safe: all input values are read before any writes occur.
|
|
24
|
+
*/
|
|
25
|
+
export declare function seekTween(tween: Tween<any>, timeSeconds: number): void;
|
|
26
|
+
/**
|
|
27
|
+
* Set the normalized progress of a tween to a value in 0..1 and immediately apply
|
|
28
|
+
* the resulting property values to the target. Safe to call before the delay has elapsed.
|
|
29
|
+
*
|
|
30
|
+
* This is alias-safe: all input values are read before any writes occur.
|
|
31
|
+
*/
|
|
32
|
+
export declare function setTweenProgress(tween: Tween<any>, progress: number): void;
|
|
33
|
+
//# sourceMappingURL=tweenProgress.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tweenProgress.d.ts","sourceRoot":"","sources":["../src/tweenProgress.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAI7C;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,GAAG,MAAM,CAK1D;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,GAAG,IAAI,CAIvD;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,EAAE,YAAY,UAAO,GAAG,IAAI,CAIzE;AAID;;;;;;GAMG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,EAAE,WAAW,EAAE,MAAM,GAAG,IAAI,CA2BtE;AAGD;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,CAI1E"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
+
import { emitSignal } from '@flighthq/signals';
|
|
3
|
+
import { initializeTween } from './internal';
|
|
4
|
+
/**
|
|
5
|
+
* Return the normalized playback progress of a tween in the range 0..1.
|
|
6
|
+
* Returns 0 if the tween is still in its delay phase; returns 1 when complete.
|
|
7
|
+
* Does not account for repeat; each cycle starts at 0 and ends at 1.
|
|
8
|
+
*/
|
|
9
|
+
export function getTweenProgress(tween) {
|
|
10
|
+
if (tween.complete)
|
|
11
|
+
return 1;
|
|
12
|
+
const activeElapsed = tween.elapsed - tween.delay;
|
|
13
|
+
if (activeElapsed <= 0)
|
|
14
|
+
return 0;
|
|
15
|
+
return Math.min(activeElapsed / tween.duration, 1);
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Drop all captured start values so the next update re-captures them from the current
|
|
19
|
+
* target state. Equivalent to GSAP `invalidate()`. Resets elapsed and complete state.
|
|
20
|
+
*/
|
|
21
|
+
export function invalidateTween(tween) {
|
|
22
|
+
tween.initialized = false;
|
|
23
|
+
tween.complete = false;
|
|
24
|
+
tween.elapsed = 0;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Rewind and replay a tween from the beginning. Re-initializes start values from the
|
|
28
|
+
* current target state. Optionally keeps the initial delay.
|
|
29
|
+
*/
|
|
30
|
+
export function restartTween(tween, includeDelay = true) {
|
|
31
|
+
tween.initialized = false;
|
|
32
|
+
tween.complete = false;
|
|
33
|
+
tween.elapsed = includeDelay ? 0 : tween.delay;
|
|
34
|
+
}
|
|
35
|
+
// Seeking to the exact end (delay + duration) marks the tween complete and
|
|
36
|
+
// fires onComplete. Seeking to any earlier time does not.
|
|
37
|
+
/**
|
|
38
|
+
* Jump the tween to an absolute elapsed time and immediately apply the resulting
|
|
39
|
+
* property values to the target. The time is measured from the start of the tween
|
|
40
|
+
* (before any delay). Clamps to 0..delay+duration.
|
|
41
|
+
*
|
|
42
|
+
* This is alias-safe: all input values are read before any writes occur.
|
|
43
|
+
*/
|
|
44
|
+
export function seekTween(tween, timeSeconds) {
|
|
45
|
+
if (!tween.initialized)
|
|
46
|
+
initializeTween(tween);
|
|
47
|
+
// Clamp to valid range
|
|
48
|
+
const maxElapsed = tween.delay + tween.duration;
|
|
49
|
+
const clampedElapsed = Math.max(0, Math.min(timeSeconds, maxElapsed));
|
|
50
|
+
tween.elapsed = clampedElapsed;
|
|
51
|
+
const activeElapsed = clampedElapsed - tween.delay;
|
|
52
|
+
if (activeElapsed <= 0)
|
|
53
|
+
return;
|
|
54
|
+
const t = Math.min(activeElapsed / tween.duration, 1);
|
|
55
|
+
const effectiveT = tween.reverse ? 1 - t : t;
|
|
56
|
+
const easedT = tween.ease(effectiveT);
|
|
57
|
+
// Read all start/change values before writing
|
|
58
|
+
const writes = [];
|
|
59
|
+
for (const detail of tween.properties) {
|
|
60
|
+
let value = detail.start + detail.change * easedT;
|
|
61
|
+
if (tween.snapping)
|
|
62
|
+
value = Math.round(value);
|
|
63
|
+
writes.push({ key: detail.key, value });
|
|
64
|
+
}
|
|
65
|
+
const target = tween.target;
|
|
66
|
+
for (const { key, value } of writes) {
|
|
67
|
+
target[key] = value;
|
|
68
|
+
}
|
|
69
|
+
emitSignal(tween.onUpdate);
|
|
70
|
+
if (t >= 1 && !tween.complete) {
|
|
71
|
+
tween.complete = true;
|
|
72
|
+
emitSignal(tween.onComplete);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
// Setting progress to exactly 1 marks the tween complete and fires onComplete.
|
|
76
|
+
/**
|
|
77
|
+
* Set the normalized progress of a tween to a value in 0..1 and immediately apply
|
|
78
|
+
* the resulting property values to the target. Safe to call before the delay has elapsed.
|
|
79
|
+
*
|
|
80
|
+
* This is alias-safe: all input values are read before any writes occur.
|
|
81
|
+
*/
|
|
82
|
+
export function setTweenProgress(tween, progress) {
|
|
83
|
+
const clamped = Math.max(0, Math.min(progress, 1));
|
|
84
|
+
const targetElapsed = tween.delay + clamped * tween.duration;
|
|
85
|
+
seekTween(tween, targetElapsed);
|
|
86
|
+
}
|
|
87
|
+
//# sourceMappingURL=tweenProgress.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tweenProgress.js","sourceRoot":"","sources":["../src/tweenProgress.ts"],"names":[],"mappings":"AAAA,uDAAuD;AAEvD,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAG/C,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAE7C;;;;GAIG;AACH,MAAM,UAAU,gBAAgB,CAAC,KAAiB;IAChD,IAAI,KAAK,CAAC,QAAQ;QAAE,OAAO,CAAC,CAAC;IAC7B,MAAM,aAAa,GAAG,KAAK,CAAC,OAAO,GAAG,KAAK,CAAC,KAAK,CAAC;IAClD,IAAI,aAAa,IAAI,CAAC;QAAE,OAAO,CAAC,CAAC;IACjC,OAAO,IAAI,CAAC,GAAG,CAAC,aAAa,GAAG,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC;AACrD,CAAC;AAED;;;GAGG;AACH,MAAM,UA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Function, NumericProps, Tween, TweenManager, TweenOptions } from '@flighthq/types';
|
|
2
|
+
export interface TweenStaggerOptions {
|
|
3
|
+
/**
|
|
4
|
+
* Delay in seconds between each target's tween start.
|
|
5
|
+
* Default: 0.1.
|
|
6
|
+
*/
|
|
7
|
+
each?: number;
|
|
8
|
+
/**
|
|
9
|
+
* How to order the stagger delay distribution across targets.
|
|
10
|
+
* - 'start': first target starts first (default).
|
|
11
|
+
* - 'center': middle target starts first, delays spread outward.
|
|
12
|
+
* - 'end': last target starts first.
|
|
13
|
+
* - number: index of the target that starts first; delays spread outward from there.
|
|
14
|
+
*/
|
|
15
|
+
from?: 'center' | 'end' | 'start' | number;
|
|
16
|
+
/** Optional easing applied to the stagger delay distribution (not to individual tweens). */
|
|
17
|
+
staggerEase?: EasingFunction;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Batch-tween an array of targets with staggered start delays.
|
|
21
|
+
* Returns the array of created tweens in the same order as `targets`.
|
|
22
|
+
*
|
|
23
|
+
* Each tween inherits `options` but gets an additional `delay` equal to its position in the
|
|
24
|
+
* stagger sequence (plus any `options.delay` already set).
|
|
25
|
+
*/
|
|
26
|
+
export declare function createTweenStagger<T extends object>(manager: TweenManager, targets: readonly T[], duration: number, propertyMap: Readonly<NumericProps<T>>, stagger?: Readonly<TweenStaggerOptions>, options?: Readonly<TweenOptions>): Tween<T>[];
|
|
27
|
+
//# sourceMappingURL=tweenStagger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tweenStagger.d.ts","sourceRoot":"","sources":["../src/tweenStagger.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAIvG,MAAM,WAAW,mBAAmB;IAClC;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;;;;OAMG;IACH,IAAI,CAAC,EAAE,QAAQ,GAAG,KAAK,GAAG,OAAO,GAAG,MAAM,CAAC;IAC3C,4FAA4F;IAC5F,WAAW,CAAC,EAAE,cAAc,CAAC;CAC9B;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,SAAS,MAAM,EACjD,OAAO,EAAE,YAAY,EACrB,OAAO,EAAE,SAAS,CAAC,EAAE,EACrB,QAAQ,EAAE,MAAM,EAChB,WAAW,EAAE,QAAQ,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,EACtC,OAAO,CAAC,EAAE,QAAQ,CAAC,mBAAmB,CAAC,EACvC,OAAO,CAAC,EAAE,QAAQ,CAAC,YAAY,CAAC,GAC/B,KAAK,CAAC,CAAC,CAAC,EAAE,CAiBZ"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { createTween } from './tween';
|
|
2
|
+
/**
|
|
3
|
+
* Batch-tween an array of targets with staggered start delays.
|
|
4
|
+
* Returns the array of created tweens in the same order as `targets`.
|
|
5
|
+
*
|
|
6
|
+
* Each tween inherits `options` but gets an additional `delay` equal to its position in the
|
|
7
|
+
* stagger sequence (plus any `options.delay` already set).
|
|
8
|
+
*/
|
|
9
|
+
export function createTweenStagger(manager, targets, duration, propertyMap, stagger, options) {
|
|
10
|
+
if (targets.length === 0)
|
|
11
|
+
return [];
|
|
12
|
+
const each = stagger?.each ?? 0.1;
|
|
13
|
+
const from = stagger?.from ?? 'start';
|
|
14
|
+
const staggerEase = stagger?.staggerEase;
|
|
15
|
+
const baseDelay = options?.delay ?? 0;
|
|
16
|
+
const count = targets.length;
|
|
17
|
+
const tweens = [];
|
|
18
|
+
for (let i = 0; i < count; i++) {
|
|
19
|
+
const staggerOffset = computeStaggerDelay(i, count, each, from, staggerEase);
|
|
20
|
+
const tween = createTween(manager, targets[i], duration, propertyMap, {
|
|
21
|
+
...options,
|
|
22
|
+
delay: baseDelay + staggerOffset,
|
|
23
|
+
});
|
|
24
|
+
tweens.push(tween);
|
|
25
|
+
}
|
|
26
|
+
return tweens;
|
|
27
|
+
}
|
|
28
|
+
function computeStaggerDelay(index, count, each, from, staggerEase) {
|
|
29
|
+
if (count <= 1)
|
|
30
|
+
return 0;
|
|
31
|
+
let normalizedPosition;
|
|
32
|
+
if (from === 'start') {
|
|
33
|
+
normalizedPosition = index / (count - 1);
|
|
34
|
+
}
|
|
35
|
+
else if (from === 'end') {
|
|
36
|
+
normalizedPosition = (count - 1 - index) / (count - 1);
|
|
37
|
+
}
|
|
38
|
+
else if (from === 'center') {
|
|
39
|
+
const center = (count - 1) / 2;
|
|
40
|
+
normalizedPosition = Math.abs(index - center) / center;
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
// from is a numeric index: distance from the specified origin
|
|
44
|
+
const origin = Math.max(0, Math.min(from, count - 1));
|
|
45
|
+
const maxDistance = Math.max(origin, count - 1 - origin);
|
|
46
|
+
normalizedPosition = maxDistance > 0 ? Math.abs(index - origin) / maxDistance : 0;
|
|
47
|
+
}
|
|
48
|
+
const eased = staggerEase !== undefined ? staggerEase(normalizedPosition) : normalizedPosition;
|
|
49
|
+
return eased * each * (count - 1);
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=tweenStagger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tweenStagger.js","sourceRoot":"","sources":["../src/tweenStagger.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAoBtC;;;;;;GAMG;AACH,MAAM,UAAU,kBAAkB,CAChC,OAAqB,EACrB,OAAqB,EACrB,QAAgB,EAChB,WAAsC,EACtC,OAAuC,EACvC,OAAgC;IAEhC,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IACpC,MAAM,IAAI,GAAG,OAAO,EAAE,IAAI,IAAI,GAAG,CAAC;IAClC,MAAM,IAAI,GAAG,OAAO,EAAE,IAAI,IAAI,OAAO,CAAC;IACtC,MAAM,W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,IAAI,CAAC,GAAG,CAAC,KAAK,GAAG,MAAM,CAAC,GAAG,MAAM,CAAC;IACzD,CAAC;SAAM,CAAC;QACN,8DAA8D;QAC9D,MAAM,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC;QACtD,MAAM,WAAW,GAAG,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,KAAK,GAAG,CAAC,GAAG,MAAM,CAAC,CAAC;QACzD,kBAAkB,GAAG,WAAW,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,GAAG,MAAM,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC;IACpF,CAAC;IACD,MAAM,KAAK,GAAG,WAAW,KAAK,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC,kBAAkB,CAAC;IAC/F,OAAO,KAAK,GAAG,IAAI,GAAG,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC;AACpC,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { Tween, TweenManager } from '@flighthq/types';
|
|
2
|
+
export declare function completeTween<T extends object>(tween: Tween<T>): void;
|
|
3
|
+
export declare function updateTweens(manager: TweenManager, deltaTime: number): void;
|
|
4
|
+
//# sourceMappingURL=updateTweens.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"updateTweens.d.ts","sourceRoot":"","sources":["../src/updateTweens.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAI3D,wBAAgB,aAAa,CAAC,CAAC,SAAS,MAAM,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,GAAG,IAAI,CAarE;AA8CD,wBAAgB,YAAY,CAAC,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,GAAG,IAAI,CAa3E"}
|