@bevelo/motion 0.0.0-stage → 0.1.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/LICENSE +21 -0
- package/README.md +49 -2
- package/dist/index.cjs +6364 -0
- package/dist/index.d.cts +1832 -0
- package/dist/index.d.ts +1832 -0
- package/dist/index.js +6278 -0
- package/dist/live/flip.cjs +78 -0
- package/dist/live/flip.d.cts +21 -0
- package/dist/live/flip.d.ts +21 -0
- package/dist/live/flip.js +77 -0
- package/dist/live/presence.cjs +7 -0
- package/dist/live/presence.d.cts +2 -0
- package/dist/live/presence.d.ts +2 -0
- package/dist/live/presence.js +1 -0
- package/dist/live/spring-value.cjs +4 -0
- package/dist/live/spring-value.d.cts +41 -0
- package/dist/live/spring-value.d.ts +41 -0
- package/dist/live/spring-value.js +1 -0
- package/dist/presence-BadXSYGX.cjs +499 -0
- package/dist/presence-CbHtzolg.d.cts +126 -0
- package/dist/presence-CbHtzolg.d.ts +126 -0
- package/dist/presence-Dt789xG9.js +470 -0
- package/dist/spring-CfdnEGs4.d.cts +118 -0
- package/dist/spring-CfdnEGs4.d.ts +118 -0
- package/dist/spring-value-D7dvds3M.cjs +373 -0
- package/dist/spring-value-fKpX3pAG.js +338 -0
- package/dist/timeline.cjs +53 -0
- package/dist/timeline.d.cts +61 -0
- package/dist/timeline.d.ts +61 -0
- package/dist/timeline.js +52 -0
- package/package.json +63 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Bevelo contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,50 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @bevelo/motion
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Animation with time as an input. Springs are solved in closed form, easings and keyframe
|
|
4
|
+
lists are pure functions of progress, and every loop reads its time from an injected
|
|
5
|
+
`Scheduler`, so the same motion runs in a browser and frame by frame in a test. On top of
|
|
6
|
+
that sit orchestration (sequence, stagger, parallel), presence for exit animations, FLIP
|
|
7
|
+
layout, and a live layer of stages, scenes, SVG and drag motion.
|
|
8
|
+
|
|
9
|
+
## Install
|
|
10
|
+
|
|
11
|
+
```sh
|
|
12
|
+
pnpm add @bevelo/motion
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Usage
|
|
16
|
+
|
|
17
|
+
```ts
|
|
18
|
+
import { animate, createScheduler, easeOutCubic } from "@bevelo/motion";
|
|
19
|
+
|
|
20
|
+
const reduce = matchMedia("(prefers-reduced-motion: reduce)");
|
|
21
|
+
const driver = { scheduler: createScheduler(), reducedMotion: () => reduce.matches };
|
|
22
|
+
|
|
23
|
+
const box = document.querySelector<HTMLElement>("#box")!;
|
|
24
|
+
const motion = animate({
|
|
25
|
+
from: 0,
|
|
26
|
+
to: 240,
|
|
27
|
+
easing: easeOutCubic,
|
|
28
|
+
durationMs: 300,
|
|
29
|
+
driver,
|
|
30
|
+
onUpdate: (x) => {
|
|
31
|
+
box.style.transform = `translateX(${x}px)`;
|
|
32
|
+
},
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
await motion.finished;
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Pass `spring: { stiffness, damping }` instead of `easing` for a physical motion. In tests,
|
|
39
|
+
`createManualScheduler()` and `advance(ms)` step the same code by hand.
|
|
40
|
+
|
|
41
|
+
## Stability
|
|
42
|
+
|
|
43
|
+
The pure curves (`easing`, `spring`, `keyframes`) are `@stable` and follow semver.
|
|
44
|
+
Everything else, including `animate`, orchestration, presence, layout, the segment engine
|
|
45
|
+
and the live layer, is `@experimental` and may change in any minor release.
|
|
46
|
+
|
|
47
|
+
## Docs
|
|
48
|
+
|
|
49
|
+
See [the behaviors docs](https://github.com/bevelo/bevelo/tree/main/apps/docs/src/content/docs/core/behaviors)
|
|
50
|
+
and the repository at https://github.com/bevelo/bevelo.
|