Skip to main content

Combinable animations for manim.

Project description

Manim-Combinable

Makes manim animations combinable.

Installation

pip install manim-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,
        )

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)),
        )

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.4.tar.gz (6.9 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.4-py3-none-any.whl (16.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: manim_combinable-0.1.4.tar.gz
  • Upload date:
  • Size: 6.9 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.4.tar.gz
Algorithm Hash digest
SHA256 2b7e5e23d028e627eb33a73b3efd70da89489a133046676ea19a99ed78dbb02f
MD5 5eadee2f212a1f0f91f4021fd600ce32
BLAKE2b-256 3750c17807f27804ee41a33318b4d9e444588014312021d74d66de5c6a770202

See more details on using hashes here.

File details

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

File metadata

  • Download URL: manim_combinable-0.1.4-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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 5d29d42d93e78d59dda7cbee0cc3882ace0cda7ccc1eb5c6dcf70beb395ad0d0
MD5 1420a889ff8c8186d6ff955af5873ae0
BLAKE2b-256 3af7a8bda10e989634db3495483716448dca8489e4ad25426914d3353b6c5acd

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