Skip to main content

Combinable animations for manim.

Project description

Manim-Combinable

Makes manim animations combinable.

Usage

from manim import *
from manim_combinable import *

class ScaleRotateAndFadeToColor(Scene):
    def construct(self) -> None:
        text = Text("Hello", font_size=92)
        self.play(
            ScaleInPlace(text, 3, rate_func=there_and_back),
            Rotate(text, 2 * PI, rate_func=there_and_back),
            Succession(
                FadeToColor(text, RED),
                FadeToColor(text, GREEN),
                FadeOut(text, shift=4 * UP),
            ),
            run_time=10,
        )

https://github.com/user-attachments/assets/5feba7c7-13e6-46e2-b470-fcf77995ce37

How it works

The animations are combinable due to the following behavior restrictions:

  • Only necessary properties are changed.
  • The changes behave like updaters.

API Changes

  • All animation constructors are drop-in-replacements.
  • Fields and method can differ to Manim's non-combinable animations.

Nested Mobjects

When working with nested mobjects, it is sometimes necessary to use the Flatten utility:

class FlattenExample(Scene):
    def construct(self):
        tex_1 = Tex("Hello", font_size=128).set_color_by_gradient(RED, GREEN, BLUE)
        tex_2 = tex_1.copy()
        self.add(VGroup(tex_1, tex_2).arrange(DOWN))
        self.wait()

        self.play(
            SetColor(tex_1, GREY),
            Flatten(tex_2, lambda l: SetColor(l, GREY)),
        )

https://github.com/user-attachments/assets/6b2ceae8-91ae-4c4b-b57c-317c8e0c5db4

Stuttering Movement

When you transform a mobject while translating it, the movement sometimes stutters. That stems from the fact that (most) translations rely on the objects center, which is influenced by the objects bounding box.

One way to circumvent this is adding a wrapper (e.g. a circle or square) around the object, on which you then apply the translation.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

manim_combinable-0.1.3.tar.gz (6.8 kB view details)

Uploaded Source

Built Distribution

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

manim_combinable-0.1.3-py3-none-any.whl (16.0 kB view details)

Uploaded Python 3

File details

Details for the file manim_combinable-0.1.3.tar.gz.

File metadata

  • Download URL: manim_combinable-0.1.3.tar.gz
  • Upload date:
  • Size: 6.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.23 {"installer":{"name":"uv","version":"0.11.23","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for manim_combinable-0.1.3.tar.gz
Algorithm Hash digest
SHA256 ec3b364c23b3444b7a1f10ba5a03fd7efe90208e404868d37183bd36778b61e3
MD5 6122a3797da20f91e5ffaf932e9159d7
BLAKE2b-256 13e4ab02dcff345496570da2da8bab321320e4a45ff1a3e740d835260e1e8d12

See more details on using hashes here.

File details

Details for the file manim_combinable-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: manim_combinable-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 16.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.23 {"installer":{"name":"uv","version":"0.11.23","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for manim_combinable-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 bbc56015539feba2fcdcfedcdee1487dcfaaf624ef595646c9957b5582979c20
MD5 6cf1232a939dff2f4f4a3dd415312685
BLAKE2b-256 d2970bb33527771bbd4e336c79916ce5809fba2c0ccd09d501faa9f6cc542b4c

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