laymur-animations 0.25.0 → 0.27.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/README.md +23 -0
- package/dist/UIAnimatedElement.d.ts +10 -3
- package/dist/UIAnimatedElement.js +1 -0
- package/dist/UIAppearAnimator.d.ts +7 -3
- package/dist/UIAppearAnimator.js +71 -0
- package/dist/UIClickAnimator.d.ts +52 -4
- package/dist/UIClickAnimator.js +210 -0
- package/dist/UIDisappearAnimator.d.ts +11 -3
- package/dist/UIDisappearAnimator.js +53 -0
- package/dist/UIFlashAnimator.d.ts +39 -0
- package/dist/UIFlashAnimator.js +43 -0
- package/dist/UIFloatCallAnimator.d.ts +45 -0
- package/dist/UIFloatCallAnimator.js +67 -0
- package/dist/UIFlyToAnimator.d.ts +57 -0
- package/dist/UIFlyToAnimator.js +60 -0
- package/dist/UIJumpCallAnimator.d.ts +10 -6
- package/dist/UIJumpCallAnimator.js +97 -0
- package/dist/UIPulseCallAnimator.d.ts +11 -6
- package/dist/UIPulseCallAnimator.js +67 -0
- package/dist/UIShakeAnimator.d.ts +31 -0
- package/dist/UIShakeAnimator.js +49 -0
- package/dist/UIShineCallAnimator.d.ts +49 -0
- package/dist/UIShineCallAnimator.js +74 -0
- package/dist/UISpinCallAnimator.d.ts +8 -5
- package/dist/UISpinCallAnimator.js +74 -0
- package/dist/UISwipeCallAnimator.d.ts +9 -6
- package/dist/UISwipeCallAnimator.js +64 -0
- package/dist/UITapCallAnimator.d.ts +64 -0
- package/dist/UITapCallAnimator.js +83 -0
- package/dist/index.d.ts +27 -7
- package/dist/index.js +13 -509
- package/dist/miscellaneous.d.ts +71 -0
- package/dist/miscellaneous.js +163 -0
- package/package.json +32 -42
- package/dist/index.js.map +0 -1
- package/dist/index.min.js +0 -2
- package/dist/index.min.js.map +0 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { UIMicroAnimatedElement } from "./UIAnimatedElement.js";
|
|
2
2
|
/**
|
|
3
3
|
* Configuration options for spin call animations.
|
|
4
4
|
*/
|
|
5
5
|
export interface UISpinCallAnimatorCallOptions {
|
|
6
|
-
/** Rotation angle in radians */
|
|
6
|
+
/** Rotation angle in radians, relative to the rest rotation */
|
|
7
7
|
rotation: number;
|
|
8
8
|
/** Anchor point X coordinate (0-1) */
|
|
9
9
|
anchorX: number;
|
|
@@ -21,6 +21,8 @@ export interface UISpinCallAnimatorCallOptions {
|
|
|
21
21
|
duration: number;
|
|
22
22
|
/** GSAP easing function */
|
|
23
23
|
ease: gsap.EaseString;
|
|
24
|
+
/** Called once the call ends: completed, stopped or replaced by another spin */
|
|
25
|
+
onComplete: () => void;
|
|
24
26
|
}
|
|
25
27
|
/**
|
|
26
28
|
* Configuration options for stopping spin animations.
|
|
@@ -36,15 +38,16 @@ export interface UISpinCallAnimatorStopOptions {
|
|
|
36
38
|
*/
|
|
37
39
|
export declare class UISpinCallAnimator {
|
|
38
40
|
/**
|
|
39
|
-
* Starts a spinning animation with rotation oscillations.
|
|
41
|
+
* Starts a spinning animation with rotation oscillations. Replaces a spin running on the same
|
|
42
|
+
* element; the anchor is restored once the element is back at rest.
|
|
40
43
|
* @param target - Single element or array of elements to animate
|
|
41
44
|
* @param options - Animation configuration options
|
|
42
45
|
*/
|
|
43
|
-
static spin(target:
|
|
46
|
+
static spin(target: UIMicroAnimatedElement | UIMicroAnimatedElement[], options?: Partial<UISpinCallAnimatorCallOptions>): void;
|
|
44
47
|
/**
|
|
45
48
|
* Stops the spinning animation and returns elements to rest rotation.
|
|
46
49
|
* @param target - Single element or array of elements to stop animating
|
|
47
50
|
* @param options - Stop animation configuration options
|
|
48
51
|
*/
|
|
49
|
-
static stopSpin(target:
|
|
52
|
+
static stopSpin(target: UIMicroAnimatedElement | UIMicroAnimatedElement[], options?: Partial<UISpinCallAnimatorStopOptions>): void;
|
|
50
53
|
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import gsap from "gsap";
|
|
2
|
+
import { iterationsToRepeat, resolveTargets, UICallTracker } from "./miscellaneous.js";
|
|
3
|
+
const spinCalls = new UICallTracker(["rotation", "anchorX", "anchorY"]);
|
|
4
|
+
const DEFAULT_ROTATION = 0.0435;
|
|
5
|
+
const DEFAULT_ANCHOR_X = 0.5;
|
|
6
|
+
const DEFAULT_ANCHOR_Y = 0.5;
|
|
7
|
+
const DEFAULT_SPIN_COUNT = 3;
|
|
8
|
+
const DEFAULT_ITERATIONS = -1;
|
|
9
|
+
const DEFAULT_COOLDOWN = 3;
|
|
10
|
+
const DEFAULT_START_WITH_COOLDOWN = true;
|
|
11
|
+
const DEFAULT_DURATION = 1;
|
|
12
|
+
const DEFAULT_EASE = "power1.inOut";
|
|
13
|
+
const DEFAULT_STOP_DURATION = 0.25;
|
|
14
|
+
const DEFAULT_STOP_EASE = "power1.inOut";
|
|
15
|
+
/**
|
|
16
|
+
* Animator for spin call attention effects.
|
|
17
|
+
*/
|
|
18
|
+
export class UISpinCallAnimator {
|
|
19
|
+
/**
|
|
20
|
+
* Starts a spinning animation with rotation oscillations. Replaces a spin running on the same
|
|
21
|
+
* element; the anchor is restored once the element is back at rest.
|
|
22
|
+
* @param target - Single element or array of elements to animate
|
|
23
|
+
* @param options - Animation configuration options
|
|
24
|
+
*/
|
|
25
|
+
static spin(target, options = {}) {
|
|
26
|
+
const { rotation = DEFAULT_ROTATION, anchorX = DEFAULT_ANCHOR_X, anchorY = DEFAULT_ANCHOR_Y, spinCount = DEFAULT_SPIN_COUNT, iterations = DEFAULT_ITERATIONS, cooldown = DEFAULT_COOLDOWN, startWithCooldown = DEFAULT_START_WITH_COOLDOWN, duration = DEFAULT_DURATION, ease = DEFAULT_EASE, onComplete, } = options;
|
|
27
|
+
for (const element of resolveTargets(target)) {
|
|
28
|
+
const micro = element.micro;
|
|
29
|
+
spinCalls.start(micro, (rest) => {
|
|
30
|
+
micro.anchorX = anchorX;
|
|
31
|
+
micro.anchorY = anchorY;
|
|
32
|
+
const timeline = gsap.timeline({ repeat: iterationsToRepeat(iterations) });
|
|
33
|
+
if (startWithCooldown && cooldown > 0) {
|
|
34
|
+
timeline.to({}, { duration: cooldown });
|
|
35
|
+
}
|
|
36
|
+
const spinDuration = duration / (spinCount + 2);
|
|
37
|
+
timeline.to(micro, {
|
|
38
|
+
rotation: rest.rotation + rotation,
|
|
39
|
+
duration: spinDuration,
|
|
40
|
+
ease,
|
|
41
|
+
});
|
|
42
|
+
let currentRotation = rotation;
|
|
43
|
+
for (let i = 0; i < spinCount; i++) {
|
|
44
|
+
currentRotation *= -1;
|
|
45
|
+
timeline.to(micro, {
|
|
46
|
+
rotation: rest.rotation + currentRotation,
|
|
47
|
+
duration: spinDuration,
|
|
48
|
+
ease,
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
timeline.to(micro, {
|
|
52
|
+
rotation: rest.rotation,
|
|
53
|
+
duration: spinDuration,
|
|
54
|
+
ease,
|
|
55
|
+
});
|
|
56
|
+
if (!startWithCooldown && cooldown > 0) {
|
|
57
|
+
timeline.to({}, { duration: cooldown });
|
|
58
|
+
}
|
|
59
|
+
return timeline;
|
|
60
|
+
}, onComplete);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Stops the spinning animation and returns elements to rest rotation.
|
|
65
|
+
* @param target - Single element or array of elements to stop animating
|
|
66
|
+
* @param options - Stop animation configuration options
|
|
67
|
+
*/
|
|
68
|
+
static stopSpin(target, options = {}) {
|
|
69
|
+
const { duration = DEFAULT_STOP_DURATION, ease = DEFAULT_STOP_EASE } = options;
|
|
70
|
+
for (const element of resolveTargets(target)) {
|
|
71
|
+
spinCalls.stop(element.micro, duration, ease);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { UIMicroAnimatedElement } from "./UIAnimatedElement.js";
|
|
2
2
|
/**
|
|
3
3
|
* Configuration options for swipe call animations.
|
|
4
4
|
*/
|
|
5
5
|
export interface UISwipeCallAnimatorCallOptions {
|
|
6
|
-
/** Horizontal displacement of the swipe vector in
|
|
6
|
+
/** Horizontal displacement of the swipe vector in world units */
|
|
7
7
|
dx: number;
|
|
8
|
-
/** Vertical displacement of the swipe vector in
|
|
8
|
+
/** Vertical displacement of the swipe vector in world units */
|
|
9
9
|
dy: number;
|
|
10
10
|
/** Number of animation iterations (-1 for infinite) */
|
|
11
11
|
iterations: number;
|
|
@@ -19,6 +19,8 @@ export interface UISwipeCallAnimatorCallOptions {
|
|
|
19
19
|
easeIn: gsap.EaseString;
|
|
20
20
|
/** GSAP easing function for the return swipe */
|
|
21
21
|
easeOut: gsap.EaseString;
|
|
22
|
+
/** Called once the call ends: completed, stopped or replaced by another swipe */
|
|
23
|
+
onComplete: () => void;
|
|
22
24
|
}
|
|
23
25
|
/**
|
|
24
26
|
* Configuration options for stopping swipe animations.
|
|
@@ -34,15 +36,16 @@ export interface UISwipeCallAnimatorStopOptions {
|
|
|
34
36
|
*/
|
|
35
37
|
export declare class UISwipeCallAnimator {
|
|
36
38
|
/**
|
|
37
|
-
* Starts
|
|
39
|
+
* Starts a pingpong swipe animation along the vector (dx, dy) from the rest position.
|
|
40
|
+
* Replaces a swipe running on the same element.
|
|
38
41
|
* @param target - Single element or array of elements to animate
|
|
39
42
|
* @param options - Animation configuration options
|
|
40
43
|
*/
|
|
41
|
-
static swipe(target:
|
|
44
|
+
static swipe(target: UIMicroAnimatedElement | UIMicroAnimatedElement[], options?: Partial<UISwipeCallAnimatorCallOptions>): void;
|
|
42
45
|
/**
|
|
43
46
|
* Stops the swipe animation and returns elements to rest position.
|
|
44
47
|
* @param target - Single element or array of elements to stop animating
|
|
45
48
|
* @param options - Stop animation configuration options
|
|
46
49
|
*/
|
|
47
|
-
static stopSwipe(target:
|
|
50
|
+
static stopSwipe(target: UIMicroAnimatedElement | UIMicroAnimatedElement[], options?: Partial<UISwipeCallAnimatorStopOptions>): void;
|
|
48
51
|
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import gsap from "gsap";
|
|
2
|
+
import { iterationsToRepeat, resolveTargets, UICallTracker } from "./miscellaneous.js";
|
|
3
|
+
const swipeCalls = new UICallTracker(["x", "y"]);
|
|
4
|
+
const DEFAULT_DX = 25;
|
|
5
|
+
const DEFAULT_DY = 0;
|
|
6
|
+
const DEFAULT_ITERATIONS = -1;
|
|
7
|
+
const DEFAULT_COOLDOWN = 0;
|
|
8
|
+
const DEFAULT_START_WITH_COOLDOWN = false;
|
|
9
|
+
const DEFAULT_DURATION = 0.4;
|
|
10
|
+
const DEFAULT_EASE_IN = "power1.inOut";
|
|
11
|
+
const DEFAULT_EASE_OUT = "power1.inOut";
|
|
12
|
+
const DEFAULT_STOP_DURATION = 0.25;
|
|
13
|
+
const DEFAULT_STOP_EASE = "power1.inOut";
|
|
14
|
+
/**
|
|
15
|
+
* Animator for swipe call attention effects with pingpong movement along an arbitrary vector.
|
|
16
|
+
*/
|
|
17
|
+
export class UISwipeCallAnimator {
|
|
18
|
+
/**
|
|
19
|
+
* Starts a pingpong swipe animation along the vector (dx, dy) from the rest position.
|
|
20
|
+
* Replaces a swipe running on the same element.
|
|
21
|
+
* @param target - Single element or array of elements to animate
|
|
22
|
+
* @param options - Animation configuration options
|
|
23
|
+
*/
|
|
24
|
+
static swipe(target, options = {}) {
|
|
25
|
+
const { dx = DEFAULT_DX, dy = DEFAULT_DY, iterations = DEFAULT_ITERATIONS, cooldown = DEFAULT_COOLDOWN, startWithCooldown = DEFAULT_START_WITH_COOLDOWN, duration = DEFAULT_DURATION, easeIn = DEFAULT_EASE_IN, easeOut = DEFAULT_EASE_OUT, onComplete, } = options;
|
|
26
|
+
for (const element of resolveTargets(target)) {
|
|
27
|
+
const micro = element.micro;
|
|
28
|
+
swipeCalls.start(micro, (rest) => {
|
|
29
|
+
const timeline = gsap.timeline({ repeat: iterationsToRepeat(iterations) });
|
|
30
|
+
if (startWithCooldown && cooldown > 0) {
|
|
31
|
+
timeline.to({}, { duration: cooldown });
|
|
32
|
+
}
|
|
33
|
+
timeline
|
|
34
|
+
.to(micro, {
|
|
35
|
+
x: rest.x + dx,
|
|
36
|
+
y: rest.y + dy,
|
|
37
|
+
duration,
|
|
38
|
+
ease: easeIn,
|
|
39
|
+
})
|
|
40
|
+
.to(micro, {
|
|
41
|
+
x: rest.x,
|
|
42
|
+
y: rest.y,
|
|
43
|
+
duration,
|
|
44
|
+
ease: easeOut,
|
|
45
|
+
});
|
|
46
|
+
if (!startWithCooldown && cooldown > 0) {
|
|
47
|
+
timeline.to({}, { duration: cooldown });
|
|
48
|
+
}
|
|
49
|
+
return timeline;
|
|
50
|
+
}, onComplete);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Stops the swipe animation and returns elements to rest position.
|
|
55
|
+
* @param target - Single element or array of elements to stop animating
|
|
56
|
+
* @param options - Stop animation configuration options
|
|
57
|
+
*/
|
|
58
|
+
static stopSwipe(target, options = {}) {
|
|
59
|
+
const { duration = DEFAULT_STOP_DURATION, ease = DEFAULT_STOP_EASE } = options;
|
|
60
|
+
for (const element of resolveTargets(target)) {
|
|
61
|
+
swipeCalls.stop(element.micro, duration, ease);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import type { UIMicroAnimatedElement } from "./UIAnimatedElement.js";
|
|
2
|
+
/**
|
|
3
|
+
* Configuration options for tap call animations.
|
|
4
|
+
*/
|
|
5
|
+
export interface UITapCallAnimatorCallOptions {
|
|
6
|
+
/** Scale factor while pressed, relative to the rest scale */
|
|
7
|
+
pressScale: number;
|
|
8
|
+
/** Horizontal shift while pressed in world units */
|
|
9
|
+
pressX: number;
|
|
10
|
+
/** Vertical shift while pressed in world units */
|
|
11
|
+
pressY: number;
|
|
12
|
+
/** Anchor point X coordinate (0-1) the press scales around, such as the fingertip */
|
|
13
|
+
anchorX: number;
|
|
14
|
+
/** Anchor point Y coordinate (0-1) the press scales around */
|
|
15
|
+
anchorY: number;
|
|
16
|
+
/** Number of taps in a row per iteration; 2 for a double tap */
|
|
17
|
+
taps: number;
|
|
18
|
+
/** Pause between taps in a row in seconds */
|
|
19
|
+
tapInterval: number;
|
|
20
|
+
/** Number of animation iterations (-1 for infinite) */
|
|
21
|
+
iterations: number;
|
|
22
|
+
/** Cooldown time between iterations in seconds */
|
|
23
|
+
cooldown: number;
|
|
24
|
+
/** Whether to start with cooldown delay */
|
|
25
|
+
startWithCooldown: boolean;
|
|
26
|
+
/** Duration of the press in seconds */
|
|
27
|
+
durationIn: number;
|
|
28
|
+
/** Duration of the release in seconds */
|
|
29
|
+
durationOut: number;
|
|
30
|
+
/** GSAP easing function for the press */
|
|
31
|
+
easeIn: gsap.EaseString;
|
|
32
|
+
/** GSAP easing function for the release */
|
|
33
|
+
easeOut: gsap.EaseString;
|
|
34
|
+
/** Called once the call ends: completed, stopped or replaced by another tap */
|
|
35
|
+
onComplete: () => void;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Configuration options for stopping tap animations.
|
|
39
|
+
*/
|
|
40
|
+
export interface UITapCallAnimatorStopOptions {
|
|
41
|
+
/** Duration to return to rest in seconds */
|
|
42
|
+
duration: number;
|
|
43
|
+
/** GSAP easing function for stop transition */
|
|
44
|
+
ease: gsap.EaseString;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Animator for tap hints, such as a tutorial hand tapping a button.
|
|
48
|
+
*/
|
|
49
|
+
export declare class UITapCallAnimator {
|
|
50
|
+
/**
|
|
51
|
+
* Starts a tapping animation: the element presses in, shrinking and shifting, and releases.
|
|
52
|
+
* Replaces a tap running on the same element; the anchor is restored once the element is
|
|
53
|
+
* back at rest.
|
|
54
|
+
* @param target - Single element or array of elements to animate
|
|
55
|
+
* @param options - Animation configuration options
|
|
56
|
+
*/
|
|
57
|
+
static tap(target: UIMicroAnimatedElement | UIMicroAnimatedElement[], options?: Partial<UITapCallAnimatorCallOptions>): void;
|
|
58
|
+
/**
|
|
59
|
+
* Stops the tapping animation and returns elements to rest.
|
|
60
|
+
* @param target - Single element or array of elements to stop animating
|
|
61
|
+
* @param options - Stop animation configuration options
|
|
62
|
+
*/
|
|
63
|
+
static stopTap(target: UIMicroAnimatedElement | UIMicroAnimatedElement[], options?: Partial<UITapCallAnimatorStopOptions>): void;
|
|
64
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import gsap from "gsap";
|
|
2
|
+
import { iterationsToRepeat, resolveTargets, UICallTracker } from "./miscellaneous.js";
|
|
3
|
+
const tapCalls = new UICallTracker(["x", "y", "scaleX", "scaleY", "anchorX", "anchorY"]);
|
|
4
|
+
const DEFAULT_PRESS_SCALE = 0.85;
|
|
5
|
+
const DEFAULT_PRESS_X = 0;
|
|
6
|
+
const DEFAULT_PRESS_Y = -10;
|
|
7
|
+
const DEFAULT_ANCHOR_X = 0.5;
|
|
8
|
+
const DEFAULT_ANCHOR_Y = 0.5;
|
|
9
|
+
const DEFAULT_TAPS = 1;
|
|
10
|
+
const DEFAULT_TAP_INTERVAL = 0.15;
|
|
11
|
+
const DEFAULT_ITERATIONS = -1;
|
|
12
|
+
const DEFAULT_COOLDOWN = 1;
|
|
13
|
+
const DEFAULT_START_WITH_COOLDOWN = false;
|
|
14
|
+
const DEFAULT_DURATION_IN = 0.15;
|
|
15
|
+
const DEFAULT_DURATION_OUT = 0.25;
|
|
16
|
+
const DEFAULT_EASE_IN = "power1.out";
|
|
17
|
+
const DEFAULT_EASE_OUT = "power1.inOut";
|
|
18
|
+
const DEFAULT_STOP_DURATION = 0.25;
|
|
19
|
+
const DEFAULT_STOP_EASE = "power1.inOut";
|
|
20
|
+
/**
|
|
21
|
+
* Animator for tap hints, such as a tutorial hand tapping a button.
|
|
22
|
+
*/
|
|
23
|
+
export class UITapCallAnimator {
|
|
24
|
+
/**
|
|
25
|
+
* Starts a tapping animation: the element presses in, shrinking and shifting, and releases.
|
|
26
|
+
* Replaces a tap running on the same element; the anchor is restored once the element is
|
|
27
|
+
* back at rest.
|
|
28
|
+
* @param target - Single element or array of elements to animate
|
|
29
|
+
* @param options - Animation configuration options
|
|
30
|
+
*/
|
|
31
|
+
static tap(target, options = {}) {
|
|
32
|
+
const { pressScale = DEFAULT_PRESS_SCALE, pressX = DEFAULT_PRESS_X, pressY = DEFAULT_PRESS_Y, anchorX = DEFAULT_ANCHOR_X, anchorY = DEFAULT_ANCHOR_Y, taps = DEFAULT_TAPS, tapInterval = DEFAULT_TAP_INTERVAL, iterations = DEFAULT_ITERATIONS, cooldown = DEFAULT_COOLDOWN, startWithCooldown = DEFAULT_START_WITH_COOLDOWN, durationIn = DEFAULT_DURATION_IN, durationOut = DEFAULT_DURATION_OUT, easeIn = DEFAULT_EASE_IN, easeOut = DEFAULT_EASE_OUT, onComplete, } = options;
|
|
33
|
+
for (const element of resolveTargets(target)) {
|
|
34
|
+
const micro = element.micro;
|
|
35
|
+
tapCalls.start(micro, (rest) => {
|
|
36
|
+
micro.anchorX = anchorX;
|
|
37
|
+
micro.anchorY = anchorY;
|
|
38
|
+
const timeline = gsap.timeline({ repeat: iterationsToRepeat(iterations) });
|
|
39
|
+
if (startWithCooldown && cooldown > 0) {
|
|
40
|
+
timeline.to({}, { duration: cooldown });
|
|
41
|
+
}
|
|
42
|
+
const count = Math.max(Math.round(taps), 1);
|
|
43
|
+
for (let tap = 0; tap < count; tap++) {
|
|
44
|
+
if (tap > 0 && tapInterval > 0) {
|
|
45
|
+
timeline.to({}, { duration: tapInterval });
|
|
46
|
+
}
|
|
47
|
+
timeline
|
|
48
|
+
.to(micro, {
|
|
49
|
+
x: rest.x + pressX,
|
|
50
|
+
y: rest.y + pressY,
|
|
51
|
+
scaleX: rest.scaleX * pressScale,
|
|
52
|
+
scaleY: rest.scaleY * pressScale,
|
|
53
|
+
duration: durationIn,
|
|
54
|
+
ease: easeIn,
|
|
55
|
+
})
|
|
56
|
+
.to(micro, {
|
|
57
|
+
x: rest.x,
|
|
58
|
+
y: rest.y,
|
|
59
|
+
scaleX: rest.scaleX,
|
|
60
|
+
scaleY: rest.scaleY,
|
|
61
|
+
duration: durationOut,
|
|
62
|
+
ease: easeOut,
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
if (!startWithCooldown && cooldown > 0) {
|
|
66
|
+
timeline.to({}, { duration: cooldown });
|
|
67
|
+
}
|
|
68
|
+
return timeline;
|
|
69
|
+
}, onComplete);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Stops the tapping animation and returns elements to rest.
|
|
74
|
+
* @param target - Single element or array of elements to stop animating
|
|
75
|
+
* @param options - Stop animation configuration options
|
|
76
|
+
*/
|
|
77
|
+
static stopTap(target, options = {}) {
|
|
78
|
+
const { duration = DEFAULT_STOP_DURATION, ease = DEFAULT_STOP_EASE } = options;
|
|
79
|
+
for (const element of resolveTargets(target)) {
|
|
80
|
+
tapCalls.stop(element.micro, duration, ease);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,27 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
3
|
-
export {
|
|
4
|
-
export {
|
|
5
|
-
export {
|
|
6
|
-
export {
|
|
7
|
-
export {
|
|
1
|
+
export type { UIAnimatedElement, UIMicroAnimatedElement } from "./UIAnimatedElement.js";
|
|
2
|
+
export type { UIAppearAnimatorOptions } from "./UIAppearAnimator.js";
|
|
3
|
+
export { UIAppearAnimator } from "./UIAppearAnimator.js";
|
|
4
|
+
export type { UIClickAnimatorBindElement, UIClickAnimatorBindOptions, UIClickAnimatorOptions, UIClickAnimatorPressOptions, UIClickAnimatorReleaseOptions, } from "./UIClickAnimator.js";
|
|
5
|
+
export { UIClickAnimator } from "./UIClickAnimator.js";
|
|
6
|
+
export type { UIDisappearAnimatorOptions } from "./UIDisappearAnimator.js";
|
|
7
|
+
export { UIDisappearAnimator } from "./UIDisappearAnimator.js";
|
|
8
|
+
export type { UIFlashAnimatorOptions, UIFlashElement } from "./UIFlashAnimator.js";
|
|
9
|
+
export { UIFlashAnimator } from "./UIFlashAnimator.js";
|
|
10
|
+
export type { UIFloatCallAnimatorCallOptions, UIFloatCallAnimatorStopOptions, } from "./UIFloatCallAnimator.js";
|
|
11
|
+
export { UIFloatCallAnimator } from "./UIFloatCallAnimator.js";
|
|
12
|
+
export type { UIFlyToAnimatorOptions, UIFlyToElement, UIFlyToTarget } from "./UIFlyToAnimator.js";
|
|
13
|
+
export { UIFlyToAnimator } from "./UIFlyToAnimator.js";
|
|
14
|
+
export type { UIJumpCallAnimatorCallOptions, UIJumpCallAnimatorStopOptions, } from "./UIJumpCallAnimator.js";
|
|
15
|
+
export { UIJumpCallAnimator } from "./UIJumpCallAnimator.js";
|
|
16
|
+
export type { UIPulseCallAnimatorOptions, UIPulseCallAnimatorStopOptions, } from "./UIPulseCallAnimator.js";
|
|
17
|
+
export { UIPulseCallAnimator } from "./UIPulseCallAnimator.js";
|
|
18
|
+
export type { UIShakeAnimatorOptions } from "./UIShakeAnimator.js";
|
|
19
|
+
export { UIShakeAnimator } from "./UIShakeAnimator.js";
|
|
20
|
+
export type { UIShineCallAnimatorCallOptions } from "./UIShineCallAnimator.js";
|
|
21
|
+
export { UIShineCallAnimator } from "./UIShineCallAnimator.js";
|
|
22
|
+
export type { UISpinCallAnimatorCallOptions, UISpinCallAnimatorStopOptions, } from "./UISpinCallAnimator.js";
|
|
23
|
+
export { UISpinCallAnimator } from "./UISpinCallAnimator.js";
|
|
24
|
+
export type { UISwipeCallAnimatorCallOptions, UISwipeCallAnimatorStopOptions, } from "./UISwipeCallAnimator.js";
|
|
25
|
+
export { UISwipeCallAnimator } from "./UISwipeCallAnimator.js";
|
|
26
|
+
export type { UITapCallAnimatorCallOptions, UITapCallAnimatorStopOptions, } from "./UITapCallAnimator.js";
|
|
27
|
+
export { UITapCallAnimator } from "./UITapCallAnimator.js";
|