Skip to content

fix: AnimationGroup with negative z_index #4277

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 69 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
09dc7e7
Fixed negative z_index in AnimationGroup issue
Merzlikin-Matvey Jun 8, 2025
8712c17
Added tests for negative z_index in animations
Merzlikin-Matvey Jun 8, 2025
26e0fc9
Fixed the test on Linux and MacOS
Merzlikin-Matvey Jun 8, 2025
c079386
Slightly modified the test
Merzlikin-Matvey Jun 8, 2025
139c5c7
Merge branch 'main' into main
Merzlikin-Matvey Jun 9, 2025
ccefe48
Merge branch 'main' into main
Merzlikin-Matvey Jun 14, 2025
e4b1d10
Rename misleading function dot_position to update_label in .add_updat…
irvanalhaq9 Jun 19, 2025
3377f6c
Replace exceptions, remove unused parameters, and fix type hints in `…
irvanalhaq9 Jun 20, 2025
23a2df1
use the same opacity to init the super class obj of DecimalNumber (#4…
ishu9bansal Jun 21, 2025
c9707f2
Introduce seed in `random_color` method to produce colors determinist…
ishu9bansal Jun 21, 2025
6486299
Refactor `Rotating` and add docstrings to `Mobject.rotate()` and `Rot…
irvanalhaq9 Jun 22, 2025
a8458cb
Fix default config of manim init project to use correct pixel_height …
StevenH34 Jun 23, 2025
325fa08
Fixing files with few typing (mypy) errors (#4263)
henrikmidtiby Jun 23, 2025
a1bb049
Fix Microsoft typo in `TexFontTemplateLibrary` scene in `example_scen…
alterdim Jun 24, 2025
0cec802
Explicit mention all files that mypy should ignore in the mypy.ini co…
henrikmidtiby Jun 24, 2025
c4b7a80
Remove dead code from `scene.py` and `vector_space_scene.py` (#4310)
henrikmidtiby Jun 24, 2025
ea16d22
Add type annotations to `scene.py` and `vector_space_scene.py` (#4260)
henrikmidtiby Jun 24, 2025
9c43ad0
Store the original alpha channel from the image when creating the Ima…
henrikmidtiby Jun 26, 2025
a234ff3
Replace setup-texlive-action in CI workflow (#4326)
behackl Jul 3, 2025
f63ba71
Gracefully fall back when version metadata is missing (#4324)
mohiuddin-khan-shiam Jul 10, 2025
3d029c1
Fix for issue 4255 - Arrow3D: get_start() and get_end() methods both …
henrikmidtiby Jul 10, 2025
3721fb1
Use utf-8 encoding to read generated .tex files. (#4334)
OliverStrait Jul 20, 2025
9e74ee7
Add zero to remove negative zeros (#4332)
elshorbagyx Jul 20, 2025
f124235
Adding type annotations to polyhedra.py and matrix.py (#4322)
henrikmidtiby Jul 20, 2025
b83410a
Ensure that the stroke_width property of SVGMobject is not set to Non…
henrikmidtiby Jul 20, 2025
e54113e
Handling typing errors in text/numbers.py (#4317)
henrikmidtiby Jul 20, 2025
ec501b9
Remove manim.gui and move configure_pygui into Scene as a method (#4314)
chopan050 Jul 20, 2025
fdb5cb9
Add typing annotations to svg_mobject.py (#4318)
henrikmidtiby Jul 20, 2025
2790a70
Improved readability, grammar, as well as added docstrings for consis…
NASAnerd05 Jul 20, 2025
c1663f1
Bump astral-sh/setup-uv from 5 to 6 (#4234)
dependabot[bot] Jul 21, 2025
2f02eb9
Fix Prism rendering with wrong dimensions in OpenGL (#4003)
ra1u Jul 24, 2025
047db45
Add type annotations to `mobject/svg/brace.py` (#4309)
henrikmidtiby Jul 24, 2025
fd8ab62
Fix `BraceLabel.change_label()` and document `BraceText` (#4347)
henrikmidtiby Jul 24, 2025
e73b659
Add classes `MethodWithArgs`, `SceneInteractContinue` and `SceneInter…
chopan050 Jul 24, 2025
4ddf777
Include `Text.gradient` in hash to properly regenerate `Text` when it…
AbhilashaTandon Jul 25, 2025
b65b0f2
Fixed surface animations in OpenGL (#4286)
nubDotDev Jul 25, 2025
83d4301
Add docstrings for `ChangingDecimal` and `ChangeDecimalToValue` (#4346)
haveheartt Jul 25, 2025
a8c16fb
Add type hints to `mobject/value_tracker.py` (#4129)
fmuenkel Jul 25, 2025
dea245a
Fix duplicate references in `Scene.mobjects` after `ReplacementTransf…
irvanalhaq9 Jul 26, 2025
c7ff795
Add support for arithmetic operators `//`, `%`, `*`, `**` and `/` on …
fmuenkel Jul 26, 2025
088affd
Fix typo in import of OpenGLCamera (#4352)
fmuenkel Jul 26, 2025
21fe73b
Add type annotations to `manim/renderer/shader.py` (#4350)
henrikmidtiby Jul 27, 2025
7ea765a
Optimize Mobject.become() (#4357)
chopan050 Jul 29, 2025
df36f4f
Add type annotations to `tex_mobject.py` (#4355)
henrikmidtiby Jul 29, 2025
dba6fa8
Add type annotations to `three_d_camera.py` (#4356)
henrikmidtiby Jul 29, 2025
a9b65ee
Revert change of default value (#4358)
henrikmidtiby Jul 29, 2025
aa0cd4f
Add type hints to `scene_file_writer.py`, `section.py`, and `zoomed_s…
fmuenkel Jul 30, 2025
7eb8856
Add type annotations for most of `camera` and `mobject.graphing` (#4125)
henrikmidtiby Aug 1, 2025
d18dc8f
Add `VectorNDLike` type aliases (#4068)
chopan050 Aug 1, 2025
9c9ebf4
Add type annotations to `dot_cloud.py`, `vectorized_mobject_rendering…
henrikmidtiby Aug 1, 2025
04503ad
Fix Sphinx exceptions when trying to build documentation via latex / …
behackl Aug 6, 2025
ded54e4
Add type annotations to `indication.py` (#4367)
henrikmidtiby Aug 6, 2025
c887b51
Add type annotations to `composition.py` (#4366)
henrikmidtiby Aug 6, 2025
e339a68
Add type annotations to `growing.py` (#4368)
henrikmidtiby Aug 6, 2025
d0521fa
Add type annotations to `movement.py` (#4371)
henrikmidtiby Aug 6, 2025
fc68c10
Add info-level logging for config files read and enhance output (#4375)
xnov18 Aug 7, 2025
2d8d81c
[pre-commit.ci] pre-commit autoupdate (#4204)
pre-commit-ci[bot] Aug 9, 2025
d8a7e55
Exclude check for cyclic imports by CodeQL (#4384)
behackl Aug 9, 2025
cb8af6f
Bevel cube corners (#4361)
nubDotDev Aug 9, 2025
b3df1cf
Properly define init_points methods (#4360)
chopan050 Aug 9, 2025
05cc414
Refactor imports from `collections.abc`, `typing` and `typing_extensi…
chopan050 Aug 9, 2025
48d5a36
Typing `opengl_renderer_window.py` (#4363)
fmuenkel Aug 9, 2025
b8844b4
fix: nested groups work fine
Merzlikin-Matvey Aug 10, 2025
0884fea
Merge
Merzlikin-Matvey Aug 10, 2025
654068a
fix: add return type hints for animation methods
Merzlikin-Matvey Aug 10, 2025
2d13eba
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Aug 10, 2025
d10fb37
fix: update return type hints for animation methods to include OpenGL…
Merzlikin-Matvey Aug 10, 2025
1082089
Merge remote-tracking branch 'origin/main'
Merzlikin-Matvey Aug 10, 2025
6d65242
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Aug 10, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .github/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@ query-filters:
- exclude:
id: py/missing-call-to-init
- exclude:
id: py/method-first-arg-is-not-self
id: py/method-first-arg-is-not-self
- exclude:
id: py/cyclic-import
- exclude:
id: py/unsafe-cyclic-import
paths:
- manim
paths-ignore:
Expand Down
4 changes: 2 additions & 2 deletions .github/scripts/ci_build_cairo.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
import sys
import tarfile
import tempfile
import typing
import urllib.request
from collections.abc import Generator
from contextlib import contextmanager
from pathlib import Path
from sys import stdout
Expand Down Expand Up @@ -67,7 +67,7 @@ def run_command(command, cwd=None, env=None):


@contextmanager
def gha_group(title: str) -> typing.Generator:
def gha_group(title: str) -> Generator:
if not is_ci():
yield
return
Expand Down
11 changes: 7 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
python-version: ${{ matrix.python }}

- name: Install uv
uses: astral-sh/setup-uv@v5
uses: astral-sh/setup-uv@v6
with:
enable-cache: true

Expand All @@ -54,10 +54,13 @@ jobs:

- name: Install Texlive (Linux)
if: runner.os == 'Linux'
uses: teatimeguest/setup-texlive-action@v3
uses: zauguin/install-texlive@v4
with:
cache: true
packages: scheme-basic fontspec inputenc fontenc tipa mathrsfs calligra xcolor standalone preview doublestroke ms everysel setspace rsfs relsize ragged2e fundus-calligra microtype wasysym physics dvisvgm jknapltx wasy cm-super babel-english gnu-freefont mathastext cbfonts-fd xetex
packages: >
scheme-basic latex fontspec tipa calligra xcolor
standalone preview doublestroke setspace rsfs relsize
ragged2e fundus-calligra microtype wasysym physics dvisvgm jknapltx
wasy cm-super babel-english gnu-freefont mathastext cbfonts-fd xetex

- name: Start virtual display (Linux)
if: runner.os == 'Linux'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
python-version: 3.13

- name: Install uv
uses: astral-sh/setup-uv@v5
uses: astral-sh/setup-uv@v6

- name: Build and push release to PyPI
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-publish-documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
python-version: 3.13

- name: Install uv
uses: astral-sh/setup-uv@v5
uses: astral-sh/setup-uv@v6

- name: Install system dependencies
run: |
Expand Down
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ repos:
- id: check-toml
name: Validate pyproject.toml
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.11.0
rev: v0.12.7
hooks:
- id: ruff
name: ruff lint
Expand All @@ -22,7 +22,7 @@ repos:
- id: ruff-format
types: [python]
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.15.0
rev: v1.17.1
hooks:
- id: mypy
additional_dependencies:
Expand Down
1 change: 1 addition & 0 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@
# This specifies any additional css files that will override the theme's
html_css_files = ["custom.css"]

latex_engine = "lualatex"

# external links
extlinks = {
Expand Down
10 changes: 2 additions & 8 deletions docs/source/contributing/docs/types.rst
Original file line number Diff line number Diff line change
Expand Up @@ -85,14 +85,8 @@ typed as a :class:`~.Point3D`, because it represents a direction along
which to shift a :class:`~.Mobject`, not a position in space.

As a general rule, if a parameter is called ``direction`` or ``axis``,
it should be type hinted as some form of :class:`~.VectorND`.

.. warning::

This is not always true. For example, as of Manim 0.18.0, the direction
parameter of the :class:`.Vector` Mobject should be
``Point2DLike | Point3DLike``, as it can also accept ``tuple[float, float]``
and ``tuple[float, float, float]``.
it should be type hinted as some form of :class:`~.VectorND` or
:class:`~.VectorNDLike`.

Colors
------
Expand Down
2 changes: 1 addition & 1 deletion docs/source/examples.rst
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ Animations
path.become(previous_path)
path.add_updater(update_path)
self.add(path, dot)
self.play(Rotating(dot, radians=PI, about_point=RIGHT, run_time=2))
self.play(Rotating(dot, angle=PI, about_point=RIGHT, run_time=2))
self.wait()
self.play(dot.animate.shift(UP))
self.play(dot.animate.shift(LEFT))
Expand Down
1 change: 1 addition & 0 deletions docs/source/reference_index/utilities_misc.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ Module Index
~utils.commands
~utils.config_ops
constants
data_structures
~utils.debug
~utils.deprecation
~utils.docbuild
Expand Down
2 changes: 1 addition & 1 deletion example_scenes/advanced_tex_fonts.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class TexFontTemplateLibrary(Scene):
Many of the in the TexFontTemplates collection require that specific fonts
are installed on your local machine.
For example, choosing the template TexFontTemplates.comic_sans will
not compile if the Comic Sans Micrososft font is not installed.
not compile if the Comic Sans Microsoft font is not installed.

This scene will only render those Templates that do not cause a TeX
compilation error on your system. Furthermore, some of the ones that do render,
Expand Down
11 changes: 9 additions & 2 deletions manim/__init__.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
#!/usr/bin/env python
from __future__ import annotations

from importlib.metadata import version
from importlib.metadata import PackageNotFoundError, version

__version__ = version(__name__)
# Use installed distribution version if available; otherwise fall back to a
# sensible default so that importing from a source checkout works without an
# editable install (pip install -e .).
try:
__version__ = version(__name__)
except PackageNotFoundError:
# Package is not installed; provide a fallback version string.
__version__ = "0.0.0+unknown"


# isort: off
Expand Down
9 changes: 4 additions & 5 deletions manim/_config/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,9 @@

parser = make_config_parser()

# The logger can be accessed from anywhere as manim.logger, or as
# logging.getLogger("manim"). The console must be accessed as manim.console.
# Throughout the codebase, use manim.console.print() instead of print().
# Use error_console to print errors so that it outputs to stderr.
# Logger usage: accessible globally as `manim.logger` or via `logging.getLogger("manim")`.
# For printing, use `manim.console.print()` instead of the built-in `print()`.
# For error output, use `error_console`, which prints to stderr.
logger, console, error_console = make_logger(
parser["logger"],
parser["CLI"]["verbosity"],
Expand All @@ -45,7 +44,7 @@
# This has to go here because it needs access to this module's config
@contextmanager
def tempconfig(temp: ManimConfig | dict[str, Any]) -> Generator[None, None, None]:
"""Context manager that temporarily modifies the global ``config`` object.
"""Temporarily modifies the global ``config`` object using a context manager.

Inside the ``with`` statement, the modified config will be used. After
context manager exits, the config will be restored to its original state.
Expand Down
19 changes: 14 additions & 5 deletions manim/_config/cli_colors.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
"""Parses CLI context settings from the configuration file and returns a Cloup Context settings dictionary.

This module reads configuration values for help formatting, theme styles, and alignment options
used when rendering command-line interfaces in Manim.
"""

from __future__ import annotations

import configparser
Expand All @@ -9,7 +15,7 @@


def parse_cli_ctx(parser: configparser.SectionProxy) -> dict[str, Any]:
formatter_settings: dict[str, str | int] = {
formatter_settings: dict[str, str | int | None] = {
"indent_increment": int(parser["indent_increment"]),
"width": int(parser["width"]),
"col1_max_width": int(parser["col1_max_width"]),
Expand All @@ -28,6 +34,7 @@ def parse_cli_ctx(parser: configparser.SectionProxy) -> dict[str, Any]:
"col2",
"epilog",
}
# Extract and apply any style-related keys defined in the config section.
for k, v in parser.items():
if k in theme_keys and v:
theme_settings.update({k: Style(v)})
Expand All @@ -37,22 +44,24 @@ def parse_cli_ctx(parser: configparser.SectionProxy) -> dict[str, Any]:
if theme is None:
formatter = HelpFormatter.settings(
theme=HelpTheme(**theme_settings),
**formatter_settings, # type: ignore[arg-type]
**formatter_settings,
)
elif theme.lower() == "dark":
formatter = HelpFormatter.settings(
theme=HelpTheme.dark().with_(**theme_settings),
**formatter_settings, # type: ignore[arg-type]
**formatter_settings,
)
elif theme.lower() == "light":
formatter = HelpFormatter.settings(
theme=HelpTheme.light().with_(**theme_settings),
**formatter_settings, # type: ignore[arg-type]
**formatter_settings,
)

return Context.settings(
return_val: dict[str, Any] = Context.settings(
align_option_groups=parser["align_option_groups"].lower() == "true",
align_sections=parser["align_sections"].lower() == "true",
show_constraints=True,
formatter_settings=formatter,
)

return return_val
6 changes: 5 additions & 1 deletion manim/_config/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,10 +122,14 @@ def make_config_parser(
# read_file() before calling read() for any optional files."
# https://docs.python.org/3/library/configparser.html#configparser.ConfigParser.read
parser = configparser.ConfigParser()
logger.info(f"Reading config file: {library_wide}")
with library_wide.open() as file:
parser.read_file(file) # necessary file

other_files = [user_wide, Path(custom_file) if custom_file else folder_wide]
for path in other_files:
if path.exists():
logger.info(f"Reading config file: {path}")
parser.read(other_files) # optional files

return parser
Expand Down Expand Up @@ -1414,7 +1418,7 @@ def window_position(self, value: str) -> None:

@property
def window_size(self) -> str:
"""The size of the opengl window. 'default' to automatically scale the window based on the display monitor."""
"""The size of the opengl window as 'width,height' or 'default' to automatically scale the window based on the display monitor."""
return self._d["window_size"]

@window_size.setter
Expand Down
20 changes: 10 additions & 10 deletions manim/animation/animation.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
__all__ = ["Animation", "Wait", "Add", "override_animation"]


from collections.abc import Iterable, Sequence
from collections.abc import Callable, Iterable, Sequence
from copy import deepcopy
from functools import partialmethod
from typing import TYPE_CHECKING, Any, Callable
from typing import TYPE_CHECKING, Any

from typing_extensions import Self

Expand Down Expand Up @@ -120,7 +120,7 @@ def __new__(
if func is not None:
anim = func(mobject, *args, **kwargs)
logger.debug(
f"The {cls.__name__} animation has been is overridden for "
f"The {cls.__name__} animation has been overridden for "
f"{type(mobject).__name__} mobjects. use_override = False can "
f" be used as keyword argument to prevent animation overriding.",
)
Expand All @@ -129,7 +129,7 @@ def __new__(

def __init__(
self,
mobject: Mobject | None,
mobject: Mobject | OpenGLMobject | None,
lag_ratio: float = DEFAULT_ANIMATION_LAG_RATIO,
run_time: float = DEFAULT_ANIMATION_RUN_TIME,
rate_func: Callable[[float], float] = smooth,
Expand All @@ -140,7 +140,7 @@ def __init__(
introducer: bool = False,
*,
_on_finish: Callable[[], None] = lambda _: None,
**kwargs,
use_override: bool = True, # included here to avoid TypeError if passed from a subclass' constructor
) -> None:
self._typecheck_input(mobject)
self.run_time: float = run_time
Expand All @@ -160,8 +160,6 @@ def __init__(
else:
self.starting_mobject: Mobject = Mobject()
self.mobject: Mobject = mobject if mobject is not None else Mobject()
if kwargs:
logger.debug("Animation received extra kwargs: %s", kwargs)

if hasattr(self, "CONFIG"):
logger.error(
Expand Down Expand Up @@ -264,11 +262,11 @@ def _setup_scene(self, scene: Scene) -> None:
):
scene.add(self.mobject)

def create_starting_mobject(self) -> Mobject:
def create_starting_mobject(self) -> Mobject | OpenGLMobject:
# Keep track of where the mobject starts
return self.mobject.copy()

def get_all_mobjects(self) -> Sequence[Mobject]:
def get_all_mobjects(self) -> Sequence[Mobject | OpenGLMobject]:
"""Get all mobjects involved in the animation.

Ordering must match the ordering of arguments to interpolate_submobject
Expand Down Expand Up @@ -498,6 +496,8 @@ def __init_subclass__(cls, **kwargs) -> None:

cls._original__init__ = cls.__init__

_original__init__ = __init__ # needed if set_default() is called with no kwargs directly from Animation

@classmethod
def set_default(cls, **kwargs) -> None:
"""Sets the default values of keyword arguments.
Expand Down Expand Up @@ -540,7 +540,7 @@ def construct(self):


def prepare_animation(
anim: Animation | mobject._AnimationBuilder,
anim: Animation | mobject._AnimationBuilder | opengl_mobject._AnimationBuilder,
) -> Animation:
r"""Returns either an unchanged animation, or the animation built
from a passed animation factory.
Expand Down
Loading
Loading