laymur-animations 0.1.3 → 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 +10 -0
- package/dist/index.js +18 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/Animator.d.ts
CHANGED
|
@@ -18,6 +18,16 @@ export declare class Animator {
|
|
|
18
18
|
ease?: string;
|
|
19
19
|
duration?: number;
|
|
20
20
|
delay?: number;
|
|
21
|
+
opacity?: number;
|
|
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;
|
|
21
31
|
}): Promise<void>;
|
|
22
32
|
static toggleSelect(targets: AnimatedElement | AnimatedElement[], options: {
|
|
23
33
|
selected: boolean;
|
package/dist/index.js
CHANGED
|
@@ -6077,10 +6077,10 @@ gsapWithCSS.core.Tween;
|
|
|
6077
6077
|
|
|
6078
6078
|
class Animator {
|
|
6079
6079
|
static appear(targets, options = {}) {
|
|
6080
|
-
const { ease = "back.out(1.7)", duration = 0.5, delay = 0, scale = 0.8, } = options;
|
|
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;
|
|
@@ -6098,7 +6098,21 @@ class Animator {
|
|
|
6098
6098
|
const timeline = gsapWithCSS.timeline({ onComplete: resolve, delay });
|
|
6099
6099
|
for (const element of elements) {
|
|
6100
6100
|
timeline
|
|
6101
|
-
.to(element, { opacity
|
|
6101
|
+
.to(element, { opacity, ease: "power1.inOut", duration }, 0)
|
|
6102
|
+
.to(element.micro, targetMicro, 0);
|
|
6103
|
+
}
|
|
6104
|
+
});
|
|
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)
|
|
6102
6116
|
.to(element.micro, targetMicro, 0);
|
|
6103
6117
|
}
|
|
6104
6118
|
});
|