@redwilly/anima 0.1.23 → 0.1.24
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 +138 -0
- package/package.json +2 -2
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 RedWilly
|
|
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
ADDED
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
# Anima
|
|
2
|
+
|
|
3
|
+
**Anima** is a TypeScript animation library for creating mathematical visualizations. Built on Bun and Canvas, it provides a fluent API for programmatically generating animations of geometric shapes, text, graphs, and more.
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/@redwilly/anima)
|
|
6
|
+
[](https://opensource.org/licenses/MIT)
|
|
7
|
+
|
|
8
|
+
## Installation
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
bun add @redwilly/anima
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Quick Start
|
|
15
|
+
|
|
16
|
+
Create a scene by extending the `Scene` class:
|
|
17
|
+
|
|
18
|
+
```typescript
|
|
19
|
+
import { Scene, Circle, Rectangle, Color } from '@redwilly/anima';
|
|
20
|
+
|
|
21
|
+
export class MyScene extends Scene {
|
|
22
|
+
constructor() {
|
|
23
|
+
super({
|
|
24
|
+
width: 1920,
|
|
25
|
+
height: 1080,
|
|
26
|
+
frameRate: 60,
|
|
27
|
+
backgroundColor: Color.BLACK
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
const circle = new Circle(1)
|
|
31
|
+
.stroke(Color.WHITE, 2)
|
|
32
|
+
.pos(-2, 0);
|
|
33
|
+
|
|
34
|
+
const rect = new Rectangle(2, 1)
|
|
35
|
+
.fill(Color.BLUE, 0.6)
|
|
36
|
+
.pos(2, 0);
|
|
37
|
+
|
|
38
|
+
// Animations in the same play() call run in parallel
|
|
39
|
+
this.play(
|
|
40
|
+
circle.fadeIn(1).moveTo(0, 0, 1),
|
|
41
|
+
rect.fadeIn(1)
|
|
42
|
+
);
|
|
43
|
+
|
|
44
|
+
this.wait(0.5);
|
|
45
|
+
this.play(circle.fadeOut(0.5));
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Render your scene:
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
anima render myfile.ts -s MyScene -o output.mp4
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Features
|
|
57
|
+
|
|
58
|
+
- **Fluent API**: Chain animations naturally with method chaining
|
|
59
|
+
- **Rich Geometry**: Circles, rectangles, lines, arrows, arcs, polygons, and more
|
|
60
|
+
- **Text Rendering**: Custom font support with glyph-level control
|
|
61
|
+
- **Graph Layouts**: Tree, circular, and force-directed graph visualizations
|
|
62
|
+
- **Camera System**: Zoom, pan, shake, and follow animations
|
|
63
|
+
- **Easing Functions**: 30+ easing functions including standard and Manim-style
|
|
64
|
+
- **Keyframe Animation**: Fine-grained control over complex motion paths
|
|
65
|
+
- **Multiple Output Formats**: MP4, WebP, GIF, sprite sheets, and PNG sequences
|
|
66
|
+
- **Segment Caching**: Intelligent caching for faster re-renders
|
|
67
|
+
|
|
68
|
+
## Documentation
|
|
69
|
+
|
|
70
|
+
For detailed usage and examples, explore the [skills directory](skills/) which contains comprehensive guides on:
|
|
71
|
+
|
|
72
|
+
- [Scene Management](skills/rules/scene.md) - Setup, configuration, and lifecycle
|
|
73
|
+
- [Mobjects](skills/rules/mobjects.md) - Mathematical objects and their properties
|
|
74
|
+
- [Animations](skills/rules/animations.md) - Fluent and Pro APIs for animation
|
|
75
|
+
- [Geometry](skills/rules/geometry.md) - Shapes and geometric primitives
|
|
76
|
+
- [Styling](skills/rules/styling.md) - Colors, strokes, and fills
|
|
77
|
+
- [Camera](skills/rules/camera.md) - Camera movements and effects
|
|
78
|
+
- [Text](skills/rules/text.md) - Text rendering and animation
|
|
79
|
+
- [Graph](skills/rules/graph.md) - Graph structures and layouts
|
|
80
|
+
- [VGroup](skills/rules/vgroup.md) - Grouping and arranging objects
|
|
81
|
+
- [Easing](skills/rules/easing.md) - Easing function reference
|
|
82
|
+
- [Keyframes](skills/rules/keyframes.md) - Keyframe-based animation
|
|
83
|
+
- [Rendering](skills/rules/rendering.md) - Output formats and CLI commands
|
|
84
|
+
|
|
85
|
+
See [SKILL.md](skills/SKILL.md) for a complete overview of the animation engine.
|
|
86
|
+
|
|
87
|
+
## CLI Commands
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
# Render a scene to video
|
|
91
|
+
anima render scene.ts -s MyScene -o output.mp4
|
|
92
|
+
|
|
93
|
+
# Preview with lower quality for faster iteration
|
|
94
|
+
anima preview scene.ts -s MyScene
|
|
95
|
+
|
|
96
|
+
# Export a single frame
|
|
97
|
+
anima export-frame scene.ts -s MyScene -t 5.0 -o frame.png
|
|
98
|
+
|
|
99
|
+
# List all scenes in a file
|
|
100
|
+
anima list-scenes scene.ts
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
## Examples
|
|
104
|
+
|
|
105
|
+
Check out the [examples directory](examples/) for sample scenes demonstrating:
|
|
106
|
+
|
|
107
|
+
- Camera movements and effects
|
|
108
|
+
- Complex animation sequences
|
|
109
|
+
- Graph visualizations
|
|
110
|
+
- Fluent and Pro API patterns
|
|
111
|
+
- Scaling and transformations
|
|
112
|
+
|
|
113
|
+
## Inspiration
|
|
114
|
+
|
|
115
|
+
Anima is inspired by [Manim](https://github.com/ManimCommunity/manim/), the mathematical animation engine created by Grant Sanderson (3Blue1Brown). While Manim uses Python and OpenGL, Anima brings similar concepts to TypeScript with a focus on web-friendly Canvas rendering.
|
|
116
|
+
|
|
117
|
+
## Development
|
|
118
|
+
|
|
119
|
+
```bash
|
|
120
|
+
# Type checking
|
|
121
|
+
bun run typecheck
|
|
122
|
+
|
|
123
|
+
# Run tests
|
|
124
|
+
bun test
|
|
125
|
+
|
|
126
|
+
# Build
|
|
127
|
+
bun run build
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
See [AGENTS.md](AGENTS.md) for development guidelines and [reference/STRUCTURE.md](reference/STRUCTURE.md) for codebase architecture.
|
|
131
|
+
|
|
132
|
+
## License
|
|
133
|
+
|
|
134
|
+
MIT © [RedWilly](https://github.com/RedWilly)
|
|
135
|
+
|
|
136
|
+
## Contributing
|
|
137
|
+
|
|
138
|
+
Contributions are welcome! Please feel free to submit issues or pull requests.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@redwilly/anima",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.24",
|
|
4
4
|
"description": "Animation library for mathematical visualizations",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -58,4 +58,4 @@
|
|
|
58
58
|
"commander": "^14.0.2",
|
|
59
59
|
"fontkit": "^2.0.4"
|
|
60
60
|
}
|
|
61
|
-
}
|
|
61
|
+
}
|