react-gsap-aos 1.0.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/constants-Bl3iJeR7.d.mts +67 -0
- package/dist/constants-Bl3iJeR7.d.ts +67 -0
- package/dist/constants.d.mts +1 -0
- package/dist/constants.d.ts +1 -0
- package/dist/constants.js +121 -0
- package/dist/constants.js.map +1 -0
- package/dist/constants.mjs +92 -0
- package/dist/constants.mjs.map +1 -0
- package/dist/index.d.mts +42 -0
- package/dist/index.d.ts +42 -0
- package/dist/index.js +770 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +731 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +72 -0
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/** 動畫選項 */
|
|
2
|
+
interface AnimationOptions {
|
|
3
|
+
/**
|
|
4
|
+
* 提前觸發動畫的距離 (px)
|
|
5
|
+
*
|
|
6
|
+
* @default 120
|
|
7
|
+
*/
|
|
8
|
+
offset: number;
|
|
9
|
+
/**
|
|
10
|
+
* 動畫延遲時間 (ms)
|
|
11
|
+
*
|
|
12
|
+
* @default 0
|
|
13
|
+
*/
|
|
14
|
+
delay: number;
|
|
15
|
+
/**
|
|
16
|
+
* 動畫持續時間 (ms)
|
|
17
|
+
*
|
|
18
|
+
* @default 400
|
|
19
|
+
*/
|
|
20
|
+
duration: number;
|
|
21
|
+
/**
|
|
22
|
+
* 緩動曲線
|
|
23
|
+
*
|
|
24
|
+
* @default "none"
|
|
25
|
+
*/
|
|
26
|
+
easing: Easing;
|
|
27
|
+
/**
|
|
28
|
+
* 是否只執行一次
|
|
29
|
+
*
|
|
30
|
+
* @default false
|
|
31
|
+
*/
|
|
32
|
+
once: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* 滾動過元素後,動畫是否反向播放
|
|
35
|
+
*
|
|
36
|
+
* @default false
|
|
37
|
+
*/
|
|
38
|
+
mirror: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* 元素在視窗的指定位置觸發動畫
|
|
41
|
+
*
|
|
42
|
+
* [GSAP 文件](https://gsap.com/docs/v3/Eases)
|
|
43
|
+
*
|
|
44
|
+
* @default "top-bottom"
|
|
45
|
+
*/
|
|
46
|
+
anchorPlacement: AnchorPlacement;
|
|
47
|
+
}
|
|
48
|
+
type FadeAnimation = "fade" | "fade-up" | "fade-down" | "fade-left" | "fade-right" | "fade-up-right" | "fade-up-left" | "fade-down-right" | "fade-down-left";
|
|
49
|
+
type FlipAnimation = "flip-up" | "flip-down" | "flip-left" | "flip-right";
|
|
50
|
+
type SlideAnimation = "slide-up" | "slide-down" | "slide-left" | "slide-right";
|
|
51
|
+
type ZoomAnimation = "zoom-in" | "zoom-in-up" | "zoom-in-down" | "zoom-in-left" | "zoom-in-right" | "zoom-out" | "zoom-out-up" | "zoom-out-down" | "zoom-out-left" | "zoom-out-right";
|
|
52
|
+
/** 動畫類型 */
|
|
53
|
+
type Animation = FadeAnimation | FlipAnimation | SlideAnimation | ZoomAnimation;
|
|
54
|
+
/** 動畫錨點 */
|
|
55
|
+
type AnchorPlacement = "top-bottom" | "top-center" | "top-top" | "center-bottom" | "center-center" | "center-top" | "bottom-bottom" | "bottom-center" | "bottom-top";
|
|
56
|
+
/** 動畫曲線 */
|
|
57
|
+
type Easing = "none" | "power1" | "power1.in" | "power1.out" | "power1.inOut" | "power2" | "power2.in" | "power2.out" | "power2.inOut" | "power3" | "power3.in" | "power3.out" | "power3.inOut" | "power4" | "power4.in" | "power4.out" | "power4.inOut" | "back" | "back.in" | "back.out" | "back.inOut" | "bounce" | "bounce.in" | "bounce.out" | "bounce.inOut" | "circ" | "circ.in" | "circ.out" | "circ.inOut" | "elastic" | "elastic.in" | "elastic.out" | "elastic.inOut" | "expo" | "expo.in" | "expo.out" | "expo.inOut" | "sine" | "sine.in" | "sine.out" | "sine.inOut";
|
|
58
|
+
|
|
59
|
+
/** 動畫曲線 */
|
|
60
|
+
declare const easings: Easing[];
|
|
61
|
+
/** 動畫錨點 */
|
|
62
|
+
declare const anchorPlacements: AnchorPlacement[];
|
|
63
|
+
|
|
64
|
+
/** 動畫種類 */
|
|
65
|
+
declare const animations: Animation[];
|
|
66
|
+
|
|
67
|
+
export { type AnimationOptions as A, type Easing as E, type FadeAnimation as F, type SlideAnimation as S, type ZoomAnimation as Z, type Animation as a, type AnchorPlacement as b, type FlipAnimation as c, anchorPlacements as d, animations as e, easings as f };
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/** 動畫選項 */
|
|
2
|
+
interface AnimationOptions {
|
|
3
|
+
/**
|
|
4
|
+
* 提前觸發動畫的距離 (px)
|
|
5
|
+
*
|
|
6
|
+
* @default 120
|
|
7
|
+
*/
|
|
8
|
+
offset: number;
|
|
9
|
+
/**
|
|
10
|
+
* 動畫延遲時間 (ms)
|
|
11
|
+
*
|
|
12
|
+
* @default 0
|
|
13
|
+
*/
|
|
14
|
+
delay: number;
|
|
15
|
+
/**
|
|
16
|
+
* 動畫持續時間 (ms)
|
|
17
|
+
*
|
|
18
|
+
* @default 400
|
|
19
|
+
*/
|
|
20
|
+
duration: number;
|
|
21
|
+
/**
|
|
22
|
+
* 緩動曲線
|
|
23
|
+
*
|
|
24
|
+
* @default "none"
|
|
25
|
+
*/
|
|
26
|
+
easing: Easing;
|
|
27
|
+
/**
|
|
28
|
+
* 是否只執行一次
|
|
29
|
+
*
|
|
30
|
+
* @default false
|
|
31
|
+
*/
|
|
32
|
+
once: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* 滾動過元素後,動畫是否反向播放
|
|
35
|
+
*
|
|
36
|
+
* @default false
|
|
37
|
+
*/
|
|
38
|
+
mirror: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* 元素在視窗的指定位置觸發動畫
|
|
41
|
+
*
|
|
42
|
+
* [GSAP 文件](https://gsap.com/docs/v3/Eases)
|
|
43
|
+
*
|
|
44
|
+
* @default "top-bottom"
|
|
45
|
+
*/
|
|
46
|
+
anchorPlacement: AnchorPlacement;
|
|
47
|
+
}
|
|
48
|
+
type FadeAnimation = "fade" | "fade-up" | "fade-down" | "fade-left" | "fade-right" | "fade-up-right" | "fade-up-left" | "fade-down-right" | "fade-down-left";
|
|
49
|
+
type FlipAnimation = "flip-up" | "flip-down" | "flip-left" | "flip-right";
|
|
50
|
+
type SlideAnimation = "slide-up" | "slide-down" | "slide-left" | "slide-right";
|
|
51
|
+
type ZoomAnimation = "zoom-in" | "zoom-in-up" | "zoom-in-down" | "zoom-in-left" | "zoom-in-right" | "zoom-out" | "zoom-out-up" | "zoom-out-down" | "zoom-out-left" | "zoom-out-right";
|
|
52
|
+
/** 動畫類型 */
|
|
53
|
+
type Animation = FadeAnimation | FlipAnimation | SlideAnimation | ZoomAnimation;
|
|
54
|
+
/** 動畫錨點 */
|
|
55
|
+
type AnchorPlacement = "top-bottom" | "top-center" | "top-top" | "center-bottom" | "center-center" | "center-top" | "bottom-bottom" | "bottom-center" | "bottom-top";
|
|
56
|
+
/** 動畫曲線 */
|
|
57
|
+
type Easing = "none" | "power1" | "power1.in" | "power1.out" | "power1.inOut" | "power2" | "power2.in" | "power2.out" | "power2.inOut" | "power3" | "power3.in" | "power3.out" | "power3.inOut" | "power4" | "power4.in" | "power4.out" | "power4.inOut" | "back" | "back.in" | "back.out" | "back.inOut" | "bounce" | "bounce.in" | "bounce.out" | "bounce.inOut" | "circ" | "circ.in" | "circ.out" | "circ.inOut" | "elastic" | "elastic.in" | "elastic.out" | "elastic.inOut" | "expo" | "expo.in" | "expo.out" | "expo.inOut" | "sine" | "sine.in" | "sine.out" | "sine.inOut";
|
|
58
|
+
|
|
59
|
+
/** 動畫曲線 */
|
|
60
|
+
declare const easings: Easing[];
|
|
61
|
+
/** 動畫錨點 */
|
|
62
|
+
declare const anchorPlacements: AnchorPlacement[];
|
|
63
|
+
|
|
64
|
+
/** 動畫種類 */
|
|
65
|
+
declare const animations: Animation[];
|
|
66
|
+
|
|
67
|
+
export { type AnimationOptions as A, type Easing as E, type FadeAnimation as F, type SlideAnimation as S, type ZoomAnimation as Z, type Animation as a, type AnchorPlacement as b, type FlipAnimation as c, anchorPlacements as d, animations as e, easings as f };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { d as anchorPlacements, e as animations, f as easings } from './constants-Bl3iJeR7.mjs';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { d as anchorPlacements, e as animations, f as easings } from './constants-Bl3iJeR7.js';
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/constants.ts
|
|
21
|
+
var constants_exports = {};
|
|
22
|
+
__export(constants_exports, {
|
|
23
|
+
anchorPlacements: () => anchorPlacements,
|
|
24
|
+
animations: () => animations,
|
|
25
|
+
easings: () => easings
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(constants_exports);
|
|
28
|
+
|
|
29
|
+
// src/animation/constants.ts
|
|
30
|
+
var easings = [
|
|
31
|
+
"none",
|
|
32
|
+
"power1",
|
|
33
|
+
"power1.in",
|
|
34
|
+
"power1.out",
|
|
35
|
+
"power1.inOut",
|
|
36
|
+
"power2",
|
|
37
|
+
"power2.in",
|
|
38
|
+
"power2.out",
|
|
39
|
+
"power2.inOut",
|
|
40
|
+
"power3",
|
|
41
|
+
"power3.in",
|
|
42
|
+
"power3.out",
|
|
43
|
+
"power3.inOut",
|
|
44
|
+
"power4",
|
|
45
|
+
"power4.in",
|
|
46
|
+
"power4.out",
|
|
47
|
+
"power4.inOut",
|
|
48
|
+
"back",
|
|
49
|
+
"back.in",
|
|
50
|
+
"back.out",
|
|
51
|
+
"back.inOut",
|
|
52
|
+
"bounce",
|
|
53
|
+
"bounce.in",
|
|
54
|
+
"bounce.out",
|
|
55
|
+
"bounce.inOut",
|
|
56
|
+
"circ",
|
|
57
|
+
"circ.in",
|
|
58
|
+
"circ.out",
|
|
59
|
+
"circ.inOut",
|
|
60
|
+
"elastic",
|
|
61
|
+
"elastic.in",
|
|
62
|
+
"elastic.out",
|
|
63
|
+
"elastic.inOut",
|
|
64
|
+
"expo",
|
|
65
|
+
"expo.in",
|
|
66
|
+
"expo.out",
|
|
67
|
+
"expo.inOut",
|
|
68
|
+
"sine",
|
|
69
|
+
"sine.in",
|
|
70
|
+
"sine.out",
|
|
71
|
+
"sine.inOut"
|
|
72
|
+
];
|
|
73
|
+
var anchorPlacements = [
|
|
74
|
+
"top-bottom",
|
|
75
|
+
"top-center",
|
|
76
|
+
"top-top",
|
|
77
|
+
"center-bottom",
|
|
78
|
+
"center-center",
|
|
79
|
+
"center-top",
|
|
80
|
+
"bottom-bottom",
|
|
81
|
+
"bottom-center",
|
|
82
|
+
"bottom-top"
|
|
83
|
+
];
|
|
84
|
+
|
|
85
|
+
// src/constants.ts
|
|
86
|
+
var animations = [
|
|
87
|
+
"fade",
|
|
88
|
+
"fade-up",
|
|
89
|
+
"fade-down",
|
|
90
|
+
"fade-left",
|
|
91
|
+
"fade-right",
|
|
92
|
+
"fade-up-right",
|
|
93
|
+
"fade-up-left",
|
|
94
|
+
"fade-down-right",
|
|
95
|
+
"fade-down-left",
|
|
96
|
+
"flip-up",
|
|
97
|
+
"flip-down",
|
|
98
|
+
"flip-left",
|
|
99
|
+
"flip-right",
|
|
100
|
+
"slide-up",
|
|
101
|
+
"slide-down",
|
|
102
|
+
"slide-left",
|
|
103
|
+
"slide-right",
|
|
104
|
+
"zoom-in",
|
|
105
|
+
"zoom-in-up",
|
|
106
|
+
"zoom-in-down",
|
|
107
|
+
"zoom-in-left",
|
|
108
|
+
"zoom-in-right",
|
|
109
|
+
"zoom-out",
|
|
110
|
+
"zoom-out-up",
|
|
111
|
+
"zoom-out-down",
|
|
112
|
+
"zoom-out-left",
|
|
113
|
+
"zoom-out-right"
|
|
114
|
+
];
|
|
115
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
116
|
+
0 && (module.exports = {
|
|
117
|
+
anchorPlacements,
|
|
118
|
+
animations,
|
|
119
|
+
easings
|
|
120
|
+
});
|
|
121
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/constants.ts","../src/animation/constants.ts"],"sourcesContent":["import type { Animation } from \"./types\";\n\nexport { anchorPlacements, easings } from \"./animation/constants\";\n\n/** 動畫種類 */\nexport const animations: Animation[] = [\n \"fade\",\n \"fade-up\",\n \"fade-down\",\n \"fade-left\",\n \"fade-right\",\n \"fade-up-right\",\n \"fade-up-left\",\n \"fade-down-right\",\n \"fade-down-left\",\n \"flip-up\",\n \"flip-down\",\n \"flip-left\",\n \"flip-right\",\n \"slide-up\",\n \"slide-down\",\n \"slide-left\",\n \"slide-right\",\n \"zoom-in\",\n \"zoom-in-up\",\n \"zoom-in-down\",\n \"zoom-in-left\",\n \"zoom-in-right\",\n \"zoom-out\",\n \"zoom-out-up\",\n \"zoom-out-down\",\n \"zoom-out-left\",\n \"zoom-out-right\",\n];\n","import type { AnchorPlacement, AnimationOptions, Easing } from \"@/types\";\n\n/** 預設選項 */\nexport const DEFAULT_OPTIONS: AnimationOptions = {\n offset: 120,\n delay: 0,\n duration: 400,\n easing: \"none\",\n once: false,\n mirror: false,\n anchorPlacement: \"top-bottom\",\n};\n\n/** 動畫曲線 */\nexport const easings: Easing[] = [\n \"none\",\n \"power1\",\n \"power1.in\",\n \"power1.out\",\n \"power1.inOut\",\n \"power2\",\n \"power2.in\",\n \"power2.out\",\n \"power2.inOut\",\n \"power3\",\n \"power3.in\",\n \"power3.out\",\n \"power3.inOut\",\n \"power4\",\n \"power4.in\",\n \"power4.out\",\n \"power4.inOut\",\n \"back\",\n \"back.in\",\n \"back.out\",\n \"back.inOut\",\n \"bounce\",\n \"bounce.in\",\n \"bounce.out\",\n \"bounce.inOut\",\n \"circ\",\n \"circ.in\",\n \"circ.out\",\n \"circ.inOut\",\n \"elastic\",\n \"elastic.in\",\n \"elastic.out\",\n \"elastic.inOut\",\n \"expo\",\n \"expo.in\",\n \"expo.out\",\n \"expo.inOut\",\n \"sine\",\n \"sine.in\",\n \"sine.out\",\n \"sine.inOut\",\n];\n\n/** 動畫錨點 */\nexport const anchorPlacements: AnchorPlacement[] = [\n \"top-bottom\",\n \"top-center\",\n \"top-top\",\n \"center-bottom\",\n \"center-center\",\n \"center-top\",\n \"bottom-bottom\",\n \"bottom-center\",\n \"bottom-top\",\n];\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACcO,IAAM,UAAoB;AAAA,EAC/B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAGO,IAAM,mBAAsC;AAAA,EACjD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;;;ADhEO,IAAM,aAA0B;AAAA,EACrC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;","names":[]}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
// src/animation/constants.ts
|
|
2
|
+
var easings = [
|
|
3
|
+
"none",
|
|
4
|
+
"power1",
|
|
5
|
+
"power1.in",
|
|
6
|
+
"power1.out",
|
|
7
|
+
"power1.inOut",
|
|
8
|
+
"power2",
|
|
9
|
+
"power2.in",
|
|
10
|
+
"power2.out",
|
|
11
|
+
"power2.inOut",
|
|
12
|
+
"power3",
|
|
13
|
+
"power3.in",
|
|
14
|
+
"power3.out",
|
|
15
|
+
"power3.inOut",
|
|
16
|
+
"power4",
|
|
17
|
+
"power4.in",
|
|
18
|
+
"power4.out",
|
|
19
|
+
"power4.inOut",
|
|
20
|
+
"back",
|
|
21
|
+
"back.in",
|
|
22
|
+
"back.out",
|
|
23
|
+
"back.inOut",
|
|
24
|
+
"bounce",
|
|
25
|
+
"bounce.in",
|
|
26
|
+
"bounce.out",
|
|
27
|
+
"bounce.inOut",
|
|
28
|
+
"circ",
|
|
29
|
+
"circ.in",
|
|
30
|
+
"circ.out",
|
|
31
|
+
"circ.inOut",
|
|
32
|
+
"elastic",
|
|
33
|
+
"elastic.in",
|
|
34
|
+
"elastic.out",
|
|
35
|
+
"elastic.inOut",
|
|
36
|
+
"expo",
|
|
37
|
+
"expo.in",
|
|
38
|
+
"expo.out",
|
|
39
|
+
"expo.inOut",
|
|
40
|
+
"sine",
|
|
41
|
+
"sine.in",
|
|
42
|
+
"sine.out",
|
|
43
|
+
"sine.inOut"
|
|
44
|
+
];
|
|
45
|
+
var anchorPlacements = [
|
|
46
|
+
"top-bottom",
|
|
47
|
+
"top-center",
|
|
48
|
+
"top-top",
|
|
49
|
+
"center-bottom",
|
|
50
|
+
"center-center",
|
|
51
|
+
"center-top",
|
|
52
|
+
"bottom-bottom",
|
|
53
|
+
"bottom-center",
|
|
54
|
+
"bottom-top"
|
|
55
|
+
];
|
|
56
|
+
|
|
57
|
+
// src/constants.ts
|
|
58
|
+
var animations = [
|
|
59
|
+
"fade",
|
|
60
|
+
"fade-up",
|
|
61
|
+
"fade-down",
|
|
62
|
+
"fade-left",
|
|
63
|
+
"fade-right",
|
|
64
|
+
"fade-up-right",
|
|
65
|
+
"fade-up-left",
|
|
66
|
+
"fade-down-right",
|
|
67
|
+
"fade-down-left",
|
|
68
|
+
"flip-up",
|
|
69
|
+
"flip-down",
|
|
70
|
+
"flip-left",
|
|
71
|
+
"flip-right",
|
|
72
|
+
"slide-up",
|
|
73
|
+
"slide-down",
|
|
74
|
+
"slide-left",
|
|
75
|
+
"slide-right",
|
|
76
|
+
"zoom-in",
|
|
77
|
+
"zoom-in-up",
|
|
78
|
+
"zoom-in-down",
|
|
79
|
+
"zoom-in-left",
|
|
80
|
+
"zoom-in-right",
|
|
81
|
+
"zoom-out",
|
|
82
|
+
"zoom-out-up",
|
|
83
|
+
"zoom-out-down",
|
|
84
|
+
"zoom-out-left",
|
|
85
|
+
"zoom-out-right"
|
|
86
|
+
];
|
|
87
|
+
export {
|
|
88
|
+
anchorPlacements,
|
|
89
|
+
animations,
|
|
90
|
+
easings
|
|
91
|
+
};
|
|
92
|
+
//# sourceMappingURL=constants.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/animation/constants.ts","../src/constants.ts"],"sourcesContent":["import type { AnchorPlacement, AnimationOptions, Easing } from \"@/types\";\n\n/** 預設選項 */\nexport const DEFAULT_OPTIONS: AnimationOptions = {\n offset: 120,\n delay: 0,\n duration: 400,\n easing: \"none\",\n once: false,\n mirror: false,\n anchorPlacement: \"top-bottom\",\n};\n\n/** 動畫曲線 */\nexport const easings: Easing[] = [\n \"none\",\n \"power1\",\n \"power1.in\",\n \"power1.out\",\n \"power1.inOut\",\n \"power2\",\n \"power2.in\",\n \"power2.out\",\n \"power2.inOut\",\n \"power3\",\n \"power3.in\",\n \"power3.out\",\n \"power3.inOut\",\n \"power4\",\n \"power4.in\",\n \"power4.out\",\n \"power4.inOut\",\n \"back\",\n \"back.in\",\n \"back.out\",\n \"back.inOut\",\n \"bounce\",\n \"bounce.in\",\n \"bounce.out\",\n \"bounce.inOut\",\n \"circ\",\n \"circ.in\",\n \"circ.out\",\n \"circ.inOut\",\n \"elastic\",\n \"elastic.in\",\n \"elastic.out\",\n \"elastic.inOut\",\n \"expo\",\n \"expo.in\",\n \"expo.out\",\n \"expo.inOut\",\n \"sine\",\n \"sine.in\",\n \"sine.out\",\n \"sine.inOut\",\n];\n\n/** 動畫錨點 */\nexport const anchorPlacements: AnchorPlacement[] = [\n \"top-bottom\",\n \"top-center\",\n \"top-top\",\n \"center-bottom\",\n \"center-center\",\n \"center-top\",\n \"bottom-bottom\",\n \"bottom-center\",\n \"bottom-top\",\n];\n","import type { Animation } from \"./types\";\n\nexport { anchorPlacements, easings } from \"./animation/constants\";\n\n/** 動畫種類 */\nexport const animations: Animation[] = [\n \"fade\",\n \"fade-up\",\n \"fade-down\",\n \"fade-left\",\n \"fade-right\",\n \"fade-up-right\",\n \"fade-up-left\",\n \"fade-down-right\",\n \"fade-down-left\",\n \"flip-up\",\n \"flip-down\",\n \"flip-left\",\n \"flip-right\",\n \"slide-up\",\n \"slide-down\",\n \"slide-left\",\n \"slide-right\",\n \"zoom-in\",\n \"zoom-in-up\",\n \"zoom-in-down\",\n \"zoom-in-left\",\n \"zoom-in-right\",\n \"zoom-out\",\n \"zoom-out-up\",\n \"zoom-out-down\",\n \"zoom-out-left\",\n \"zoom-out-right\",\n];\n"],"mappings":";AAcO,IAAM,UAAoB;AAAA,EAC/B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAGO,IAAM,mBAAsC;AAAA,EACjD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;;;AChEO,IAAM,aAA0B;AAAA,EACrC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;","names":[]}
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { A as AnimationOptions, a as Animation } from './constants-Bl3iJeR7.mjs';
|
|
2
|
+
export { b as AnchorPlacement, E as Easing, F as FadeAnimation, c as FlipAnimation, S as SlideAnimation, Z as ZoomAnimation, d as anchorPlacements, e as animations, f as easings } from './constants-Bl3iJeR7.mjs';
|
|
3
|
+
import * as react from 'react';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* 初始化 AOS 動畫
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```tsx
|
|
10
|
+
"use client";
|
|
11
|
+
|
|
12
|
+
import {useAOSInitial} from '@/aos';
|
|
13
|
+
|
|
14
|
+
export default function Demo() {
|
|
15
|
+
const {containerRef} = useAOSInitial<HTMLDivElement>()
|
|
16
|
+
return (
|
|
17
|
+
<div ref={containerRef} className="overflow-hidden">
|
|
18
|
+
<div data-aos-container>
|
|
19
|
+
<div data-aos="fade-up">Hello AOS</div>
|
|
20
|
+
</div>
|
|
21
|
+
</div>
|
|
22
|
+
)
|
|
23
|
+
}
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
declare function useAOSInitial<E extends HTMLElement = HTMLElement>(options?: Partial<AnimationOptions>): {
|
|
27
|
+
containerRef: react.RefObject<E | null>;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
/** 刷新 AOS 動畫位置 */
|
|
31
|
+
declare function refreshAOS(): void;
|
|
32
|
+
|
|
33
|
+
interface AOSDataAttributes extends Partial<Record<"data-aos-offset" | "data-aos-delay" | "data-aos-duration" | "data-aos-easing" | "data-aos-mirror" | "data-aos-once" | "data-aos-anchor-placement", string>> {
|
|
34
|
+
"data-aos": Animation;
|
|
35
|
+
}
|
|
36
|
+
interface AOSAttributeOptions extends Partial<AnimationOptions> {
|
|
37
|
+
animation: Animation;
|
|
38
|
+
}
|
|
39
|
+
/** 將 options 轉成可直接使用的 AOS data attributes */
|
|
40
|
+
declare function toAOSProps(options: AOSAttributeOptions): Partial<AOSDataAttributes>;
|
|
41
|
+
|
|
42
|
+
export { Animation, AnimationOptions, refreshAOS, toAOSProps, useAOSInitial };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { A as AnimationOptions, a as Animation } from './constants-Bl3iJeR7.js';
|
|
2
|
+
export { b as AnchorPlacement, E as Easing, F as FadeAnimation, c as FlipAnimation, S as SlideAnimation, Z as ZoomAnimation, d as anchorPlacements, e as animations, f as easings } from './constants-Bl3iJeR7.js';
|
|
3
|
+
import * as react from 'react';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* 初始化 AOS 動畫
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```tsx
|
|
10
|
+
"use client";
|
|
11
|
+
|
|
12
|
+
import {useAOSInitial} from '@/aos';
|
|
13
|
+
|
|
14
|
+
export default function Demo() {
|
|
15
|
+
const {containerRef} = useAOSInitial<HTMLDivElement>()
|
|
16
|
+
return (
|
|
17
|
+
<div ref={containerRef} className="overflow-hidden">
|
|
18
|
+
<div data-aos-container>
|
|
19
|
+
<div data-aos="fade-up">Hello AOS</div>
|
|
20
|
+
</div>
|
|
21
|
+
</div>
|
|
22
|
+
)
|
|
23
|
+
}
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
declare function useAOSInitial<E extends HTMLElement = HTMLElement>(options?: Partial<AnimationOptions>): {
|
|
27
|
+
containerRef: react.RefObject<E | null>;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
/** 刷新 AOS 動畫位置 */
|
|
31
|
+
declare function refreshAOS(): void;
|
|
32
|
+
|
|
33
|
+
interface AOSDataAttributes extends Partial<Record<"data-aos-offset" | "data-aos-delay" | "data-aos-duration" | "data-aos-easing" | "data-aos-mirror" | "data-aos-once" | "data-aos-anchor-placement", string>> {
|
|
34
|
+
"data-aos": Animation;
|
|
35
|
+
}
|
|
36
|
+
interface AOSAttributeOptions extends Partial<AnimationOptions> {
|
|
37
|
+
animation: Animation;
|
|
38
|
+
}
|
|
39
|
+
/** 將 options 轉成可直接使用的 AOS data attributes */
|
|
40
|
+
declare function toAOSProps(options: AOSAttributeOptions): Partial<AOSDataAttributes>;
|
|
41
|
+
|
|
42
|
+
export { Animation, AnimationOptions, refreshAOS, toAOSProps, useAOSInitial };
|