Skip to main content

A library for creating smooth animations

Project description

logo

MIT License PyPI Latest Release en Documentation Status

> English < | 简体中文

Introduction

JAnim is a library for creating smooth animations, built around the core concept of programmatic animation. It supports real-time editing, live preview, and a wide range of additional powerful features.

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 runs on Python 3.12+

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:

  • To generate video files, install FFmpeg.
  • To use Typst, install Typst.

Using JAnim

You can run the following command to see examples.

janim examples

The Documentation provides a more detailed guide on installing and using JAnim. (Note: You can change the documentation language using the flyout menu at the corner of the page.)

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

janim-3.10.2.tar.gz (263.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

janim-3.10.2-py3-none-any.whl (342.6 kB view details)

Uploaded Python 3

File details

Details for the file janim-3.10.2.tar.gz.

File metadata

  • Download URL: janim-3.10.2.tar.gz
  • Upload date:
  • Size: 263.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.32.5

File hashes

Hashes for janim-3.10.2.tar.gz
Algorithm Hash digest
SHA256 afbd40d7172a9213f9c229d6de0c3638e9b5ce1f681df0b8047583b04e26f7b0
MD5 42adcc57a3051b60f33ee24d109a73e0
BLAKE2b-256 14f2903a0fe1772292e26875b2464b2d6afc287edb92b6f1102b840f1ef3d4a1

See more details on using hashes here.

File details

Details for the file janim-3.10.2-py3-none-any.whl.

File metadata

  • Download URL: janim-3.10.2-py3-none-any.whl
  • Upload date:
  • Size: 342.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.32.5

File hashes

Hashes for janim-3.10.2-py3-none-any.whl
Algorithm Hash digest
SHA256 b69f0628ecb024031daf0b4f95daac70fb9f9ee80ff23d9c537e65410113ea9d
MD5 f7cb92c18cf9fac7dff2a2480b25f87b
BLAKE2b-256 43a86e5f8df13613ebd519a023430d0359b7579780df98d2ebb1f40410aa860f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page