laymur-animations 0.1.4 → 0.1.6
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 +9 -0
- package/dist/index.js +16 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
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;
|
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];
|