@weasel-js/animator 0.0.0-stage → 1.9.4

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 ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 orochi235
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,38 @@
1
- # Temporary Holding Version
1
+ # @weasel-js/animator
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Tweens, springs, holds, staggers, and timelines on one frame loop, with no scene underneath.
4
+
5
+ Part of [weasel](https://github.com/orochi235/weasel), a domain-agnostic 2D
6
+ scene-graph canvas kit for React. See the
7
+ [API reference](https://orochi235.github.io/weasel/api/).
8
+
9
+ ```sh
10
+ npm install @weasel-js/animator
11
+ ```
12
+
13
+ ```tsx
14
+ import { createTarget, useAnimator } from '@weasel-js/animator';
15
+
16
+ const animator = useAnimator();
17
+ let x = 0;
18
+ const target = createTarget({ get: () => x, set: (v) => { x = v; }, show: draw });
19
+
20
+ animator.tween({ target, to: 100, ms: 300 });
21
+ animator.spring({ target, to: 40 }); // bends the motion; neither cancels the other
22
+ ```
23
+
24
+ | Export | What it is |
25
+ |---|---|
26
+ | `useAnimator()` | The animator: `tween`, `spring`, `physics`, `decay`, `hold`, `loop`, `stagger`, `timeline`, and `watch`. The frame loop stops while its host is unseen. |
27
+ | `createTarget(opts)` | One value an animator moves. Animations on a target add, so a second one bends the first. |
28
+ | `createTargetTable(opts)` | Many like values as rows of flat arrays, shown in one pass. |
29
+ | `sampleTrack`, the `Track` types | Keyframe tracks for `animator.timeline`. |
30
+ | `resolveSkeleton`, `skeletonAxes`, `solveIk`, `mirrorPose` | Skeleton math: joints to matrices, a skeleton pose as a target's axes, two-bone IK. |
31
+ | `tweenVertexColors` and its siblings, `ColorOverrideRegistry` | Per-vertex color animation, and the table a renderer reads the colors from. |
32
+ | `createSlew`, `slewToward` | A value that follows another at a bounded rate. |
33
+
34
+ Moving a scene node's pose is `@weasel-js/core`'s half: `tweenPose`, `springPose`,
35
+ `momentum`, `bindRig`, and `useAnimatedReflow` drive this animator against a scene. How
36
+ animations combine on a target is in
37
+ [concepts](https://github.com/orochi235/weasel/blob/main/docs/concepts.md) under
38
+ "Animation target".