handanim 0.1.0__tar.gz
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.
- handanim-0.1.0/LICENSE +21 -0
- handanim-0.1.0/PKG-INFO +243 -0
- handanim-0.1.0/README.md +206 -0
- handanim-0.1.0/pyproject.toml +92 -0
- handanim-0.1.0/src/handanim/__init__.py +96 -0
- handanim-0.1.0/src/handanim/animations/__init__.py +20 -0
- handanim-0.1.0/src/handanim/animations/camera.py +79 -0
- handanim-0.1.0/src/handanim/animations/color_transition.py +46 -0
- handanim-0.1.0/src/handanim/animations/fade.py +60 -0
- handanim-0.1.0/src/handanim/animations/rotate.py +31 -0
- handanim-0.1.0/src/handanim/animations/sketch.py +143 -0
- handanim-0.1.0/src/handanim/animations/translate.py +66 -0
- handanim-0.1.0/src/handanim/animations/zoom.py +52 -0
- handanim-0.1.0/src/handanim/core/__init__.py +16 -0
- handanim-0.1.0/src/handanim/core/animation.py +106 -0
- handanim-0.1.0/src/handanim/core/cache.py +90 -0
- handanim-0.1.0/src/handanim/core/draw_ops.py +571 -0
- handanim-0.1.0/src/handanim/core/drawable.py +205 -0
- handanim-0.1.0/src/handanim/core/scene.py +797 -0
- handanim-0.1.0/src/handanim/core/styles.py +103 -0
- handanim-0.1.0/src/handanim/core/tikz_renderer.py +290 -0
- handanim-0.1.0/src/handanim/core/utils.py +144 -0
- handanim-0.1.0/src/handanim/core/viewport.py +59 -0
- handanim-0.1.0/src/handanim/primitives/__init__.py +39 -0
- handanim-0.1.0/src/handanim/primitives/arrow.py +195 -0
- handanim-0.1.0/src/handanim/primitives/curves.py +131 -0
- handanim-0.1.0/src/handanim/primitives/ellipse.py +291 -0
- handanim-0.1.0/src/handanim/primitives/eraser.py +58 -0
- handanim-0.1.0/src/handanim/primitives/flowchart.py +382 -0
- handanim-0.1.0/src/handanim/primitives/hershey_constants.py +269 -0
- handanim-0.1.0/src/handanim/primitives/lines.py +164 -0
- handanim-0.1.0/src/handanim/primitives/math.py +379 -0
- handanim-0.1.0/src/handanim/primitives/polygons.py +202 -0
- handanim-0.1.0/src/handanim/primitives/raster_image.py +102 -0
- handanim-0.1.0/src/handanim/primitives/table.py +265 -0
- handanim-0.1.0/src/handanim/primitives/text.py +236 -0
- handanim-0.1.0/src/handanim/primitives/vector_svg.py +172 -0
- handanim-0.1.0/src/handanim/stylings/__init__.py +0 -0
- handanim-0.1.0/src/handanim/stylings/color.py +52 -0
- handanim-0.1.0/src/handanim/stylings/fillpatterns.py +209 -0
- handanim-0.1.0/src/handanim/stylings/fonts.py +40 -0
- handanim-0.1.0/src/handanim/stylings/strokes.py +88 -0
- handanim-0.1.0/src/handanim/stylings/utils.py +140 -0
- handanim-0.1.0/src/handanim_ai/__init__.py +0 -0
- handanim-0.1.0/src/handanim_ai/models.py +42 -0
- handanim-0.1.0/src/handanim_ai/prompts/big_picture.txt +44 -0
- handanim-0.1.0/src/handanim_ai/prompts/codegen.txt +116 -0
handanim-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Subhrajyoty Roy
|
|
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.
|
handanim-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
Metadata-Version: 2.3
|
|
2
|
+
Name: handanim
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: A Python library to create whiteboard-style, hand-drawn animations for educational videos, tutorials or data storytelling.
|
|
5
|
+
License: MIT
|
|
6
|
+
Keywords: animation,hand-drawn,manim,math,whiteboard,education
|
|
7
|
+
Author: Subhrajyoty Roy
|
|
8
|
+
Author-email: subhrajyotyroy@gmail.com
|
|
9
|
+
Requires-Python: >=3.11,<4.0
|
|
10
|
+
Classifier: Development Status :: 4 - Beta
|
|
11
|
+
Classifier: Intended Audience :: Developers
|
|
12
|
+
Classifier: Intended Audience :: Education
|
|
13
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
18
|
+
Classifier: Topic :: Multimedia :: Graphics
|
|
19
|
+
Classifier: Topic :: Multimedia :: Video
|
|
20
|
+
Provides-Extra: ai
|
|
21
|
+
Requires-Dist: cairocffi (>=1.7.1,<2.0.0)
|
|
22
|
+
Requires-Dist: fonttools (>=4.47.0,<5.0.0)
|
|
23
|
+
Requires-Dist: hershey-fonts (>=2.1.0,<3.0.0)
|
|
24
|
+
Requires-Dist: matplotlib (>=3.7.0,<4.0.0)
|
|
25
|
+
Requires-Dist: moviepy (>=2.1.2,<3.0.0)
|
|
26
|
+
Requires-Dist: numpy (>=2.2.4,<3.0.0)
|
|
27
|
+
Requires-Dist: pycairo (>=1.27.0,<2.0.0)
|
|
28
|
+
Requires-Dist: svgelements (>=1.9.6)
|
|
29
|
+
Requires-Dist: urllib3 (>=2.6.3,<3.0.0)
|
|
30
|
+
Project-URL: Changelog, https://github.com/subroy13/handanim/blob/master/CHANGELOG.md
|
|
31
|
+
Project-URL: Documentation, https://subroy13.github.io/handanim/
|
|
32
|
+
Project-URL: Homepage, https://github.com/subroy13/handanim
|
|
33
|
+
Project-URL: Issues, https://github.com/subroy13/handanim/issues
|
|
34
|
+
Project-URL: Repository, https://github.com/subroy13/handanim.git
|
|
35
|
+
Description-Content-Type: text/markdown
|
|
36
|
+
|
|
37
|
+
# ✍️ handanim
|
|
38
|
+
|
|
39
|
+
[](https://github.com/subroy13/handanim/actions/workflows/docs.yml)
|
|
40
|
+
|
|
41
|
+
> A Python library to create whiteboard-style, hand-drawn animations for educational videos, tutorials or data storytelling.
|
|
42
|
+
|
|
43
|
+
**handanim** lets you programmatically animate hand-drawn diagrams, geometric shapes, handwritten text, and visual explanations — ideal for online teaching, explainer videos, and mathematical illustrations.
|
|
44
|
+
|
|
45
|
+
> ⭐️ If you like this project, please consider starring it on [GitHub](https://github.com/subroy13/handanim)! Your support helps the project grow.
|
|
46
|
+
|
|
47
|
+
## ✨ Features
|
|
48
|
+
|
|
49
|
+
- Draw and animate shapes (lines, ellipses, polygons) with a hand-drawn feel
|
|
50
|
+
- Fill objects with sketch-style strokes (hatching, scribbles)
|
|
51
|
+
- Animate handwritten text using custom fonts
|
|
52
|
+
- Export vector images (SVG) or videos (MP4).
|
|
53
|
+
- Intuitive Python API for creating scenes and timelines
|
|
54
|
+
|
|
55
|
+
## 📷 Example Output
|
|
56
|
+
|
|
57
|
+
### Example 1: Pythagoras Theorem
|
|
58
|
+
|
|
59
|
+
<p align="center">
|
|
60
|
+
<img src="https://raw.githubusercontent.com/subroy13/handanim/master/examples/output/pythagoras.gif" width="500">
|
|
61
|
+
</p>
|
|
62
|
+
|
|
63
|
+
_(Example animation of a Pythagoras Theorem — see `examples/pythagoras.py`)_
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
### Example 2: Square formula
|
|
67
|
+
|
|
68
|
+
<p align="center">
|
|
69
|
+
<img src="https://raw.githubusercontent.com/subroy13/handanim/master/examples/output/a_plus_b_square.gif" width="500">
|
|
70
|
+
</p>
|
|
71
|
+
|
|
72
|
+
_(Example animation of proof of a plus b whole square — see `examples/a_plus_b_square.py`)_
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
## 🚀 Quickstart
|
|
77
|
+
|
|
78
|
+
### 📦 Installation using Poetry
|
|
79
|
+
|
|
80
|
+
The easiest way to install all the dependencies is to use [Poetry](https://python-poetry.org/).
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
# Install dependencies (requires Python 3.11+)
|
|
84
|
+
poetry install
|
|
85
|
+
|
|
86
|
+
# Run example animation
|
|
87
|
+
poetry run python examples/pythagoras.py
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### ✏️ Basic Usage
|
|
91
|
+
|
|
92
|
+
```python
|
|
93
|
+
from handanim.core import Scene
|
|
94
|
+
from handanim.animations import SketchAnimation
|
|
95
|
+
from handanim.primitives import NGon
|
|
96
|
+
|
|
97
|
+
scene = Scene(width = 800, height = 608)
|
|
98
|
+
triangle = NGon(
|
|
99
|
+
center = (400, 304),
|
|
100
|
+
radius = 100,
|
|
101
|
+
n = 3
|
|
102
|
+
)
|
|
103
|
+
scene.add(SketchAnimation(start_time = 0, end_time = 5), drawable = triangle)
|
|
104
|
+
scene.render("triangle_anim.mp4", fps = 30)
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
## 📦 Installation using pip
|
|
108
|
+
|
|
109
|
+
If you prefer using `pip` instead of Poetry, you can install the main dependencies directly from the `requirements.txt` file. This method works well for lightweight setups or deployment environments.
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
# Create and activate a virtual environment (optional but recommended)
|
|
113
|
+
python -m venv venv
|
|
114
|
+
source venv/bin/activate # On Windows: venv\Scripts\activate
|
|
115
|
+
|
|
116
|
+
# Install core dependencies
|
|
117
|
+
pip install -r requirements.txt
|
|
118
|
+
|
|
119
|
+
# (Optional) Install development dependencies
|
|
120
|
+
pip install -r dev-requirements.txt
|
|
121
|
+
|
|
122
|
+
# Run example animation
|
|
123
|
+
python examples/pythagoras.py
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
Make sure you're using Python 3.11+ (as specified in the project).
|
|
127
|
+
|
|
128
|
+
## 📦 Installation using conda
|
|
129
|
+
|
|
130
|
+
If you prefer conda for environment management:
|
|
131
|
+
|
|
132
|
+
```bash
|
|
133
|
+
# Create a new environment
|
|
134
|
+
conda create -n handanim python=3.11
|
|
135
|
+
conda activate handanim
|
|
136
|
+
|
|
137
|
+
# Install system dependencies via conda-forge
|
|
138
|
+
conda install -c conda-forge cairo pycairo ffmpeg
|
|
139
|
+
|
|
140
|
+
# Install handanim and remaining Python dependencies
|
|
141
|
+
pip install -r requirements.txt
|
|
142
|
+
|
|
143
|
+
# Run example animation
|
|
144
|
+
python examples/pythagoras.py
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
> **Note:** The `requirements.txt` may need updating for your platform. If you encounter issues, the Poetry-based installation is the most tested path.
|
|
148
|
+
|
|
149
|
+
## Installing Cairo
|
|
150
|
+
|
|
151
|
+
Your system must have the Cairo graphics library installed for `pycairo` or `cairocffi` to work correctly. This is a native C library and needs to be installed separately depending on your OS.
|
|
152
|
+
|
|
153
|
+
#### ✅ On Ubuntu/Debian
|
|
154
|
+
|
|
155
|
+
```bash
|
|
156
|
+
sudo apt update
|
|
157
|
+
sudo apt install libcairo2 libcairo2-dev
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
#### ✅ On macOS (using Homebrew)
|
|
161
|
+
|
|
162
|
+
```bash
|
|
163
|
+
brew install cairo
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
#### ✅ On Windows
|
|
167
|
+
Use the precompiled binaries:
|
|
168
|
+
|
|
169
|
+
1. Download the [GTK 3 Runtime](https://github.com/tschoonj/GTK-for-Windows-Runtime-Environment-Installer/releases) (which includes Cairo).
|
|
170
|
+
2. Install it and add its bin/ folder to your system PATH.
|
|
171
|
+
3. Then install Python packages as usual:
|
|
172
|
+
|
|
173
|
+
```bash
|
|
174
|
+
pip install -r requirements.txt
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
Or use the cairocffi + pycairo + pip combo with wheels from [Gohlke's unofficial site](https://www.cgohlke.com/#pycairo) if needed.
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
## 🎬 Installing FFmpeg (Required for Video Rendering)
|
|
181
|
+
|
|
182
|
+
`moviepy` uses FFmpeg to write video files (e.g., .mp4). You must have FFmpeg installed and accessible in your system PATH.
|
|
183
|
+
|
|
184
|
+
#### ✅ On Ubuntu/Debian
|
|
185
|
+
|
|
186
|
+
```bash
|
|
187
|
+
sudo apt update
|
|
188
|
+
sudo apt install ffmpeg
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
#### ✅ On macOS (using Homebrew)
|
|
192
|
+
|
|
193
|
+
```bash
|
|
194
|
+
brew install ffmpeg
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
#### ✅ On Windows
|
|
198
|
+
|
|
199
|
+
1. Download FFmpeg from the [official site](https://ffmpeg.org/download.html) or a reliable Windows build like [gyan.dev](https://www.gyan.dev/ffmpeg/builds/).
|
|
200
|
+
2. Extract the archive, and add the bin/ folder to your system PATH.
|
|
201
|
+
3. Verify installation:
|
|
202
|
+
|
|
203
|
+
```bash
|
|
204
|
+
ffmpeg -version
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
|
|
208
|
+
## 📄 License
|
|
209
|
+
|
|
210
|
+
This project is licensed under the MIT License.
|
|
211
|
+
|
|
212
|
+
## 🤝 Contributing
|
|
213
|
+
|
|
214
|
+
We welcome contributions!
|
|
215
|
+
|
|
216
|
+
You can help by:
|
|
217
|
+
|
|
218
|
+
- Adding new animation primitives (e.g., Bezier curves, arrows)
|
|
219
|
+
- Improving rendering quality and styles, caching and optimization.
|
|
220
|
+
- Writing example scripts or tutorials.
|
|
221
|
+
- Reporting bugs and suggesting features
|
|
222
|
+
|
|
223
|
+
Please see `CONTRIBUTING.md` (coming soon) for guidelines.
|
|
224
|
+
|
|
225
|
+
## ❤️ Inspiration
|
|
226
|
+
|
|
227
|
+
Inspired by:
|
|
228
|
+
|
|
229
|
+
- [3Blue1Brown's manim](https://github.com/3b1b/manim)
|
|
230
|
+
- [RoughJS](https://github.com/rough-stuff/rough)
|
|
231
|
+
- Whiteboard animation videos
|
|
232
|
+
- Interactive teaching tools
|
|
233
|
+
|
|
234
|
+
⭐️ **Support handanim!**
|
|
235
|
+
|
|
236
|
+
If you find this project useful, please give it a star on [GitHub](https://github.com/subroy13/handanim).
|
|
237
|
+
|
|
238
|
+
It motivates me to keep improving it and helps others discover it!
|
|
239
|
+
|
|
240
|
+
> ✨ Made with love by Subhrajyoty Roy
|
|
241
|
+
|
|
242
|
+
|
|
243
|
+
|
handanim-0.1.0/README.md
ADDED
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
# ✍️ handanim
|
|
2
|
+
|
|
3
|
+
[](https://github.com/subroy13/handanim/actions/workflows/docs.yml)
|
|
4
|
+
|
|
5
|
+
> A Python library to create whiteboard-style, hand-drawn animations for educational videos, tutorials or data storytelling.
|
|
6
|
+
|
|
7
|
+
**handanim** lets you programmatically animate hand-drawn diagrams, geometric shapes, handwritten text, and visual explanations — ideal for online teaching, explainer videos, and mathematical illustrations.
|
|
8
|
+
|
|
9
|
+
> ⭐️ If you like this project, please consider starring it on [GitHub](https://github.com/subroy13/handanim)! Your support helps the project grow.
|
|
10
|
+
|
|
11
|
+
## ✨ Features
|
|
12
|
+
|
|
13
|
+
- Draw and animate shapes (lines, ellipses, polygons) with a hand-drawn feel
|
|
14
|
+
- Fill objects with sketch-style strokes (hatching, scribbles)
|
|
15
|
+
- Animate handwritten text using custom fonts
|
|
16
|
+
- Export vector images (SVG) or videos (MP4).
|
|
17
|
+
- Intuitive Python API for creating scenes and timelines
|
|
18
|
+
|
|
19
|
+
## 📷 Example Output
|
|
20
|
+
|
|
21
|
+
### Example 1: Pythagoras Theorem
|
|
22
|
+
|
|
23
|
+
<p align="center">
|
|
24
|
+
<img src="https://raw.githubusercontent.com/subroy13/handanim/master/examples/output/pythagoras.gif" width="500">
|
|
25
|
+
</p>
|
|
26
|
+
|
|
27
|
+
_(Example animation of a Pythagoras Theorem — see `examples/pythagoras.py`)_
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
### Example 2: Square formula
|
|
31
|
+
|
|
32
|
+
<p align="center">
|
|
33
|
+
<img src="https://raw.githubusercontent.com/subroy13/handanim/master/examples/output/a_plus_b_square.gif" width="500">
|
|
34
|
+
</p>
|
|
35
|
+
|
|
36
|
+
_(Example animation of proof of a plus b whole square — see `examples/a_plus_b_square.py`)_
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
## 🚀 Quickstart
|
|
41
|
+
|
|
42
|
+
### 📦 Installation using Poetry
|
|
43
|
+
|
|
44
|
+
The easiest way to install all the dependencies is to use [Poetry](https://python-poetry.org/).
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
# Install dependencies (requires Python 3.11+)
|
|
48
|
+
poetry install
|
|
49
|
+
|
|
50
|
+
# Run example animation
|
|
51
|
+
poetry run python examples/pythagoras.py
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### ✏️ Basic Usage
|
|
55
|
+
|
|
56
|
+
```python
|
|
57
|
+
from handanim.core import Scene
|
|
58
|
+
from handanim.animations import SketchAnimation
|
|
59
|
+
from handanim.primitives import NGon
|
|
60
|
+
|
|
61
|
+
scene = Scene(width = 800, height = 608)
|
|
62
|
+
triangle = NGon(
|
|
63
|
+
center = (400, 304),
|
|
64
|
+
radius = 100,
|
|
65
|
+
n = 3
|
|
66
|
+
)
|
|
67
|
+
scene.add(SketchAnimation(start_time = 0, end_time = 5), drawable = triangle)
|
|
68
|
+
scene.render("triangle_anim.mp4", fps = 30)
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## 📦 Installation using pip
|
|
72
|
+
|
|
73
|
+
If you prefer using `pip` instead of Poetry, you can install the main dependencies directly from the `requirements.txt` file. This method works well for lightweight setups or deployment environments.
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
# Create and activate a virtual environment (optional but recommended)
|
|
77
|
+
python -m venv venv
|
|
78
|
+
source venv/bin/activate # On Windows: venv\Scripts\activate
|
|
79
|
+
|
|
80
|
+
# Install core dependencies
|
|
81
|
+
pip install -r requirements.txt
|
|
82
|
+
|
|
83
|
+
# (Optional) Install development dependencies
|
|
84
|
+
pip install -r dev-requirements.txt
|
|
85
|
+
|
|
86
|
+
# Run example animation
|
|
87
|
+
python examples/pythagoras.py
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
Make sure you're using Python 3.11+ (as specified in the project).
|
|
91
|
+
|
|
92
|
+
## 📦 Installation using conda
|
|
93
|
+
|
|
94
|
+
If you prefer conda for environment management:
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
# Create a new environment
|
|
98
|
+
conda create -n handanim python=3.11
|
|
99
|
+
conda activate handanim
|
|
100
|
+
|
|
101
|
+
# Install system dependencies via conda-forge
|
|
102
|
+
conda install -c conda-forge cairo pycairo ffmpeg
|
|
103
|
+
|
|
104
|
+
# Install handanim and remaining Python dependencies
|
|
105
|
+
pip install -r requirements.txt
|
|
106
|
+
|
|
107
|
+
# Run example animation
|
|
108
|
+
python examples/pythagoras.py
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
> **Note:** The `requirements.txt` may need updating for your platform. If you encounter issues, the Poetry-based installation is the most tested path.
|
|
112
|
+
|
|
113
|
+
## Installing Cairo
|
|
114
|
+
|
|
115
|
+
Your system must have the Cairo graphics library installed for `pycairo` or `cairocffi` to work correctly. This is a native C library and needs to be installed separately depending on your OS.
|
|
116
|
+
|
|
117
|
+
#### ✅ On Ubuntu/Debian
|
|
118
|
+
|
|
119
|
+
```bash
|
|
120
|
+
sudo apt update
|
|
121
|
+
sudo apt install libcairo2 libcairo2-dev
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
#### ✅ On macOS (using Homebrew)
|
|
125
|
+
|
|
126
|
+
```bash
|
|
127
|
+
brew install cairo
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
#### ✅ On Windows
|
|
131
|
+
Use the precompiled binaries:
|
|
132
|
+
|
|
133
|
+
1. Download the [GTK 3 Runtime](https://github.com/tschoonj/GTK-for-Windows-Runtime-Environment-Installer/releases) (which includes Cairo).
|
|
134
|
+
2. Install it and add its bin/ folder to your system PATH.
|
|
135
|
+
3. Then install Python packages as usual:
|
|
136
|
+
|
|
137
|
+
```bash
|
|
138
|
+
pip install -r requirements.txt
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
Or use the cairocffi + pycairo + pip combo with wheels from [Gohlke's unofficial site](https://www.cgohlke.com/#pycairo) if needed.
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
## 🎬 Installing FFmpeg (Required for Video Rendering)
|
|
145
|
+
|
|
146
|
+
`moviepy` uses FFmpeg to write video files (e.g., .mp4). You must have FFmpeg installed and accessible in your system PATH.
|
|
147
|
+
|
|
148
|
+
#### ✅ On Ubuntu/Debian
|
|
149
|
+
|
|
150
|
+
```bash
|
|
151
|
+
sudo apt update
|
|
152
|
+
sudo apt install ffmpeg
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
#### ✅ On macOS (using Homebrew)
|
|
156
|
+
|
|
157
|
+
```bash
|
|
158
|
+
brew install ffmpeg
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
#### ✅ On Windows
|
|
162
|
+
|
|
163
|
+
1. Download FFmpeg from the [official site](https://ffmpeg.org/download.html) or a reliable Windows build like [gyan.dev](https://www.gyan.dev/ffmpeg/builds/).
|
|
164
|
+
2. Extract the archive, and add the bin/ folder to your system PATH.
|
|
165
|
+
3. Verify installation:
|
|
166
|
+
|
|
167
|
+
```bash
|
|
168
|
+
ffmpeg -version
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
## 📄 License
|
|
173
|
+
|
|
174
|
+
This project is licensed under the MIT License.
|
|
175
|
+
|
|
176
|
+
## 🤝 Contributing
|
|
177
|
+
|
|
178
|
+
We welcome contributions!
|
|
179
|
+
|
|
180
|
+
You can help by:
|
|
181
|
+
|
|
182
|
+
- Adding new animation primitives (e.g., Bezier curves, arrows)
|
|
183
|
+
- Improving rendering quality and styles, caching and optimization.
|
|
184
|
+
- Writing example scripts or tutorials.
|
|
185
|
+
- Reporting bugs and suggesting features
|
|
186
|
+
|
|
187
|
+
Please see `CONTRIBUTING.md` (coming soon) for guidelines.
|
|
188
|
+
|
|
189
|
+
## ❤️ Inspiration
|
|
190
|
+
|
|
191
|
+
Inspired by:
|
|
192
|
+
|
|
193
|
+
- [3Blue1Brown's manim](https://github.com/3b1b/manim)
|
|
194
|
+
- [RoughJS](https://github.com/rough-stuff/rough)
|
|
195
|
+
- Whiteboard animation videos
|
|
196
|
+
- Interactive teaching tools
|
|
197
|
+
|
|
198
|
+
⭐️ **Support handanim!**
|
|
199
|
+
|
|
200
|
+
If you find this project useful, please give it a star on [GitHub](https://github.com/subroy13/handanim).
|
|
201
|
+
|
|
202
|
+
It motivates me to keep improving it and helps others discover it!
|
|
203
|
+
|
|
204
|
+
> ✨ Made with love by Subhrajyoty Roy
|
|
205
|
+
|
|
206
|
+
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
[tool.poetry]
|
|
2
|
+
packages = [
|
|
3
|
+
{ include = "handanim", from = "src" },
|
|
4
|
+
{ include = "handanim_ai", from = "src" },
|
|
5
|
+
]
|
|
6
|
+
name = "handanim"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "A Python library to create whiteboard-style, hand-drawn animations for educational videos, tutorials or data storytelling."
|
|
9
|
+
authors = ["Subhrajyoty Roy <subhrajyotyroy@gmail.com>"]
|
|
10
|
+
license = "MIT"
|
|
11
|
+
readme = "README.md"
|
|
12
|
+
classifiers = [
|
|
13
|
+
"Development Status :: 4 - Beta",
|
|
14
|
+
"Intended Audience :: Education",
|
|
15
|
+
"Intended Audience :: Developers",
|
|
16
|
+
"License :: OSI Approved :: MIT License",
|
|
17
|
+
"Topic :: Multimedia :: Graphics",
|
|
18
|
+
"Topic :: Multimedia :: Video",
|
|
19
|
+
"Programming Language :: Python :: 3",
|
|
20
|
+
"Programming Language :: Python :: 3.11",
|
|
21
|
+
]
|
|
22
|
+
keywords = [
|
|
23
|
+
"animation",
|
|
24
|
+
"hand-drawn",
|
|
25
|
+
"manim",
|
|
26
|
+
"math",
|
|
27
|
+
"whiteboard",
|
|
28
|
+
"education",
|
|
29
|
+
]
|
|
30
|
+
|
|
31
|
+
[tool.poetry.urls]
|
|
32
|
+
Homepage = "https://github.com/subroy13/handanim"
|
|
33
|
+
Documentation = "https://subroy13.github.io/handanim/"
|
|
34
|
+
Repository = "https://github.com/subroy13/handanim.git"
|
|
35
|
+
Issues = "https://github.com/subroy13/handanim/issues"
|
|
36
|
+
Changelog = "https://github.com/subroy13/handanim/blob/master/CHANGELOG.md"
|
|
37
|
+
|
|
38
|
+
[tool.poetry.dependencies]
|
|
39
|
+
python = "^3.11"
|
|
40
|
+
cairocffi = ">=1.7.1,<2.0.0"
|
|
41
|
+
numpy = ">=2.2.4,<3.0.0"
|
|
42
|
+
moviepy = ">=2.1.2,<3.0.0"
|
|
43
|
+
pycairo = ">=1.27.0,<2.0.0"
|
|
44
|
+
fonttools = ">=4.47.0,<5.0.0"
|
|
45
|
+
matplotlib = ">=3.7.0,<4.0.0"
|
|
46
|
+
svgelements = ">=1.9.6"
|
|
47
|
+
urllib3 = "^2.6.3"
|
|
48
|
+
hershey-fonts = "^2.1.0"
|
|
49
|
+
|
|
50
|
+
[tool.poetry.group.dev.dependencies]
|
|
51
|
+
sphinx = "^8.2.3"
|
|
52
|
+
furo = "^2024.8.6"
|
|
53
|
+
vtracer = "^0.6.11"
|
|
54
|
+
opencv-python = "^4.11.0.86"
|
|
55
|
+
scikit-image = "^0.25.2"
|
|
56
|
+
pytest = "^8.0.0"
|
|
57
|
+
pytest-snapshot = "^0.9.0"
|
|
58
|
+
pytest-cov = "^7.1.0"
|
|
59
|
+
ruff = "^0.15.12"
|
|
60
|
+
mypy = "^2.1.0"
|
|
61
|
+
readme-renderer = "^45.0"
|
|
62
|
+
|
|
63
|
+
[tool.pytest.ini_options]
|
|
64
|
+
testpaths = ["tests"]
|
|
65
|
+
|
|
66
|
+
[tool.poetry.requires-plugins]
|
|
67
|
+
poetry-plugin-export = ">=1.8"
|
|
68
|
+
|
|
69
|
+
[build-system]
|
|
70
|
+
requires = ["poetry-core>=2.0.0,<3.0.0"]
|
|
71
|
+
build-backend = "poetry.core.masonry.api"
|
|
72
|
+
|
|
73
|
+
[tool.poetry.extras]
|
|
74
|
+
ai = []
|
|
75
|
+
|
|
76
|
+
[tool.ruff]
|
|
77
|
+
line-length = 120
|
|
78
|
+
target-version = "py311"
|
|
79
|
+
|
|
80
|
+
[tool.ruff.lint]
|
|
81
|
+
select = ["E", "F", "I", "W", "UP", "B"]
|
|
82
|
+
ignore = [
|
|
83
|
+
"E501", # line too long — handled by line-length setting above
|
|
84
|
+
"B008", # function call in default argument — intentional (style objects as defaults)
|
|
85
|
+
]
|
|
86
|
+
|
|
87
|
+
[tool.mypy]
|
|
88
|
+
python_version = "3.11"
|
|
89
|
+
ignore_missing_imports = true
|
|
90
|
+
warn_return_any = true
|
|
91
|
+
warn_unused_ignores = true
|
|
92
|
+
no_strict_optional = true
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
from .core import (
|
|
2
|
+
AnimationEvent,
|
|
3
|
+
AnimationEventType,
|
|
4
|
+
CompositeAnimationEvent,
|
|
5
|
+
Drawable,
|
|
6
|
+
DrawableGroup,
|
|
7
|
+
FillStyle,
|
|
8
|
+
Scene,
|
|
9
|
+
SketchStyle,
|
|
10
|
+
StrokeStyle,
|
|
11
|
+
)
|
|
12
|
+
from .primitives import (
|
|
13
|
+
Arrow,
|
|
14
|
+
Circle,
|
|
15
|
+
Curve,
|
|
16
|
+
CurvedArrow,
|
|
17
|
+
Ellipse,
|
|
18
|
+
Eraser,
|
|
19
|
+
Flowchart,
|
|
20
|
+
FlowchartConnector,
|
|
21
|
+
FlowchartDiamond,
|
|
22
|
+
FlowchartNode,
|
|
23
|
+
Line,
|
|
24
|
+
LinearPath,
|
|
25
|
+
Math,
|
|
26
|
+
NGon,
|
|
27
|
+
Polygon,
|
|
28
|
+
Rectangle,
|
|
29
|
+
RoundedRectangle,
|
|
30
|
+
RoundedSquare,
|
|
31
|
+
Square,
|
|
32
|
+
Table,
|
|
33
|
+
TableRevealEvent,
|
|
34
|
+
Text,
|
|
35
|
+
VectorSVG,
|
|
36
|
+
)
|
|
37
|
+
from .animations import (
|
|
38
|
+
CameraAnimation,
|
|
39
|
+
ColorTransitionAnimation,
|
|
40
|
+
FadeInAnimation,
|
|
41
|
+
FadeOutAnimation,
|
|
42
|
+
RotateAnimation,
|
|
43
|
+
SketchAnimation,
|
|
44
|
+
TranslateFromAnimation,
|
|
45
|
+
TranslateToAnimation,
|
|
46
|
+
ZoomInAnimation,
|
|
47
|
+
ZoomOutAnimation,
|
|
48
|
+
)
|
|
49
|
+
|
|
50
|
+
__all__ = [
|
|
51
|
+
# Core
|
|
52
|
+
"Scene",
|
|
53
|
+
"StrokeStyle",
|
|
54
|
+
"SketchStyle",
|
|
55
|
+
"FillStyle",
|
|
56
|
+
"Drawable",
|
|
57
|
+
"DrawableGroup",
|
|
58
|
+
"AnimationEvent",
|
|
59
|
+
"AnimationEventType",
|
|
60
|
+
"CompositeAnimationEvent",
|
|
61
|
+
# Primitives
|
|
62
|
+
"Line",
|
|
63
|
+
"LinearPath",
|
|
64
|
+
"Arrow",
|
|
65
|
+
"CurvedArrow",
|
|
66
|
+
"Curve",
|
|
67
|
+
"Rectangle",
|
|
68
|
+
"RoundedRectangle",
|
|
69
|
+
"Square",
|
|
70
|
+
"RoundedSquare",
|
|
71
|
+
"Polygon",
|
|
72
|
+
"NGon",
|
|
73
|
+
"Ellipse",
|
|
74
|
+
"Circle",
|
|
75
|
+
"Text",
|
|
76
|
+
"Math",
|
|
77
|
+
"Eraser",
|
|
78
|
+
"VectorSVG",
|
|
79
|
+
"FlowchartNode",
|
|
80
|
+
"FlowchartDiamond",
|
|
81
|
+
"FlowchartConnector",
|
|
82
|
+
"Flowchart",
|
|
83
|
+
"Table",
|
|
84
|
+
"TableRevealEvent",
|
|
85
|
+
# Animations
|
|
86
|
+
"SketchAnimation",
|
|
87
|
+
"FadeInAnimation",
|
|
88
|
+
"FadeOutAnimation",
|
|
89
|
+
"ZoomInAnimation",
|
|
90
|
+
"ZoomOutAnimation",
|
|
91
|
+
"TranslateFromAnimation",
|
|
92
|
+
"TranslateToAnimation",
|
|
93
|
+
"RotateAnimation",
|
|
94
|
+
"ColorTransitionAnimation",
|
|
95
|
+
"CameraAnimation",
|
|
96
|
+
]
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
from .camera import CameraAnimation
|
|
2
|
+
from .color_transition import ColorTransitionAnimation
|
|
3
|
+
from .fade import FadeInAnimation, FadeOutAnimation
|
|
4
|
+
from .rotate import RotateAnimation
|
|
5
|
+
from .sketch import SketchAnimation
|
|
6
|
+
from .translate import TranslateFromAnimation, TranslateToAnimation
|
|
7
|
+
from .zoom import ZoomInAnimation, ZoomOutAnimation
|
|
8
|
+
|
|
9
|
+
__all__ = [
|
|
10
|
+
"SketchAnimation",
|
|
11
|
+
"FadeInAnimation",
|
|
12
|
+
"FadeOutAnimation",
|
|
13
|
+
"ZoomInAnimation",
|
|
14
|
+
"ZoomOutAnimation",
|
|
15
|
+
"TranslateFromAnimation",
|
|
16
|
+
"TranslateToAnimation",
|
|
17
|
+
"RotateAnimation",
|
|
18
|
+
"ColorTransitionAnimation",
|
|
19
|
+
"CameraAnimation",
|
|
20
|
+
]
|