laymur-animations 0.1.4 → 0.1.7
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/Animator.d.ts +21 -4
- package/dist/index.js +28 -10
- package/dist/index.js.map +1 -1
- package/package.json +3 -2
package/dist/Animator.d.ts
CHANGED
|
@@ -20,6 +20,15 @@ export declare class Animator {
|
|
|
20
20
|
delay?: number;
|
|
21
21
|
opacity?: number;
|
|
22
22
|
}): Promise<void>;
|
|
23
|
+
static disappear(targets: AnimatedElement | AnimatedElement[], options?: {
|
|
24
|
+
x?: number;
|
|
25
|
+
y?: number;
|
|
26
|
+
scale?: number;
|
|
27
|
+
ease?: string;
|
|
28
|
+
duration?: number;
|
|
29
|
+
delay?: number;
|
|
30
|
+
opacity?: number;
|
|
31
|
+
}): Promise<void>;
|
|
23
32
|
static toggleSelect(targets: AnimatedElement | AnimatedElement[], options: {
|
|
24
33
|
selected: boolean;
|
|
25
34
|
anchorX?: number;
|
|
@@ -40,14 +49,18 @@ export declare class Animator {
|
|
|
40
49
|
gap?: number;
|
|
41
50
|
totalDuration?: number;
|
|
42
51
|
}): void;
|
|
43
|
-
static stopPulse(targets: AnimatedElement | AnimatedElement[]
|
|
52
|
+
static stopPulse(targets: AnimatedElement | AnimatedElement[], options?: {
|
|
53
|
+
duration?: number;
|
|
54
|
+
}): void;
|
|
44
55
|
static shake(targets: AnimatedElement | AnimatedElement[], options?: {
|
|
45
56
|
radius?: number;
|
|
46
57
|
duration?: number;
|
|
47
58
|
frequency?: number;
|
|
48
59
|
totalDuration?: number;
|
|
49
60
|
}): void;
|
|
50
|
-
static stopShake(targets: AnimatedElement | AnimatedElement[]
|
|
61
|
+
static stopShake(targets: AnimatedElement | AnimatedElement[], options?: {
|
|
62
|
+
duration?: number;
|
|
63
|
+
}): void;
|
|
51
64
|
static callToClick(targets: AnimatedElement | AnimatedElement[], options?: {
|
|
52
65
|
jumpHeight?: number;
|
|
53
66
|
duration?: number;
|
|
@@ -56,7 +69,9 @@ export declare class Animator {
|
|
|
56
69
|
gap?: number;
|
|
57
70
|
totalDuration?: number;
|
|
58
71
|
}): void;
|
|
59
|
-
static stopCallToClick(targets: AnimatedElement | AnimatedElement[]
|
|
72
|
+
static stopCallToClick(targets: AnimatedElement | AnimatedElement[], options?: {
|
|
73
|
+
duration?: number;
|
|
74
|
+
}): void;
|
|
60
75
|
static callToClickSpin(targets: AnimatedElement | AnimatedElement[], options?: {
|
|
61
76
|
degrees?: number;
|
|
62
77
|
duration?: number;
|
|
@@ -67,5 +82,7 @@ export declare class Animator {
|
|
|
67
82
|
anchorX?: number;
|
|
68
83
|
anchorY?: number;
|
|
69
84
|
}): void;
|
|
70
|
-
static stopCallToClickSpin(targets: AnimatedElement | AnimatedElement[]
|
|
85
|
+
static stopCallToClickSpin(targets: AnimatedElement | AnimatedElement[], options?: {
|
|
86
|
+
duration?: number;
|
|
87
|
+
}): void;
|
|
71
88
|
}
|
package/dist/index.js
CHANGED
|
@@ -6079,8 +6079,8 @@ class Animator {
|
|
|
6079
6079
|
static appear(targets, options = {}) {
|
|
6080
6080
|
const { ease = "back.out(1.7)", duration = 0.5, delay = 0, scale = 0.8, opacity = 1, } = options;
|
|
6081
6081
|
const elements = Array.isArray(targets) ? targets : [targets];
|
|
6082
|
-
const targetMicro = Object.assign(Object.assign(
|
|
6083
|
-
duration
|
|
6082
|
+
const targetMicro = Object.assign(Object.assign({ ease,
|
|
6083
|
+
duration, scaleX: 1, scaleY: 1 }, (options.x && { x: 0 })), (options.y && { y: 0 }));
|
|
6084
6084
|
for (const el of elements) {
|
|
6085
6085
|
if (options.x) {
|
|
6086
6086
|
el.micro.x = options.x;
|
|
@@ -6103,6 +6103,20 @@ class Animator {
|
|
|
6103
6103
|
}
|
|
6104
6104
|
});
|
|
6105
6105
|
}
|
|
6106
|
+
static disappear(targets, options = {}) {
|
|
6107
|
+
const { ease = "back.in(1.7)", duration = 0.5, delay = 0, scale = 0.8, opacity = 0, } = options;
|
|
6108
|
+
const elements = Array.isArray(targets) ? targets : [targets];
|
|
6109
|
+
const targetMicro = Object.assign(Object.assign({ ease,
|
|
6110
|
+
duration, scaleX: scale, scaleY: scale }, (options.x && { x: options.x })), (options.y && { y: options.y }));
|
|
6111
|
+
return new Promise((resolve) => {
|
|
6112
|
+
const timeline = gsapWithCSS.timeline({ onComplete: resolve, delay });
|
|
6113
|
+
for (const element of elements) {
|
|
6114
|
+
timeline
|
|
6115
|
+
.to(element, { opacity, ease: "power1.inOut", duration }, 0)
|
|
6116
|
+
.to(element.micro, targetMicro, 0);
|
|
6117
|
+
}
|
|
6118
|
+
});
|
|
6119
|
+
}
|
|
6106
6120
|
static toggleSelect(targets, options) {
|
|
6107
6121
|
const { selected, scale = 1.25, duration = 0.25, ease = "power1.inOut", } = options;
|
|
6108
6122
|
const elements = Array.isArray(targets) ? targets : [targets];
|
|
@@ -6179,7 +6193,8 @@ class Animator {
|
|
|
6179
6193
|
}
|
|
6180
6194
|
}
|
|
6181
6195
|
}
|
|
6182
|
-
static stopPulse(targets) {
|
|
6196
|
+
static stopPulse(targets, options = {}) {
|
|
6197
|
+
var _a;
|
|
6183
6198
|
const elements = Array.isArray(targets) ? targets : [targets];
|
|
6184
6199
|
for (const element of elements) {
|
|
6185
6200
|
const tween = element.__laymurPulseTween;
|
|
@@ -6189,7 +6204,7 @@ class Animator {
|
|
|
6189
6204
|
gsapWithCSS.to(element.micro, {
|
|
6190
6205
|
scaleX: 1,
|
|
6191
6206
|
scaleY: 1,
|
|
6192
|
-
duration: 0.25,
|
|
6207
|
+
duration: (_a = options.duration) !== null && _a !== void 0 ? _a : 0.25,
|
|
6193
6208
|
ease: "power1.out",
|
|
6194
6209
|
});
|
|
6195
6210
|
}
|
|
@@ -6223,7 +6238,8 @@ class Animator {
|
|
|
6223
6238
|
}
|
|
6224
6239
|
}
|
|
6225
6240
|
}
|
|
6226
|
-
static stopShake(targets) {
|
|
6241
|
+
static stopShake(targets, options = {}) {
|
|
6242
|
+
var _a;
|
|
6227
6243
|
const elements = Array.isArray(targets) ? targets : [targets];
|
|
6228
6244
|
for (const element of elements) {
|
|
6229
6245
|
const key = "__laymurShakeInterval";
|
|
@@ -6234,7 +6250,7 @@ class Animator {
|
|
|
6234
6250
|
gsapWithCSS.to(element.micro, {
|
|
6235
6251
|
x: 0,
|
|
6236
6252
|
y: 0,
|
|
6237
|
-
duration: 0.25,
|
|
6253
|
+
duration: (_a = options.duration) !== null && _a !== void 0 ? _a : 0.25,
|
|
6238
6254
|
ease: "power1.out",
|
|
6239
6255
|
});
|
|
6240
6256
|
}
|
|
@@ -6267,7 +6283,8 @@ class Animator {
|
|
|
6267
6283
|
}
|
|
6268
6284
|
}
|
|
6269
6285
|
}
|
|
6270
|
-
static stopCallToClick(targets) {
|
|
6286
|
+
static stopCallToClick(targets, options = {}) {
|
|
6287
|
+
var _a;
|
|
6271
6288
|
const elements = Array.isArray(targets) ? targets : [targets];
|
|
6272
6289
|
for (const element of elements) {
|
|
6273
6290
|
const tween = element.__laymurCallTween;
|
|
@@ -6276,7 +6293,7 @@ class Animator {
|
|
|
6276
6293
|
delete element.__laymurCallTween;
|
|
6277
6294
|
gsapWithCSS.to(element.micro, {
|
|
6278
6295
|
y: 0,
|
|
6279
|
-
duration: 0.25,
|
|
6296
|
+
duration: (_a = options.duration) !== null && _a !== void 0 ? _a : 0.25,
|
|
6280
6297
|
ease: "power1.out",
|
|
6281
6298
|
});
|
|
6282
6299
|
}
|
|
@@ -6324,7 +6341,8 @@ class Animator {
|
|
|
6324
6341
|
}
|
|
6325
6342
|
}
|
|
6326
6343
|
}
|
|
6327
|
-
static stopCallToClickSpin(targets) {
|
|
6344
|
+
static stopCallToClickSpin(targets, options = {}) {
|
|
6345
|
+
var _a;
|
|
6328
6346
|
const elements = Array.isArray(targets) ? targets : [targets];
|
|
6329
6347
|
for (const element of elements) {
|
|
6330
6348
|
const tween = element.__laymurSpinTween;
|
|
@@ -6333,7 +6351,7 @@ class Animator {
|
|
|
6333
6351
|
delete element.__laymurSpinTween;
|
|
6334
6352
|
gsapWithCSS.to(element.micro, {
|
|
6335
6353
|
angle: 0,
|
|
6336
|
-
duration: 0.25,
|
|
6354
|
+
duration: (_a = options.duration) !== null && _a !== void 0 ? _a : 0.25,
|
|
6337
6355
|
ease: "power1.out",
|
|
6338
6356
|
});
|
|
6339
6357
|
}
|