@juleshry/vue-animejs 0.4.3 → 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/README.md +122 -18
- package/dist/composables/use-animatable.d.ts +11 -2
- package/dist/composables/use-animatable.d.ts.map +1 -1
- package/dist/composables/use-animate.d.ts +3 -3
- package/dist/composables/use-animate.d.ts.map +1 -1
- package/dist/composables/use-draggable.d.ts +20 -2
- package/dist/composables/use-draggable.d.ts.map +1 -1
- package/dist/composables/use-layout.d.ts +12 -1
- package/dist/composables/use-layout.d.ts.map +1 -1
- package/dist/composables/use-raw-animate.d.ts +13 -6
- package/dist/composables/use-raw-animate.d.ts.map +1 -1
- package/dist/composables/use-scope.d.ts +14 -0
- package/dist/composables/use-scope.d.ts.map +1 -1
- package/dist/composables/use-svg-drawable.d.ts +19 -0
- package/dist/composables/use-svg-drawable.d.ts.map +1 -0
- package/dist/composables/use-svg.d.ts +10 -4
- package/dist/composables/use-svg.d.ts.map +1 -1
- package/dist/composables/use-text.d.ts +12 -0
- package/dist/composables/use-text.d.ts.map +1 -1
- package/dist/composables/use-timeline.d.ts +9 -8
- package/dist/composables/use-timeline.d.ts.map +1 -1
- package/dist/composables/use-timer.d.ts +18 -0
- package/dist/composables/use-timer.d.ts.map +1 -1
- package/dist/composables/use-waapi.d.ts +19 -0
- package/dist/composables/use-waapi.d.ts.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +264 -252
- package/dist/index.js.map +1 -1
- package/dist/utils/resolve-target.d.ts +17 -0
- package/dist/utils/resolve-target.d.ts.map +1 -0
- package/package.json +11 -5
package/README.md
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
<div align="center">
|
|
2
|
-
<img src="./docs/src/public/icon.
|
|
2
|
+
<img src="./docs/src/public/icon-animated.svg" alt="vue-animejs" width="120" />
|
|
3
3
|
|
|
4
4
|
<h1 align="center">vue-animejs</h1>
|
|
5
5
|
<p align="center">Vue 3 composables for <a href="https://animejs.com/">Anime.js</a> v4 — reactive animations that integrate naturally with Vue's reactivity system and component lifecycle.</p>
|
|
6
|
+
<p align="center"><a href="https://vue-animejs.juleshry.dev">📖 Documentation</a></p>
|
|
7
|
+
<p align="center"><a href="https://app.netlify.com/projects/vue-animejs/deploys"><img src="https://api.netlify.com/api/v1/badges/8017f5b4-47b7-45e4-a5d6-269d638a71ab/deploy-status" alt="Netlify Status" style="vertical-align: middle" /></a> <a href="https://ko-fi.com/C7O720SP29"><img src="https://ko-fi.com/img/githubbutton_sm.svg" alt="ko-fi" style="vertical-align: middle" /></a></p>
|
|
6
8
|
</div>
|
|
7
9
|
|
|
8
|
-
> [!WARNING]
|
|
9
|
-
> This library is a work in progress. The API is not stable and may change at any time.
|
|
10
|
-
|
|
11
10
|
## 🚀 Overview
|
|
12
11
|
|
|
13
12
|
**vue-animejs** wraps Anime.js v4 as idiomatic Vue 3 composables. It integrates with Vue's reactivity system — pass a `ref` as a target or option and the animation updates automatically. Lifecycle cleanup is handled for you.
|
|
@@ -66,16 +65,20 @@ useAnimate(el, { translateX: 250, duration: 800 })
|
|
|
66
65
|
|
|
67
66
|
## 🦄 Composables
|
|
68
67
|
|
|
69
|
-
| Composable
|
|
70
|
-
|
|
71
|
-
| `useAnimate`
|
|
72
|
-
| `
|
|
73
|
-
| `
|
|
74
|
-
| `
|
|
75
|
-
| `
|
|
76
|
-
| `
|
|
77
|
-
| `
|
|
78
|
-
| `
|
|
68
|
+
| Composable | Description |
|
|
69
|
+
|------------------|---------------------------------------------------|
|
|
70
|
+
| `useAnimate` | Animate a DOM target with reactive params |
|
|
71
|
+
| `useRawAnimate` | Thin wrapper around Anime.js `animate()` with ref unwrapping |
|
|
72
|
+
| `useTimer` | Drive a timer with full playback control |
|
|
73
|
+
| `useTimeline` | Sequence multiple animations on a shared timeline |
|
|
74
|
+
| `useWaapi` | Animate via the Web Animations API (WAAPI) |
|
|
75
|
+
| `useAnimatable` | Create a reactive animatable object |
|
|
76
|
+
| `useDraggable` | Make a DOM element draggable with full control |
|
|
77
|
+
| `useLayout` | Animate DOM layout changes (reorder, add, remove) |
|
|
78
|
+
| `useScope` | Create an Anime.js scope with lifecycle management |
|
|
79
|
+
| `useSvg` | SVG utilities: morph paths and motion path |
|
|
80
|
+
| `useSvgDrawable` | Animate SVG stroke drawing with the `draw` property |
|
|
81
|
+
| `useText` | Split text into animatable lines, words, and chars |
|
|
79
82
|
|
|
80
83
|
## 🚀 Usage
|
|
81
84
|
|
|
@@ -132,6 +135,24 @@ play()
|
|
|
132
135
|
</script>
|
|
133
136
|
```
|
|
134
137
|
|
|
138
|
+
### `useRawAnimate`
|
|
139
|
+
|
|
140
|
+
```vue
|
|
141
|
+
<script setup lang="ts">
|
|
142
|
+
import { useTemplateRef } from 'vue'
|
|
143
|
+
import { useRawAnimate } from '@juleshry/vue-animejs'
|
|
144
|
+
|
|
145
|
+
const el = useTemplateRef<HTMLElement>('el')
|
|
146
|
+
|
|
147
|
+
// Returns the raw Anime.js JSAnimation instance directly
|
|
148
|
+
const animation = useRawAnimate(el, { translateX: 250, duration: 800 })
|
|
149
|
+
</script>
|
|
150
|
+
|
|
151
|
+
<template>
|
|
152
|
+
<div ref="el" />
|
|
153
|
+
</template>
|
|
154
|
+
```
|
|
155
|
+
|
|
135
156
|
### `useAnimatable`
|
|
136
157
|
|
|
137
158
|
```vue
|
|
@@ -148,6 +169,89 @@ const { animatable } = useAnimatable(el, {
|
|
|
148
169
|
</script>
|
|
149
170
|
```
|
|
150
171
|
|
|
172
|
+
### `useWaapi`
|
|
173
|
+
|
|
174
|
+
```vue
|
|
175
|
+
<script setup lang="ts">
|
|
176
|
+
import { useTemplateRef } from 'vue'
|
|
177
|
+
import { useWaapi } from '@juleshry/vue-animejs'
|
|
178
|
+
|
|
179
|
+
const el = useTemplateRef<HTMLElement>('el')
|
|
180
|
+
|
|
181
|
+
const { play, pause } = useWaapi(el, {
|
|
182
|
+
translateX: 250,
|
|
183
|
+
duration: 800,
|
|
184
|
+
easing: 'easeInOutQuad',
|
|
185
|
+
})
|
|
186
|
+
</script>
|
|
187
|
+
|
|
188
|
+
<template>
|
|
189
|
+
<div ref="el" />
|
|
190
|
+
<button @click="play">Play</button>
|
|
191
|
+
<button @click="pause">Pause</button>
|
|
192
|
+
</template>
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
### `useSvg`
|
|
196
|
+
|
|
197
|
+
> **Note:** `morphTo` requires a live DOM element. Add each target as a hidden `<path>`, pass the ref directly to `morphTo`, and wrap in a `computed` — `useTimeline.add()` accepts `MaybeRef<AnimationParams>` and resolves the computed after mount, when the target elements are available.
|
|
198
|
+
|
|
199
|
+
```vue
|
|
200
|
+
<script setup lang="ts">
|
|
201
|
+
import { computed, useTemplateRef } from 'vue'
|
|
202
|
+
import { useSvg, useTimeline } from '@juleshry/vue-animejs'
|
|
203
|
+
|
|
204
|
+
const shape = useTemplateRef<SVGPathElement>('shape')
|
|
205
|
+
const t_circle = useTemplateRef<SVGPathElement>('t-circle')
|
|
206
|
+
const t_diamond = useTemplateRef<SVGPathElement>('t-diamond')
|
|
207
|
+
|
|
208
|
+
const { morphTo } = useSvg()
|
|
209
|
+
|
|
210
|
+
const { add } = useTimeline({
|
|
211
|
+
loop: true,
|
|
212
|
+
defaults: { duration: 1200, easing: 'easeInOutCubic' },
|
|
213
|
+
loopDelay: 500,
|
|
214
|
+
})
|
|
215
|
+
|
|
216
|
+
add(shape, computed(() => ({ d: morphTo(t_circle) })))
|
|
217
|
+
.add(shape, computed(() => ({ d: morphTo(t_diamond) })), '+=500')
|
|
218
|
+
</script>
|
|
219
|
+
|
|
220
|
+
<template>
|
|
221
|
+
<svg viewBox="0 0 100 100">
|
|
222
|
+
<path ref="shape" d="M 50 15 C 78 8, 95 28, 90 52 C 85 76, 68 90, 50 88 C 32 90, 15 76, 10 52 C 5 28, 22 8, 50 15 Z" />
|
|
223
|
+
<path ref="t-circle" d="M 50 10 C 72 10, 90 28, 90 50 C 90 72, 72 90, 50 90 C 28 90, 10 72, 10 50 C 10 28, 28 10, 50 10 Z" visibility="hidden" />
|
|
224
|
+
<path ref="t-diamond" d="M 50 5 C 54 32, 68 32, 95 50 C 68 68, 54 68, 50 95 C 46 68, 32 68, 5 50 C 32 32, 46 32, 50 5 Z" visibility="hidden" />
|
|
225
|
+
</svg>
|
|
226
|
+
</template>
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
### `useSvgDrawable`
|
|
230
|
+
|
|
231
|
+
```vue
|
|
232
|
+
<script setup lang="ts">
|
|
233
|
+
import { useTemplateRef } from 'vue'
|
|
234
|
+
import { useAnimate, useSvgDrawable } from '@juleshry/vue-animejs'
|
|
235
|
+
|
|
236
|
+
const circle_el = useTemplateRef<SVGCircleElement>('circle')
|
|
237
|
+
|
|
238
|
+
const { drawable } = useSvgDrawable(circle_el)
|
|
239
|
+
|
|
240
|
+
// draw values are normalised: 0 = hidden, 1 = fully drawn
|
|
241
|
+
useAnimate(drawable, {
|
|
242
|
+
draw: ['0 0', '0.5 1', '0 1'],
|
|
243
|
+
duration: 1200,
|
|
244
|
+
easing: 'easeInOutQuad',
|
|
245
|
+
})
|
|
246
|
+
</script>
|
|
247
|
+
|
|
248
|
+
<template>
|
|
249
|
+
<svg viewBox="0 0 100 100">
|
|
250
|
+
<circle ref="circle" cx="50" cy="50" r="40" fill="none" stroke="currentColor" stroke-width="4" />
|
|
251
|
+
</svg>
|
|
252
|
+
</template>
|
|
253
|
+
```
|
|
254
|
+
|
|
151
255
|
### `useDraggable`
|
|
152
256
|
|
|
153
257
|
```vue
|
|
@@ -295,10 +399,10 @@ See the [Contributing Guide](./CONTRIBUTING.md).
|
|
|
295
399
|
## 🗺️ TODO
|
|
296
400
|
|
|
297
401
|
- [ ] Allow reactive refs inside option objects
|
|
298
|
-
- [ ]
|
|
299
|
-
- [ ]
|
|
300
|
-
- [ ]
|
|
402
|
+
- [ ] Finish doc website
|
|
403
|
+
- [ ] Add components
|
|
404
|
+
- [ ] Add directives
|
|
301
405
|
|
|
302
406
|
## 📄 License
|
|
303
407
|
|
|
304
|
-
[MIT](./LICENSE.md) © 2025-present [Jules Hery](https://github.com/juleshry)
|
|
408
|
+
[MIT](./LICENSE.md) © 2025-present [Jules Hery](https://github.com/juleshry)
|
|
@@ -1,8 +1,17 @@
|
|
|
1
|
-
import { type AnimatableObject, type AnimatableParams
|
|
1
|
+
import { type AnimatableObject, type AnimatableParams } from "animejs";
|
|
2
2
|
import { type DeepReadonly, type MaybeRef, type ShallowRef } from "vue";
|
|
3
|
+
import { type AnimationTargets } from "@src/utils/resolve-target.ts";
|
|
3
4
|
export interface UseAnimatableReturn {
|
|
5
|
+
/** The underlying Anime.js animatable instance. `undefined` until the target is available. */
|
|
4
6
|
animatable: DeepReadonly<ShallowRef<AnimatableObject | undefined>>;
|
|
7
|
+
/** Cancels the animatable and restores all animated properties to their original values. */
|
|
5
8
|
revert: () => AnimatableObject | undefined;
|
|
6
9
|
}
|
|
7
|
-
|
|
10
|
+
/**
|
|
11
|
+
* Wraps Anime.js `createAnimatable()` into a Vue composable. Reactively re-creates the animatable when the target or options change, and reverts it automatically on unmount.
|
|
12
|
+
*
|
|
13
|
+
* @param targets - The element(s) to make animatable. Accepts a template ref, a CSS selector, a DOM element, or a reactive ref to any of these.
|
|
14
|
+
* @param options - Anime.js animatable parameters. Accepts a plain object or a reactive ref / computed. Defaults to `{}`.
|
|
15
|
+
*/
|
|
16
|
+
export declare function useAnimatable(targets: AnimationTargets, options?: MaybeRef<AnimatableParams>): UseAnimatableReturn;
|
|
8
17
|
//# sourceMappingURL=use-animatable.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-animatable.d.ts","sourceRoot":"","sources":["../../src/composables/use-animatable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,gBAAgB,EAAE,KAAK,gBAAgB,
|
|
1
|
+
{"version":3,"file":"use-animatable.d.ts","sourceRoot":"","sources":["../../src/composables/use-animatable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,gBAAgB,EAAE,KAAK,gBAAgB,EAAuC,MAAM,SAAS,CAAA;AAC3G,OAAO,EAEL,KAAK,YAAY,EAEjB,KAAK,QAAQ,EAEb,KAAK,UAAU,EAIhB,MAAM,KAAK,CAAA;AAEZ,OAAO,EAAE,KAAK,gBAAgB,EAAiB,MAAM,8BAA8B,CAAA;AAEnF,MAAM,WAAW,mBAAmB;IAClC,8FAA8F;IAC9F,UAAU,EAAE,YAAY,CAAC,UAAU,CAAC,gBAAgB,GAAG,SAAS,CAAC,CAAC,CAAA;IAClE,4FAA4F;IAC5F,MAAM,EAAE,MAAM,gBAAgB,GAAG,SAAS,CAAA;CAC3C;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAC3B,OAAO,EAAE,gBAAgB,EACzB,OAAO,GAAE,QAAQ,CAAC,gBAAgB,CAAM,GACvC,mBAAmB,CAkCrB"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type DeepReadonly, type MaybeRef, type ShallowRef } from "vue";
|
|
2
|
-
import { type JSAnimation, type
|
|
3
|
-
import { type
|
|
2
|
+
import { type JSAnimation, type AnimationParams } from "animejs";
|
|
3
|
+
import { type AnimationTargets } from "@src/utils/resolve-target.ts";
|
|
4
4
|
export interface UseAnimateReturn {
|
|
5
5
|
/** The underlying Anime.js animation instance. `undefined` until the target is available. */
|
|
6
6
|
animation: DeepReadonly<ShallowRef<JSAnimation | undefined>>;
|
|
@@ -37,5 +37,5 @@ export interface UseAnimateReturn {
|
|
|
37
37
|
* @param _target - The element(s) to animate. Accepts a template ref, a CSS selector, a DOM element, or a reactive ref to any of these.
|
|
38
38
|
* @param _options - Anime.js animation parameters. Accepts a plain object or a reactive ref / computed. Defaults to `{}`.
|
|
39
39
|
*/
|
|
40
|
-
export declare function useAnimate(_target:
|
|
40
|
+
export declare function useAnimate(_target: AnimationTargets, _options?: MaybeRef<AnimationParams>): UseAnimateReturn;
|
|
41
41
|
//# sourceMappingURL=use-animate.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-animate.d.ts","sourceRoot":"","sources":["../../src/composables/use-animate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAAE,KAAK,QAAQ,EAAE,KAAK,UAAU,EAA6C,MAAM,KAAK,CAAA;AAClH,OAAO,EAAE,KAAK,WAAW,
|
|
1
|
+
{"version":3,"file":"use-animate.d.ts","sourceRoot":"","sources":["../../src/composables/use-animate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAAE,KAAK,QAAQ,EAAE,KAAK,UAAU,EAA6C,MAAM,KAAK,CAAA;AAClH,OAAO,EAAE,KAAK,WAAW,EAA8B,KAAK,eAAe,EAAE,MAAM,SAAS,CAAA;AAE5F,OAAO,EAAE,KAAK,gBAAgB,EAAiB,MAAM,8BAA8B,CAAA;AAEnF,MAAM,WAAW,gBAAgB;IAC/B,6FAA6F;IAC7F,SAAS,EAAE,YAAY,CAAC,UAAU,CAAC,WAAW,GAAG,SAAS,CAAC,CAAC,CAAA;IAC5D,uCAAuC;IACvC,IAAI,EAAE,MAAM,WAAW,GAAG,SAAS,CAAA;IACnC,mCAAmC;IACnC,OAAO,EAAE,MAAM,WAAW,GAAG,SAAS,CAAA;IACtC,oDAAoD;IACpD,KAAK,EAAE,MAAM,WAAW,GAAG,SAAS,CAAA;IACpC,iDAAiD;IACjD,OAAO,EAAE,MAAM,WAAW,GAAG,SAAS,CAAA;IACtC,qDAAqD;IACrD,SAAS,EAAE,MAAM,WAAW,GAAG,SAAS,CAAA;IACxC,mCAAmC;IACnC,MAAM,EAAE,MAAM,WAAW,GAAG,SAAS,CAAA;IACrC,qDAAqD;IACrD,QAAQ,EAAE,MAAM,WAAW,GAAG,SAAS,CAAA;IACvC,mEAAmE;IACnE,MAAM,EAAE,MAAM,WAAW,GAAG,SAAS,CAAA;IACrC,2FAA2F;IAC3F,MAAM,EAAE,MAAM,WAAW,GAAG,SAAS,CAAA;IACrC,gHAAgH;IAChH,KAAK,EAAE,CAAC,SAAS,CAAC,EAAE,OAAO,KAAK,WAAW,GAAG,SAAS,CAAA;IACvD,wCAAwC;IACxC,IAAI,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,aAAa,CAAC,EAAE,OAAO,GAAG,MAAM,EAAE,cAAc,CAAC,EAAE,OAAO,GAAG,MAAM,KAAK,WAAW,GAAG,SAAS,CAAA;IACpH,sDAAsD;IACtD,OAAO,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,WAAW,GAAG,SAAS,CAAA;IACzD,uEAAuE;IACvE,OAAO,EAAE,MAAM,WAAW,GAAG,SAAS,CAAA;CACvC;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,gBAAgB,EAAE,QAAQ,GAAE,QAAQ,CAAC,eAAe,CAAM,GAAG,gBAAgB,CAgGhH"}
|
|
@@ -1,17 +1,35 @@
|
|
|
1
1
|
import { type DeepReadonly, type MaybeRef, type ShallowRef } from "vue";
|
|
2
|
-
import { type Draggable, type DraggableParams, type
|
|
2
|
+
import { type Draggable, type DraggableParams, type EasingParam } from "animejs";
|
|
3
|
+
import { type AnimationTargets } from "@src/utils/resolve-target.ts";
|
|
3
4
|
export interface UseDraggableReturn {
|
|
5
|
+
/** The underlying Anime.js draggable instance. `undefined` until the target is available. */
|
|
4
6
|
draggable: DeepReadonly<ShallowRef<Draggable | undefined>>;
|
|
7
|
+
/** Disables drag interactions without destroying the instance. */
|
|
5
8
|
disable: () => void;
|
|
9
|
+
/** Re-enables drag interactions after `disable()`. */
|
|
6
10
|
enable: () => void;
|
|
11
|
+
/** Moves the draggable to the given x position. Pass `true` to suppress the update callback. */
|
|
7
12
|
setX: (x: number, muteUpdateCallback?: boolean) => void;
|
|
13
|
+
/** Moves the draggable to the given y position. Pass `true` to suppress the update callback. */
|
|
8
14
|
setY: (y: number, muteUpdateCallback?: boolean) => void;
|
|
15
|
+
/** Animates the draggable into the visible viewport. */
|
|
9
16
|
animateInView: (duration?: number, gap?: number, ease?: EasingParam) => void;
|
|
17
|
+
/** Scrolls the draggable into the visible viewport. */
|
|
10
18
|
scrollInView: (duration?: number, gap?: number, ease?: EasingParam) => void;
|
|
19
|
+
/** Stops any in-progress snap or momentum animation. */
|
|
11
20
|
stop: () => void;
|
|
21
|
+
/** Resets the draggable position to its initial state. */
|
|
12
22
|
reset: () => void;
|
|
23
|
+
/** Cancels the draggable and restores the element to its original state. */
|
|
13
24
|
revert: () => void;
|
|
25
|
+
/** Re-reads the element's size and container bounds. */
|
|
14
26
|
refresh: () => void;
|
|
15
27
|
}
|
|
16
|
-
|
|
28
|
+
/**
|
|
29
|
+
* Wraps Anime.js `createDraggable()` into a Vue composable. Reactively re-creates the draggable when the target or options change, and reverts it automatically on unmount.
|
|
30
|
+
*
|
|
31
|
+
* @param targets - The element(s) to make draggable. Accepts a template ref, a CSS selector, a DOM element, or a reactive ref to any of these.
|
|
32
|
+
* @param options - Anime.js draggable parameters. Accepts a plain object or a reactive ref / computed. Defaults to `{}`.
|
|
33
|
+
*/
|
|
34
|
+
export declare function useDraggable(targets: AnimationTargets, options?: MaybeRef<DraggableParams>): UseDraggableReturn;
|
|
17
35
|
//# sourceMappingURL=use-draggable.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-draggable.d.ts","sourceRoot":"","sources":["../../src/composables/use-draggable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAAS,KAAK,QAAQ,EAAY,KAAK,UAAU,EAA4B,MAAM,KAAK,CAAA;AAElH,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,eAAe,
|
|
1
|
+
{"version":3,"file":"use-draggable.d.ts","sourceRoot":"","sources":["../../src/composables/use-draggable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,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Q,CAAC,eAAe,CAAM,GAAG,kBAAkB,CA6EnH"}
|
|
@@ -2,11 +2,22 @@ import { type MaybeComputedElementRef } from "@vueuse/core";
|
|
|
2
2
|
import { type AutoLayout, type AutoLayoutParams, type DOMTargetSelector, type LayoutAnimationParams, type Timeline } from "animejs";
|
|
3
3
|
import { type DeepReadonly, type MaybeRef, type ShallowRef } from "vue";
|
|
4
4
|
export interface UseLayoutReturn {
|
|
5
|
+
/** The underlying Anime.js `AutoLayout` instance. `undefined` until the root element is available. */
|
|
5
6
|
layout: DeepReadonly<ShallowRef<AutoLayout | undefined>>;
|
|
7
|
+
/** Snapshots the current positions of all tracked children so the next layout change can be animated. */
|
|
6
8
|
record: () => void;
|
|
9
|
+
/** Animates all children from their recorded positions to their new positions. */
|
|
7
10
|
animate: (params?: LayoutAnimationParams) => Timeline | undefined;
|
|
11
|
+
/** Records, applies the callback (which triggers a layout change), then animates the transition. */
|
|
8
12
|
update: (callback: (layout: AutoLayout) => void, params?: LayoutAnimationParams) => void;
|
|
13
|
+
/** Cancels the layout watcher and restores all elements to their original state. */
|
|
9
14
|
revert: () => void;
|
|
10
15
|
}
|
|
11
|
-
|
|
16
|
+
/**
|
|
17
|
+
* Wraps Anime.js `createLayout()` into a Vue composable. Reactively re-creates the layout observer when the root element or params change, and reverts it automatically on unmount.
|
|
18
|
+
*
|
|
19
|
+
* @param root - The container element whose children will be tracked. Accepts a template ref, a CSS selector, or a reactive ref to either.
|
|
20
|
+
* @param params - Anime.js auto-layout parameters. Accepts a plain object or a reactive ref / computed.
|
|
21
|
+
*/
|
|
22
|
+
export declare function useLayout(root: MaybeRef<DOMTargetSelector> | MaybeComputedElementRef, params?: MaybeRef<AutoLayoutParams>): UseLayoutReturn;
|
|
12
23
|
//# sourceMappingURL=use-layout.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-layout.d.ts","sourceRoot":"","sources":["../../src/composables/use-layout.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,uBAAuB,
|
|
1
|
+
{"version":3,"file":"use-layout.d.ts","sourceRoot":"","sources":["../../src/composables/use-layout.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,uBAAuB,EAAkB,MAAM,cAAc,CAAA;AAE3E,OAAO,EACL,KAAK,UAAU,EACf,KAAK,gBAAgB,EAErB,KAAK,iBAAiB,EACtB,KAAK,qBAAqB,EAC1B,KAAK,QAAQ,EACd,MAAM,SAAS,CAAA;AAChB,OAAO,EAAE,KAAK,YAAY,EAAS,KAAK,QAAQ,EAAY,KAAK,UAAU,EAA4B,MAAM,KAAK,CAAA;AAElH,MAAM,WAAW,eAAe;IAC9B,sGAAsG;IACtG,MAAM,EAAE,YAAY,CAAC,UAAU,CAAC,UAAU,GAAG,SAAS,CAAC,CAAC,CAAA;IACxD,yGAAyG;IACzG,MAAM,EAAE,MAAM,IAAI,CAAA;IAClB,kFAAkF;IAClF,OAAO,EAAE,CAAC,MAAM,CAAC,EAAE,qBAAqB,KAAK,QAAQ,GAAG,SAAS,CAAA;IACjE,oGAAoG;IACpG,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,MAAM,EAAE,UAAU,KAAK,IAAI,EAAE,MAAM,CAAC,EAAE,qBAAqB,KAAK,IAAI,CAAA;IACxF,oFAAoF;IACpF,MAAM,EAAE,MAAM,IAAI,CAAA;CACnB;AAED;;;;;GAKG;AACH,wBAAgB,SAAS,CACvB,IAAI,EAAE,QAAQ,CAAC,iBAAiB,CAAC,GAAG,uBAAuB,EAC3D,MAAM,GAAE,QAAQ,CAAC,gBAAgB,CAAM,GACtC,eAAe,CAyCjB"}
|
|
@@ -1,7 +1,14 @@
|
|
|
1
|
-
import { AnimationParams,
|
|
2
|
-
import { MaybeRef } from "vue";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { type AnimationParams, type JSAnimation } from "animejs";
|
|
2
|
+
import { type MaybeRef } from "vue";
|
|
3
|
+
import { type AnimationTargets } from "@src/utils/resolve-target.ts";
|
|
4
|
+
/** The Anime.js `JSAnimation` instance returned by `useRawAnimate`. */
|
|
5
|
+
export type UseRawAnimateReturn = JSAnimation;
|
|
6
|
+
/**
|
|
7
|
+
* Thin wrapper around Anime.js `animate()`. Resolves the target (unwrapping refs and Vue component
|
|
8
|
+
* refs via `.$el`) and immediately starts the animation.
|
|
9
|
+
*
|
|
10
|
+
* @param _target - The element(s) to animate. Accepts a template ref, a Vue component ref, a CSS selector, a DOM element, or a reactive ref to any of these.
|
|
11
|
+
* @param _options - Anime.js animation parameters. Accepts a plain object or a reactive ref / computed. Defaults to `{}`.
|
|
12
|
+
*/
|
|
13
|
+
export declare function useRawAnimate(_target: AnimationTargets, _options?: MaybeRef<AnimationParams>): UseRawAnimateReturn;
|
|
7
14
|
//# sourceMappingURL=use-raw-animate.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-raw-animate.d.ts","sourceRoot":"","sources":["../../src/composables/use-raw-animate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,eAAe,EAAE,
|
|
1
|
+
{"version":3,"file":"use-raw-animate.d.ts","sourceRoot":"","sources":["../../src/composables/use-raw-animate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,KAAK,eAAe,EAAE,KAAK,WAAW,EAAE,MAAM,SAAS,CAAA;AACzE,OAAO,EAAE,KAAK,QAAQ,EAAS,MAAM,KAAK,CAAA;AAC1C,OAAO,EAAE,KAAK,gBAAgB,EAAiB,MAAM,8BAA8B,CAAA;AAEnF,uEAAuE;AACvE,MAAM,MAAM,mBAAmB,GAAG,WAAW,CAAA;AAE7C;;;;;;GAMG;AACH,wBAAgB,aAAa,CAC3B,OAAO,EAAE,gBAAgB,EACzB,QAAQ,GAAE,QAAQ,CAAC,eAAe,CAAM,GACvC,mBAAmB,CAQrB"}
|
|
@@ -1,13 +1,27 @@
|
|
|
1
1
|
import { type Scope, type ScopeMethod, type ScopeParams, type Tickable } from "animejs";
|
|
2
2
|
import { type DeepReadonly, type MaybeRef, type ShallowRef } from "vue";
|
|
3
3
|
export interface UseScopeReturn {
|
|
4
|
+
/** The underlying Anime.js `Scope` instance. */
|
|
4
5
|
scope: DeepReadonly<ShallowRef<Scope>>;
|
|
6
|
+
/** Registers an anonymous method on the scope. Queued automatically if called before mount. */
|
|
5
7
|
add: (method: ScopeMethod) => void;
|
|
8
|
+
/** Registers a named method on the scope so it can be called via `scope.methods[name]()`. Queued automatically if called before mount. */
|
|
6
9
|
registerMethod: (methodName: string, method: ScopeMethod) => void;
|
|
10
|
+
/** Registers a method that runs exactly once on the scope. Queued automatically if called before mount. */
|
|
7
11
|
addOnce: (method: ScopeMethod) => void;
|
|
12
|
+
/** Keeps the time of another tickable (animation, timer) in sync with this scope. */
|
|
8
13
|
keepTime: (method: (scope: Scope) => Tickable) => void;
|
|
14
|
+
/** Cancels the scope and reverts all animations and tickables it owns. */
|
|
9
15
|
revert: () => void;
|
|
16
|
+
/** Re-reads default values and media-query breakpoints for the scope. */
|
|
10
17
|
refresh: () => void;
|
|
11
18
|
}
|
|
19
|
+
/**
|
|
20
|
+
* Wraps Anime.js `createScope()` into a Vue composable. Reactively re-creates the scope when params change, replays all registered methods, and reverts it automatically on unmount.
|
|
21
|
+
*
|
|
22
|
+
* Methods added before mount are queued and replayed once the component is mounted.
|
|
23
|
+
*
|
|
24
|
+
* @param params - Anime.js scope parameters. Accepts a plain object or a reactive ref / computed.
|
|
25
|
+
*/
|
|
12
26
|
export declare function useScope(params: MaybeRef<ScopeParams>): UseScopeReturn;
|
|
13
27
|
//# sourceMappingURL=use-scope.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-scope.d.ts","sourceRoot":"","sources":["../../src/composables/use-scope.ts"],"names":[],"mappings":"AACA,OAAO,EAAe,KAAK,KAAK,EAAE,KAAK,WAAW,EAAE,KAAK,WAAW,EAAE,KAAK,QAAQ,EAAE,MAAM,SAAS,CAAA;AAC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G,OAAO,EAAE,CAAC,MAAM,EAAE,WAAW,KAAK,IAAI,CAAA;IACtC,qFAAqF;IACrF,QAAQ,EAAE,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,QAAQ,KAAK,IAAI,CAAA;IACtD,0EAA0E;IAC1E,MAAM,EAAE,MAAM,IAAI,CAAA;IAClB,yEAAyE;IACzE,OAAO,EAAE,MAAM,IAAI,CAAA;CACpB;AAED;;;;;;GAMG;AACH,wBAAgB,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,WAAW,CAAC,GAAG,cAAc,CAyEtE"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type DrawableSVGGeometry, type DOMTargetSelector } from "animejs";
|
|
2
|
+
import { type MaybeComputedElementRef } from "@vueuse/core";
|
|
3
|
+
import { type MaybeRef, type DeepReadonly, type ShallowRef } from "vue";
|
|
4
|
+
export interface UseSvgDrawableReturn {
|
|
5
|
+
/**
|
|
6
|
+
* The Anime.js drawable Proxy for the target element. `undefined` until the element is available.
|
|
7
|
+
* Pass this ref — not the original template ref — as the `useAnimate` target to animate the `draw` property.
|
|
8
|
+
*/
|
|
9
|
+
drawable: DeepReadonly<ShallowRef<DrawableSVGGeometry | undefined>>;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Wraps an SVG geometry element in Anime.js's drawable Proxy. The proxy intercepts `setAttribute('draw', …)` calls and translates normalised `draw` values (`0`–`1`) into the correct `stroke-dasharray` / `stroke-dashoffset` updates. Pass the returned `drawable` ref as the target to `useAnimate`.
|
|
13
|
+
*
|
|
14
|
+
* @param target - The SVG element to make drawable. Accepts a template ref, a CSS selector, or a reactive ref to either.
|
|
15
|
+
* @param start - Initial draw start position (`0`–`1`). Defaults to `0`.
|
|
16
|
+
* @param end - Initial draw end position (`0`–`1`). Defaults to `0` (fully hidden).
|
|
17
|
+
*/
|
|
18
|
+
export declare function useSvgDrawable(target: MaybeRef<DOMTargetSelector> | MaybeComputedElementRef, start?: MaybeRef<number>, end?: MaybeRef<number>): UseSvgDrawableReturn;
|
|
19
|
+
//# sourceMappingURL=use-svg-drawable.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-svg-drawable.d.ts","sourceRoot":"","sources":["../../src/composables/use-svg-drawable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,KAAK,mBAAmB,EAAE,KAAK,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAC/E,OAAO,EAAE,KAAK,uBAAuB,EAAkB,MAAM,cAAc,CAAA;AAC3E,OAAO,EAAS,KAAK,QAAQ,EAAY,KAAK,YAAY,EAAE,KAAK,UAAU,EAA4B,MAAM,KAAK,CAAA;AAGlH,MAAM,WAAW,oBAAoB;IACnC;;;OAGG;IACH,QAAQ,EAAE,YAAY,CAAC,UAAU,CAAC,mBAAmB,GAAG,SAAS,CAAC,CAAC,CAAA;CACpE;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAC5B,MAAM,EAAE,QAAQ,CAAC,iBAAiB,CAAC,GAAG,uBAAuB,EAC7D,KAAK,GAAE,QAAQ,CAAC,MAAM,CAAK,EAC3B,GAAG,GAAE,QAAQ,CAAC,MAAM,CAAK,GACxB,oBAAoB,CAsBtB"}
|
|
@@ -1,9 +1,15 @@
|
|
|
1
|
-
import { type TargetsParam } from "animejs";
|
|
1
|
+
import { svg, type FunctionValue, type TargetsParam } from "animejs";
|
|
2
2
|
import { type MaybeRef } from "vue";
|
|
3
3
|
export interface UseSvgReturn {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
/** Returns a `FunctionValue` that morphs the current path to the given `path`. Pass the result as the `d` property in `useAnimate` options. */
|
|
5
|
+
morphTo: (path: MaybeRef<TargetsParam>, precision?: MaybeRef<number>) => FunctionValue;
|
|
6
|
+
/** Creates a motion-path object from an SVG `<path>`. Spread the result into `useAnimate` options to animate `translateX`, `translateY`, and `rotate` along the path. */
|
|
7
|
+
createMotionPath: (path: MaybeRef<TargetsParam | null>, offset?: MaybeRef<number>) => ReturnType<typeof svg.createMotionPath>;
|
|
7
8
|
}
|
|
9
|
+
/**
|
|
10
|
+
* Exposes Anime.js SVG utilities (`svg.morphTo`, `svg.createMotionPath`) as a Vue composable, automatically unwrapping reactive refs passed to each helper.
|
|
11
|
+
*
|
|
12
|
+
* For drawable stroke animations, use `useSvgDrawable` instead.
|
|
13
|
+
*/
|
|
8
14
|
export declare function useSvg(): UseSvgReturn;
|
|
9
15
|
//# sourceMappingURL=use-svg.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-svg.d.ts","sourceRoot":"","sources":["../../src/composables/use-svg.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"use-svg.d.ts","sourceRoot":"","sources":["../../src/composables/use-svg.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,KAAK,aAAa,EAAE,KAAK,YAAY,EAAE,MAAM,SAAS,CAAA;AACpE,OAAO,EAAE,KAAK,QAAQ,EAAS,MAAM,KAAK,CAAA;AAE1C,MAAM,WAAW,YAAY;IAC3B,+IAA+I;IAC/I,OAAO,EAAE,CAAC,IAAI,EAAE,QAAQ,CAAC,YAAY,CAAC,EAAE,SAAS,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,KAAK,aAAa,CAAA;IACtF,yKAAyK;IACzK,gBAAgB,EAAE,CAChB,IAAI,EAAE,QAAQ,CAAC,YAAY,GAAG,IAAI,CAAC,EACnC,MAAM,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,KACtB,UAAU,CAAC,OAAO,GAAG,CAAC,gBAAgB,CAAC,CAAA;CAC7C;AAED;;;;GAIG;AACH,wBAAgB,MAAM,IAAI,YAAY,CAkBrC"}
|
|
@@ -2,12 +2,24 @@ import { type TextSplitter, type TextSplitterParams } from "animejs";
|
|
|
2
2
|
import { type MaybeComputedElementRef } from "@vueuse/core";
|
|
3
3
|
import { type ComputedRef, type DeepReadonly, type MaybeRef, type ShallowRef } from "vue";
|
|
4
4
|
export interface UseTextReturn {
|
|
5
|
+
/** The underlying Anime.js `TextSplitter` instance. `undefined` until the target is available. */
|
|
5
6
|
splitter: DeepReadonly<ShallowRef<TextSplitter | undefined>>;
|
|
7
|
+
/** Reactive array of `<span>` elements representing each line after splitting. */
|
|
6
8
|
lines: ComputedRef<HTMLElement[]>;
|
|
9
|
+
/** Reactive array of `<span>` elements representing each word after splitting. */
|
|
7
10
|
words: ComputedRef<HTMLElement[]>;
|
|
11
|
+
/** Reactive array of `<span>` elements representing each character after splitting. */
|
|
8
12
|
chars: ComputedRef<HTMLElement[]>;
|
|
13
|
+
/** Removes all split `<span>` wrappers and restores the original text content. */
|
|
9
14
|
revert: () => void;
|
|
15
|
+
/** Re-splits the text, updating `lines`, `words`, and `chars` to reflect any DOM or size changes. */
|
|
10
16
|
refresh: () => void;
|
|
11
17
|
}
|
|
18
|
+
/**
|
|
19
|
+
* Wraps Anime.js `splitText()` into a Vue composable. Reactively re-splits the text when the target or params change, and reverts the DOM automatically on unmount.
|
|
20
|
+
*
|
|
21
|
+
* @param _target - The element(s) whose text content should be split. Accepts a template ref, a CSS selector, a DOM element, or a reactive ref to any of these.
|
|
22
|
+
* @param _params - Anime.js text-splitter parameters. Accepts a plain object or a reactive ref / computed.
|
|
23
|
+
*/
|
|
12
24
|
export declare function useText(_target: MaybeRef<HTMLElement | NodeList | string | HTMLElement[]> | MaybeComputedElementRef, _params?: MaybeRef<TextSplitterParams>): UseTextReturn;
|
|
13
25
|
//# sourceMappingURL=use-text.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-text.d.ts","sourceRoot":"","sources":["../../src/composables/use-text.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,KAAK,YAAY,EAAE,KAAK,kBAAkB,EAAE,MAAM,SAAS,CAAA;AAC/E,OAAO,EAAE,KAAK,uBAAuB,
|
|
1
|
+
{"version":3,"file":"use-text.d.ts","sourceRoot":"","sources":["../../src/composables/use-text.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,KAAK,YAAY,EAAE,KAAK,kBAAkB,EAAE,MAAM,SAAS,CAAA;AAC/E,OAAO,EAAE,KAAK,uBAAuB,EAAkB,MAAM,cAAc,CAAA;AAE3E,OAAO,EAOL,KAAK,WAAW,EAChB,KAAK,YAAY,EACjB,KAAK,QAAQ,EACb,KAAK,UAAU,EAChB,MAAM,KAAK,CAAA;AAEZ,MAAM,WAAW,aAAa;IAC5B,kGAAkG;IAClG,QAAQ,EAAE,YAAY,CAAC,UAAU,CAAC,YAAY,GAAG,SAAS,CAAC,CAAC,CAAA;IAC5D,kFAAkF;IAClF,KAAK,EAAE,WAAW,CAAC,WAAW,EAAE,CAAC,CAAA;IACjC,kFAAkF;IAClF,KAAK,EAAE,WAAW,CAAC,WAAW,EAAE,CAAC,CAAA;IACjC,uFAAuF;IACvF,KAAK,EAAE,WAAW,CAAC,WAAW,EAAE,CAAC,CAAA;IACjC,kFAAkF;IAClF,MAAM,EAAE,MAAM,IAAI,CAAA;IAClB,qGAAqG;IACrG,OAAO,EAAE,MAAM,IAAI,CAAA;CACpB;AAED;;;;;GAKG;AACH,wBAAgB,OAAO,CACrB,OAAO,EAAE,QAAQ,CAAC,WAAW,GAAG,QAAQ,GAAG,MAAM,GAAG,WAAW,EAAE,CAAC,GAAG,uBAAuB,EAC5F,OAAO,CAAC,EAAE,QAAQ,CAAC,kBAAkB,CAAC,GACrC,aAAa,CA0Cf"}
|
|
@@ -1,22 +1,23 @@
|
|
|
1
|
-
import { type MaybeRef, type ShallowRef, type DeepReadonly } from "vue";
|
|
2
|
-
import { type AnimationParams, type Callback, type StaggerFunction, type
|
|
1
|
+
import { type MaybeRef, type MaybeRefOrGetter, type ShallowRef, type DeepReadonly } from "vue";
|
|
2
|
+
import { type AnimationParams, type Callback, type StaggerFunction, type Tickable, type Timeline, type TimelineParams, type TimelinePosition, type Timer } from "animejs";
|
|
3
|
+
import { type AnimationTargets } from "@src/utils/resolve-target.ts";
|
|
3
4
|
export type TimelineChain = Timeline & {
|
|
4
5
|
/** Adds an animation to the timeline and returns a chainable object. */
|
|
5
|
-
add: (targets:
|
|
6
|
+
add: (targets: AnimationTargets, params: MaybeRefOrGetter<AnimationParams>, position?: TimelinePosition | StaggerFunction<number | string>) => TimelineChain;
|
|
6
7
|
/** Sets a property to a value at a point in the timeline without animating it, then returns a chainable object. */
|
|
7
|
-
set: (targets:
|
|
8
|
+
set: (targets: AnimationTargets, params: MaybeRefOrGetter<AnimationParams>, position?: TimelinePosition) => TimelineChain;
|
|
8
9
|
/** Removes an animation target (or a specific property) from the timeline and returns a chainable object. */
|
|
9
|
-
remove: (targets:
|
|
10
|
+
remove: (targets: AnimationTargets, propertyName?: string) => TimelineChain;
|
|
10
11
|
};
|
|
11
12
|
export interface UseTimelineReturn {
|
|
12
13
|
/** The underlying Anime.js timeline instance. */
|
|
13
14
|
timeline: DeepReadonly<ShallowRef<Timeline>>;
|
|
14
15
|
/** Adds an animation to the timeline. Accepts a template ref or any valid Anime.js target. Returns a chainable object. */
|
|
15
|
-
add: (targets:
|
|
16
|
+
add: (targets: AnimationTargets, params: MaybeRefOrGetter<AnimationParams>, position?: TimelinePosition | StaggerFunction<number | string>) => TimelineChain;
|
|
16
17
|
/** Sets a property to a value at a point in the timeline without animating it. Returns a chainable object. */
|
|
17
|
-
set: (targets:
|
|
18
|
+
set: (targets: AnimationTargets, params: MaybeRefOrGetter<AnimationParams>, position?: TimelinePosition) => TimelineChain;
|
|
18
19
|
/** Removes an animation target (or a specific property) from the timeline. Returns a chainable object. */
|
|
19
|
-
remove: (targets:
|
|
20
|
+
remove: (targets: AnimationTargets, propertyName?: string) => TimelineChain;
|
|
20
21
|
/** Synchronises another tickable (animation, timer) into the timeline at the given position. */
|
|
21
22
|
sync: (synced?: Tickable, position?: TimelinePosition) => Timeline;
|
|
22
23
|
/** Adds a named label at a position so it can be referenced by `.add()` or `.seek()`. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-timeline.d.ts","sourceRoot":"","sources":["../../src/composables/use-timeline.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"use-timeline.d.ts","sourceRoot":"","sources":["../../src/composables/use-timeline.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,QAAQ,EACb,KAAK,gBAAgB,EACrB,KAAK,UAAU,EAKf,KAAK,YAAY,EAElB,MAAM,KAAK,CAAA;AACZ,OAAO,EACL,KAAK,eAAe,EACpB,KAAK,QAAQ,EAEb,KAAK,eAAe,EACpB,KAAK,QAAQ,EACb,KAAK,QAAQ,EACb,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACrB,KAAK,KAAK,EACX,MAAM,SAAS,CAAA;AAEhB,OAAO,EAAE,KAAK,gBAAgB,EAAiB,MAAM,8BAA8B,CAAA;AAWnF,MAAM,MAAM,aAAa,GAAG,QAAQ,GAAG;IACrC,wEAAwE;IACxE,GAAG,EAAE,CACH,OAAO,EAAE,gBAAgB,EACzB,MAAM,EAAE,gBAAgB,CAAC,eAAe,CAAC,EACzC,QAAQ,CAAC,EAAE,gBAAgB,GAAG,eAAe,CAAC,MAAM,GAAG,MAAM,CAAC,KAC3D,aAAa,CAAA;IAClB,mHAAmH;IACnH,GAAG,EAAE,CACH,OAAO,EAAE,gBAAgB,EACzB,MAAM,EAAE,gBAAgB,CAAC,eAAe,CAAC,EACzC,QAAQ,CAAC,EAAE,gBAAgB,KACxB,aAAa,CAAA;IAClB,6GAA6G;IAC7G,MAAM,EAAE,CAAC,OAAO,EAAE,gBAAgB,EAAE,YAAY,CAAC,EAAE,MAAM,KAAK,aAAa,CAAA;CAC5E,CAAA;AAED,MAAM,WAAW,iBAAiB;IAChC,iDAAiD;IACjD,QAAQ,EAAE,YAAY,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAA;IAC5C,0HAA0H;IAC1H,GAAG,EAAE,CACH,O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,+GAA+G;IAC/G,KAAK,EAAE,CAAC,SAAS,CAAC,EAAE,OAAO,KAAK,QAAQ,CAAA;IACxC,kEAAkE;IAClE,MAAM,EAAE,MAAM,QAAQ,CAAA;IACtB,0FAA0F;IAC1F,MAAM,EAAE,MAAM,QAAQ,CAAA;IACtB,wCAAwC;IACxC,IAAI,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,aAAa,CAAC,EAAE,OAAO,GAAG,MAAM,EAAE,cAAc,CAAC,EAAE,OAAO,GAAG,MAAM,KAAK,QAAQ,CAAA;IACrG,qDAAqD;IACrD,OAAO,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,QAAQ,CAAA;IAC1C,2EAA2E;IAC3E,OAAO,EAAE,MAAM,QAAQ,CAAA;CACxB;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,OAAO,GAAE,QAAQ,CAAC,cAAc,CAAM,GAAG,iBAAiB,CA2KrF"}
|
|
@@ -1,19 +1,37 @@
|
|
|
1
1
|
import { type Timer, type TimerParams } from "animejs";
|
|
2
2
|
import { type MaybeRef, type ShallowRef, type DeepReadonly } from "vue";
|
|
3
3
|
export interface UseTimerReturn {
|
|
4
|
+
/** The underlying Anime.js timer instance. */
|
|
4
5
|
timer: DeepReadonly<ShallowRef<Timer>>;
|
|
6
|
+
/** Starts or resumes the timer. */
|
|
5
7
|
play: () => Timer;
|
|
8
|
+
/** Reverses the timer's playback direction. */
|
|
6
9
|
reverse: () => Timer;
|
|
10
|
+
/** Pauses the timer at the current position. */
|
|
7
11
|
pause: () => Timer;
|
|
12
|
+
/** Restarts the timer from the beginning. */
|
|
8
13
|
restart: () => Timer;
|
|
14
|
+
/** Toggles between forward and reverse direction. */
|
|
9
15
|
alternate: () => Timer;
|
|
16
|
+
/** Resumes from a paused state. */
|
|
10
17
|
resume: () => Timer;
|
|
18
|
+
/** Jumps immediately to the end of the timer duration. */
|
|
11
19
|
complete: () => Timer;
|
|
20
|
+
/** Resets the timer to its initial state. Pass `true` for a soft reset that preserves the current cycle. */
|
|
12
21
|
reset: (softReset?: boolean) => Timer;
|
|
22
|
+
/** Stops the timer and removes it from the Anime.js engine. */
|
|
13
23
|
cancel: () => Timer;
|
|
24
|
+
/** Cancels the timer and restores any associated state to its original values. */
|
|
14
25
|
revert: () => Timer;
|
|
26
|
+
/** Seeks to a specific time (in ms). */
|
|
15
27
|
seek: (time: number, muteCallbacks?: boolean | number, internalRender?: boolean | number) => Timer;
|
|
28
|
+
/** Rescales the timer to a new total duration. */
|
|
16
29
|
stretch: (newDuration: number) => Timer;
|
|
17
30
|
}
|
|
31
|
+
/**
|
|
32
|
+
* Wraps Anime.js `createTimer()` into a Vue composable. Reactively re-creates the timer when options change, and cancels it automatically on unmount.
|
|
33
|
+
*
|
|
34
|
+
* @param options - Anime.js timer parameters. Accepts a plain object or a reactive ref / computed. Defaults to `{}`.
|
|
35
|
+
*/
|
|
18
36
|
export declare function useTimer(options?: MaybeRef<TimerParams>): UseTimerReturn;
|
|
19
37
|
//# sourceMappingURL=use-timer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-timer.d.ts","sourceRoot":"","sources":["../../src/composables/use-timer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,KAAK,KAAK,EAAE,KAAK,WAAW,EAAE,MAAM,SAAS,CAAA;AACnE,OAAO,EAAE,KAAK,QAAQ,EAAE,KAAK,UAAU,EAA4B,KAAK,YAAY,EAAY,MAAM,KAAK,CAAA;AAG3G,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,YAAY,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAA;IACtC,IAAI,EAAE,MAAM,KAAK,CAAA;IACjB,OAAO,EAAE,MAAM,KAAK,CAAA;IACpB,KAAK,EAAE,MAAM,KAAK,CAAA;IAClB,OAAO,EAAE,MAAM,KAAK,CAAA;IACpB,SAAS,EAAE,MAAM,KAAK,CAAA;IACtB,MAAM,EAAE,MAAM,KAAK,CAAA;IACn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AAC,EAAE,OAAO,KAAK,KAAK,CAAA;IACrC,+DAA+D;IAC/D,MAAM,EAAE,MAAM,KAAK,CAAA;IACnB,kFAAkF;IAClF,MAAM,EAAE,MAAM,KAAK,CAAA;IACnB,wCAAwC;IACxC,IAAI,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,aAAa,CAAC,EAAE,OAAO,GAAG,MAAM,EAAE,cAAc,CAAC,EAAE,OAAO,GAAG,MAAM,KAAK,KAAK,CAAA;IAClG,kDAAkD;IAClD,OAAO,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,KAAK,CAAA;CACxC;AAED;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,OAAO,GAAE,QAAQ,CAAC,WAAW,CAAM,GAAG,cAAc,CAgF5E"}
|
|
@@ -2,19 +2,38 @@ import { type MaybeComputedElementRef } from "@vueuse/core";
|
|
|
2
2
|
import { type WAAPIAnimationParams, type DOMTargetsParam, type WAAPIAnimation, type EasingFunction } from "animejs";
|
|
3
3
|
import { DeepReadonly, type MaybeRef, ShallowRef } from "vue";
|
|
4
4
|
export interface UseWaapiReturn {
|
|
5
|
+
/** The underlying Anime.js WAAPI animation instance. `undefined` until the target is available. */
|
|
5
6
|
animation: DeepReadonly<ShallowRef<WAAPIAnimation | undefined>>;
|
|
7
|
+
/** Resumes from a paused state. */
|
|
6
8
|
resume: () => WAAPIAnimation | undefined;
|
|
9
|
+
/** Pauses the animation at the current position. */
|
|
7
10
|
pause: () => WAAPIAnimation | undefined;
|
|
11
|
+
/** Toggles between forward and reverse direction. */
|
|
8
12
|
alternate: () => WAAPIAnimation | undefined;
|
|
13
|
+
/** Starts or resumes the animation. */
|
|
9
14
|
play: () => WAAPIAnimation | undefined;
|
|
15
|
+
/** Reverses playback direction. */
|
|
10
16
|
reverse: () => WAAPIAnimation | undefined;
|
|
17
|
+
/** Seeks to a specific time (in ms). Accepts a reactive ref for the time value. */
|
|
11
18
|
seek: (time: MaybeRef<number>, muteCallbacks?: MaybeRef<boolean>) => WAAPIAnimation | undefined;
|
|
19
|
+
/** Restarts the animation from the beginning. */
|
|
12
20
|
restart: () => WAAPIAnimation | undefined;
|
|
21
|
+
/** Commits the current animated styles to the element's inline style, then cancels the animation. */
|
|
13
22
|
commitStyles: () => WAAPIAnimation | undefined;
|
|
23
|
+
/** Jumps immediately to the end of the animation. */
|
|
14
24
|
complete: () => WAAPIAnimation | undefined;
|
|
25
|
+
/** Stops the animation and removes it from the WAAPI engine. */
|
|
15
26
|
cancel: () => WAAPIAnimation | undefined;
|
|
27
|
+
/** Cancels the animation and restores all animated properties to their original values. */
|
|
16
28
|
revert: () => WAAPIAnimation | undefined;
|
|
29
|
+
/** Converts an Anime.js easing function to a CSS `cubic-bezier()` string usable by WAAPI. */
|
|
17
30
|
convertEase: (fn: MaybeRef<EasingFunction>, samples?: MaybeRef<number>) => string;
|
|
18
31
|
}
|
|
32
|
+
/**
|
|
33
|
+
* Wraps Anime.js `waapi.animate()` into a Vue composable. Reactively re-creates the WAAPI animation when the target or options change, and stops it automatically on unmount.
|
|
34
|
+
*
|
|
35
|
+
* @param targets - The DOM element(s) to animate via WAAPI. Accepts a template ref, a CSS selector, a DOM element, or a reactive ref to any of these.
|
|
36
|
+
* @param options - Anime.js WAAPI animation parameters. Accepts a plain object or a reactive ref / computed. Defaults to `{}`.
|
|
37
|
+
*/
|
|
19
38
|
export declare function useWaapi(targets: MaybeRef<DOMTargetsParam> | MaybeComputedElementRef, options?: MaybeRef<WAAPIAnimationParams>): UseWaapiReturn;
|
|
20
39
|
//# sourceMappingURL=use-waapi.d.ts.map
|