A library for creating smooth animations
Project description
> English < | 简体中文
Introduction
JAnim is a library for creating smooth animations.
Inspired by manim.
Introduction video: https://www.bilibili.com/video/BV17s42137SJ/
Examples
Highlights
Programmatic animation
class BubbleSort(Timeline):
def construct(self):
# define items
heights = np.linspace(1.0, 6.0, 5)
np.random.seed(123456)
np.random.shuffle(heights)
rects = [
Rect(1, height,
fill_alpha=0.5)
for height in heights
]
group = Group(*rects)
group.points.arrange(aligned_edge=DOWN)
# do animations
self.show(group)
for i in range(len(heights) - 1, 0, -1):
for j in range(i):
rect1, rect2 = rects[j], rects[j + 1]
self.play(
rect1.anim.color.set(BLUE),
rect2.anim.color.set(BLUE),
duration=0.15
)
if heights[j] > heights[j + 1]:
x1 = rect1.points.box.x
x2 = rect2.points.box.x
self.play(
rect1.anim.points.set_x(x2),
rect2.anim.points.set_x(x1),
duration=0.3
)
heights[[j, j + 1]] = heights[[j + 1, j]]
rects[j], rects[j + 1] = rect2, rect1
self.play(
rect1.anim.color.set(WHITE),
rect2.anim.color.set(WHITE),
duration=0.15
)
Change the code, refresh right away
Freely control the preview progress
Installation
⚠️ JAnim does not work on macOS.
JAnim runs on Python 3.12+ and OpenGL 4.3+.
You may install JAnim directly via
pip install janim
to install the latest version distributed on pypi. Or, to catch up with the latest development and edit the source code, you may clone this repository via
git clone https://github.com/jkjkil4/JAnim.git
cd JAnim
pip install -e .
Additionally, there are other software dependencies to be installed:
Using JAnim
You can run the following command to see examples.
janim examples
The Tutorial Page of the Documentation provides a brief view to get you started. (Note: You can change the language of the documentation at the bottom-left corner.)
License
MIT license
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file janim-1.9.2.tar.gz
.
File metadata
- Download URL: janim-1.9.2.tar.gz
- Upload date:
- Size: 200.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.32.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | bb01ff93fba04c4cb6a7d9c1780c979f7d2729bdf92236202f5cacbfcf9e42c4 |
|
MD5 | 504ba1d07a024267fdfed48055f18e63 |
|
BLAKE2b-256 | 432a9aaf3913b12b7583e8b44c545f8a496f73e8deab0a9e9a06da92a0ca27ec |
File details
Details for the file janim-1.9.2-py3-none-any.whl
.
File metadata
- Download URL: janim-1.9.2-py3-none-any.whl
- Upload date:
- Size: 231.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.32.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | aaf569df85d8d18049031567b3801c49ef13707b418ba6c47b296692db9d244b |
|
MD5 | 9d69fb001bc355c4a16e98c02a1cf45b |
|
BLAKE2b-256 | 7b990395a145fc61ce9b1eac2d43ff8fe0a4de1214d7aa9a67b714651a344d97 |