Compare commits

..

486 commits

Author SHA1 Message Date
dependabot[bot]
0e83f4b09a
chore(deps): bump jupyterlab from 4.5.7 to 4.5.9 (#4822)
---
updated-dependencies:
- dependency-name: jupyterlab
  dependency-version: 4.5.9
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-06-20 13:14:07 -04:00
dependabot[bot]
f7fd708276
chore(deps): bump jupyter-server from 2.18.0 to 2.20.0 (#4821)
Bumps [jupyter-server](https://github.com/jupyter-server/jupyter_server) from 2.18.0 to 2.20.0.
- [Release notes](https://github.com/jupyter-server/jupyter_server/releases)
- [Changelog](https://github.com/jupyter-server/jupyter_server/blob/main/CHANGELOG.md)
- [Commits](https://github.com/jupyter-server/jupyter_server/compare/v2.18.0...v2.20.0)

---
updated-dependencies:
- dependency-name: jupyter-server
  dependency-version: 2.20.0
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-06-20 11:22:50 -04:00
Caffein3
4c4622df54
feat: support multiple TeX compilers in TexTemplate (#4810)
* feat: support multiple compilations

Allow `tex_compiler` to be a `str | list[str]` instead of just
`str`. When a list is given, document will be compiled sequentially.

* fix: suppress compilation progress log when only one compiler is used

* fix: updated docstrings and variable naming
2026-06-16 22:35:14 -04:00
dependabot[bot]
66d5a4937a
chore(deps): bump bleach from 6.3.0 to 6.4.0 (#4814)
Bumps [bleach](https://github.com/mozilla/bleach) from 6.3.0 to 6.4.0.
- [Changelog](https://github.com/mozilla/bleach/blob/main/CHANGES)
- [Commits](https://github.com/mozilla/bleach/compare/v6.3.0...v6.4.0)

---
updated-dependencies:
- dependency-name: bleach
  dependency-version: 6.4.0
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-06-17 01:49:15 +00:00
dependabot[bot]
c07137dbed
chore(deps): bump tornado from 6.5.5 to 6.5.7 (#4813)
Bumps [tornado](https://github.com/tornadoweb/tornado) from 6.5.5 to 6.5.7.
- [Changelog](https://github.com/tornadoweb/tornado/blob/master/docs/releases.rst)
- [Commits](https://github.com/tornadoweb/tornado/compare/v6.5.5...v6.5.7)

---
updated-dependencies:
- dependency-name: tornado
  dependency-version: 6.5.7
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-06-17 01:33:08 +00:00
dependabot[bot]
71ab85f960
chore(deps): bump idna from 3.11 to 3.15 (#4736)
Bumps [idna](https://github.com/kjd/idna) from 3.11 to 3.15.
- [Release notes](https://github.com/kjd/idna/releases)
- [Changelog](https://github.com/kjd/idna/blob/master/HISTORY.md)
- [Commits](https://github.com/kjd/idna/compare/v3.11...v3.15)

---
updated-dependencies:
- dependency-name: idna
  dependency-version: '3.15'
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Francisco Manríquez Novoa <49853152+chopan050@users.noreply.github.com>
2026-06-17 01:09:58 +00:00
dependabot[bot]
16f0a3de3e
chore(deps): bump urllib3 from 2.6.3 to 2.7.0 (#4729)
Bumps [urllib3](https://github.com/urllib3/urllib3) from 2.6.3 to 2.7.0.
- [Release notes](https://github.com/urllib3/urllib3/releases)
- [Changelog](https://github.com/urllib3/urllib3/blob/main/CHANGES.rst)
- [Commits](https://github.com/urllib3/urllib3/compare/2.6.3...2.7.0)

---
updated-dependencies:
- dependency-name: urllib3
  dependency-version: 2.7.0
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Francisco Manríquez Novoa <49853152+chopan050@users.noreply.github.com>
2026-06-17 00:58:29 +00:00
dependabot[bot]
537a134360
chore(deps): bump mistune from 3.2.0 to 3.2.1 (#4725)
Bumps [mistune](https://github.com/lepture/mistune) from 3.2.0 to 3.2.1.
- [Release notes](https://github.com/lepture/mistune/releases)
- [Changelog](https://github.com/lepture/mistune/blob/main/docs/changes.rst)
- [Commits](https://github.com/lepture/mistune/compare/v3.2.0...v3.2.1)

---
updated-dependencies:
- dependency-name: mistune
  dependency-version: 3.2.1
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-06-16 23:49:46 +00:00
dependabot[bot]
b7bf2ea90f
chore(deps): bump docker/setup-buildx-action from 3 to 4 (#4716)
Bumps [docker/setup-buildx-action](https://github.com/docker/setup-buildx-action) from 3 to 4.
- [Release notes](https://github.com/docker/setup-buildx-action/releases)
- [Commits](https://github.com/docker/setup-buildx-action/compare/v3...v4)

---
updated-dependencies:
- dependency-name: docker/setup-buildx-action
  dependency-version: '4'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Francisco Manríquez Novoa <49853152+chopan050@users.noreply.github.com>
2026-06-16 22:42:37 +00:00
dependabot[bot]
bdaf4497b7
chore(deps): bump jupyterlab from 4.5.2 to 4.5.7 (#4713)
Bumps [jupyterlab](https://github.com/jupyterlab/jupyterlab) from 4.5.2 to 4.5.7.
- [Release notes](https://github.com/jupyterlab/jupyterlab/releases)
- [Changelog](https://github.com/jupyterlab/jupyterlab/blob/main/RELEASE.md)
- [Commits](https://github.com/jupyterlab/jupyterlab/compare/@jupyterlab/lsp@4.5.2...@jupyterlab/lsp@4.5.7)

---
updated-dependencies:
- dependency-name: jupyterlab
  dependency-version: 4.5.7
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-06-16 22:05:50 +00:00
dependabot[bot]
037b376ec2
chore(deps): bump notebook from 7.5.2 to 7.5.6 (#4712)
Bumps [notebook](https://github.com/jupyter/notebook) from 7.5.2 to 7.5.6.
- [Release notes](https://github.com/jupyter/notebook/releases)
- [Changelog](https://github.com/jupyter/notebook/blob/@jupyter-notebook/tree@7.5.6/CHANGELOG.md)
- [Commits](https://github.com/jupyter/notebook/compare/@jupyter-notebook/tree@7.5.2...@jupyter-notebook/tree@7.5.6)

---
updated-dependencies:
- dependency-name: notebook
  dependency-version: 7.5.6
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Francisco Manríquez Novoa <49853152+chopan050@users.noreply.github.com>
2026-06-16 17:46:31 -04:00
dependabot[bot]
e9639c2697
chore(deps): bump nbconvert from 7.17.0 to 7.17.1 (#4702)
Bumps [nbconvert](https://github.com/jupyter/nbconvert) from 7.17.0 to 7.17.1.
- [Release notes](https://github.com/jupyter/nbconvert/releases)
- [Changelog](https://github.com/jupyter/nbconvert/blob/main/CHANGELOG.md)
- [Commits](https://github.com/jupyter/nbconvert/compare/v7.17.0...v7.17.1)

---
updated-dependencies:
- dependency-name: nbconvert
  dependency-version: 7.17.1
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Francisco Manríquez Novoa <49853152+chopan050@users.noreply.github.com>
2026-06-16 21:13:42 +00:00
dependabot[bot]
1b2d5ce72b
chore(deps-dev): bump pytest from 9.0.2 to 9.0.3 (#4688)
Bumps [pytest](https://github.com/pytest-dev/pytest) from 9.0.2 to 9.0.3.
- [Release notes](https://github.com/pytest-dev/pytest/releases)
- [Changelog](https://github.com/pytest-dev/pytest/blob/main/CHANGELOG.rst)
- [Commits](https://github.com/pytest-dev/pytest/compare/9.0.2...9.0.3)

---
updated-dependencies:
- dependency-name: pytest
  dependency-version: 9.0.3
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Francisco Manríquez Novoa <49853152+chopan050@users.noreply.github.com>
2026-06-16 20:38:28 +00:00
dependabot[bot]
c94a7ea9fc
chore(deps): bump pillow from 12.1.1 to 12.2.0 (#4687)
Bumps [pillow](https://github.com/python-pillow/Pillow) from 12.1.1 to 12.2.0.
- [Release notes](https://github.com/python-pillow/Pillow/releases)
- [Changelog](https://github.com/python-pillow/Pillow/blob/main/CHANGES.rst)
- [Commits](https://github.com/python-pillow/Pillow/compare/12.1.1...12.2.0)

---
updated-dependencies:
- dependency-name: pillow
  dependency-version: 12.2.0
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Francisco Manríquez Novoa <49853152+chopan050@users.noreply.github.com>
2026-06-16 20:10:01 +00:00
dependabot[bot]
bb1be6ef8a
chore(deps): bump actions/upload-artifact from 6 to 7 (#4620)
Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 6 to 7.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](https://github.com/actions/upload-artifact/compare/v6...v7)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-version: '7'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Francisco Manríquez Novoa <49853152+chopan050@users.noreply.github.com>
2026-06-16 19:48:22 +00:00
rsn
516c8c8ba7
Fix ThreeDScene.set_to_default_angled_camera_orientation() (#4704)
Co-authored-by: neeh <rapetisiddhu@gmail.com>
Co-authored-by: Francisco Manríquez Novoa <49853152+chopan050@users.noreply.github.com>
2026-06-16 15:20:18 -04:00
Mayank Basena
ccee37a614
Add docstring to GenericGraph.__getitem__() (#4761)
Allows accessing edges via tuple keys like g[(1, 2)] in addition to
vertex lookups like g[1]. Previously only vertex lookups were supported.

Fixes ManimCommunity/manim#3798

Co-authored-by: Francisco Manríquez Novoa <49853152+chopan050@users.noreply.github.com>
2026-06-16 18:52:42 +00:00
dependabot[bot]
31db147222
chore(deps): bump jupyter-server from 2.17.0 to 2.18.0 (#4720)
Bumps [jupyter-server](https://github.com/jupyter-server/jupyter_server) from 2.17.0 to 2.18.0.
- [Release notes](https://github.com/jupyter-server/jupyter_server/releases)
- [Changelog](https://github.com/jupyter-server/jupyter_server/blob/main/CHANGELOG.md)
- [Commits](https://github.com/jupyter-server/jupyter_server/compare/v2.17.0...v2.18.0)

---
updated-dependencies:
- dependency-name: jupyter-server
  dependency-version: 2.18.0
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Francisco Manríquez Novoa <49853152+chopan050@users.noreply.github.com>
2026-06-16 17:57:48 +00:00
GniLudio
34124c3f60
Fix wrong type annotation of Animation._on_finish (#4812) 2026-06-16 13:11:45 -04:00
Benjamin Hackl
d999d422c9
Introduce first-class support for rendering text and markup via Typst (optional dependency) (#4681)
* feat: add TypstMobject and TypstMathMobject for first-class Typst support

Implement the initial TypstMobject proposal (see agents/typst.md):

- TypstMobject: renders arbitrary Typst markup to SVG via the 'typst'
  Python package (self-contained Rust binary, no system install needed),
  then imports through SVGMobject.
- TypstMathMobject: convenience subclass that wraps input in Typst math
  delimiters ($ ... $).

Pipeline: user string → wrap in minimal Typst document (auto-sized page,
transparent background) → write .typ file → compile to SVG via
typst.compile() → import via SVGMobject → scale/center/recolor.

Key details:
- Compilation helper in manim/utils/typst_file_writing.py with SHA-256
  content-hash caching (same scheme as the LaTeX pipeline).
- font_size property mirrors SingleStringMathTex: compile at fixed 11pt,
  scale after import using initial_height / SCALE_FACTOR_PER_FONT_POINT.
- init_colors() recolors black submobjects to self.color (Typst default
  fill is black), preserving any explicit Typst colors.
- path_string_config enables curve subdivision for smooth animation.
- 'typst' added as optional dependency group in pyproject.toml.
- 10 tests covering creation, font_size, caching, preamble, and repr.

* feat(typst): add sub-expression selection via {{ }} groups and .select()

- Override modify_xml_tree in Typst to convert data-typst-label
  attributes to id attributes before svgelements parsing (avoids
  attribute inheritance issue with data-* attributes)
- Add Typst.select(key) method accepting str labels or int indices
  to retrieve VGroup sub-expressions from id_to_vgroup_dict
- Implement {{ }} double-brace preprocessor on TypstMath:
  - {{ content }} → manimgrp("_grp-N", content) (auto-numbered)
  - {{ content : label }} → manimgrp("label", content) (named)
  - Skips {{ }} inside string literals and [...] content blocks
  - Uses math-mode call convention (no # prefix) to keep args in
    math mode
- Auto-inject manimgrp preamble when groups are detected
- Add 12 new tests covering label mapping, nesting, select(),
  error handling, and preprocessor edge cases

* Remove unneeded assert line

* Generalize some more critical hard-coded LaTeX assumptions

* Fix syntax error

* Support Typst labels in existing APIs

* Add ManimTextLabel typing alias

* Preserve Typst SVG stroke widths by default

* Calibrate Typst font sizing against TeX

* Add Typst mobject documentation

* Track Typst baseline frames

* Document Typst baseline frame tracking

* Add Typst section to text guide

* Polish Typst docs and label handling

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Improve Typst stroke scaling and docs examples

* Tune Typst SVG stroke scaling

* Restore Typst math example wording

* Fix pre-commit issues for Typst branch

* Fix number line runtime typing import

* Exclude Typst autogenerated .rst files

* Use Manim directive in docstrings and fix wrong key in Typst.select() docstring

* Fix GroupedMath comments

---------

Co-authored-by: Toon Verstraelen <Toon.Verstraelen@UGent.be>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Francisco Manríquez Novoa <49853152+chopan050@users.noreply.github.com>
Co-authored-by: Francisco Manríquez Novoa <francisco.manriquezn@usm.cl>
2026-06-11 03:54:21 +00:00
GniLudio
561de9d72a
Use language parameter to format Code even when passing code_file (#4706)
Co-authored-by: Francisco Manríquez Novoa <49853152+chopan050@users.noreply.github.com>
2026-06-10 21:49:59 +00:00
Sai Sridhar Tarra
05b3042ab0
Add tests for edge lookup in GenericGraph.__getitem__() (#4753)
GenericGraph.__getitem__ only handled vertex lookup. Passing a 2-tuple
(u, v) to retrieve an edge mobject raised a KeyError against the
vertices dict instead of looking up self.edges.

Route tuple keys of length 2 to self.edges so that g[(u, v)] returns
the edge mobject, consistent with how edges are stored internally.

Adds a test covering vertex lookup, edge lookup (Graph), and edge
lookup (DiGraph).

Fixes #3798

Co-authored-by: Francisco Manríquez Novoa <49853152+chopan050@users.noreply.github.com>
2026-06-10 17:34:39 -04:00
HairlessVillager
2ece488b2c
Support edge lookup via tuple in GenericGraph.__getitem__() (#3799)
* feat: add tuple key support in GenericGraph.__getitem__()

* feat: add an error message for missing vertice or edge

Co-authored-by: adeshpande <110117391+JasonGrace2282@users.noreply.github.com>

* docs: add an example

* fix: tuple vertex return edge

---------

Co-authored-by: adeshpande <110117391+JasonGrace2282@users.noreply.github.com>
Co-authored-by: Francisco Manríquez Novoa <49853152+chopan050@users.noreply.github.com>
2026-06-10 17:19:24 -04:00
Guillaume Vauvert
852ebd1c60
Fix empty submobjects distorting width/height of parent Mobject (#4088)
* Issue-4087 Add bug test

* Issue-4087 Fix bug

* Issue-4087 Fix comment and add type hint

* Issue-4087 Fix comment

* Issue-4087 Improve previous test instead of adding a new one

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update tests/module/mobject/mobject/test_mobject.py

* Enhance docstring for reduce_across_dimension method

Updated docstring for reduce_across_dimension method to clarify its purpose and parameters.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Remove float typehints for coords in length_over_dim

* Modify test for empty VMobject dimensions

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: Francisco Manríquez Novoa <49853152+chopan050@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2026-06-10 16:21:52 -04:00
Irvanal Haq
82522795f1
Allow CyclicReplace and Swap to accept single Group or VGroup and add example (#4211)
* Allow Swap to accept Group and VGroup and add example

* Modify create_target return type to Group | VGroup

Updated create_target method to allow returning either Group or VGroup.

---------

Co-authored-by: Francisco Manríquez Novoa <49853152+chopan050@users.noreply.github.com>
2026-06-09 17:33:12 -04:00
Henrik Skov Midtiby
12c5640a32
Add type annotations to transform_matching_parts.py (#4400)
* Add type annotations to `transform_matching_parts.py`

* Make two type errors quiet

* Make the pytests pass

---------

Co-authored-by: Francisco Manríquez Novoa <49853152+chopan050@users.noreply.github.com>
2026-06-09 17:11:01 -04:00
Laszlo
33424fe43d
More specific Callable type annotations in mobject_update_utils (#4728)
* More specific Callable type annotations in mobject_update_utils

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2026-06-03 17:02:00 +00:00
Leonardo Cariaggi
1b3390073c
Allow excluding inner lines of Table (#4731)
* Add option to hide/show inner lines in Table class

* Add tests for Table class inner lines visibility

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Correct indentation

* Fix os.startfile usage to check for availability on Windows

* Add ConversationFlowScene to animate user-chatbot interactions and metadata display

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Revert "Merge remote-tracking branch 'origin/conversation' into hide_table_inner_lines"

This reverts commit c0ba5b8511, reversing
changes made to 1f71f4b0e8.

* Revert change

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Leonardo Cariaggi <leonardo.cariaggi@kbc.be>
Co-authored-by: Francisco Manríquez Novoa <49853152+chopan050@users.noreply.github.com>
2026-06-03 09:06:03 -04:00
Rafael Brusiquesi Martins
56f7eb2a1f
Add regression tests for four recent fixes in vectorized_mobject.py (#4750)
* Add regression tests for four recent fixes in vectorized_mobject.py

Adds four regression tests for fixes that landed without tests in the same PR:

  * 21cf9998 (PR #4630, fixes #3569 + #4629) -- IndexError in
    `get_nth_subpath` when `path_list` is empty; ensure it always returns
    a NumPy array.

  * f6cdb547 (PR #4219) -- `add_points_as_corners` silently dropped a
    single new point when called on a VMobject whose last subpath was
    complete.

  * 3d029c12 (PR #4320, fixes #4255) -- `pointwise_become_partial` cleared
    the target's points when the source had no cubic curves, surfacing as
    `Arrow3D.get_start()` / `get_end()` returning the origin after a
    `Create` animation.

  * 429f25328 (PR #4694) -- `scale(scale_stroke=True)` on a compound
    VMobject propagated the parent's scaled stroke width to every
    submobject, overwriting submobjects with their own (e.g. zero) stroke.

Each test reproduces the original failing condition at the unit level
and asserts the post-fix behavior. Validation: every test was confirmed
to fail when the corresponding fix is reverted on the source file, and
pass when the fix is restored.

4 tests, ~0.2s runtime. Tests go in the existing files
`tests/module/mobject/types/vectorized_mobject/test_vectorized_mobject.py`
(three tests, adjacent to their topically-related siblings) and
`tests/module/mobject/types/vectorized_mobject/test_stroke.py` (one test,
next to the existing `test_stroke_scale`).

Co-authored-by: LetMarq <LetMarq@users.noreply.github.com>

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: THE-RAF <THE-RAF@users.noreply.github.com>
Co-authored-by: LetMarq <LetMarq@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Francisco Manríquez Novoa <49853152+chopan050@users.noreply.github.com>
2026-06-02 21:53:49 +00:00
Rafael Brusiquesi Martins
cfb5c684b7
Add unit tests for module-level color helpers in manim/utils/color/core.py (#4749)
* Add unit tests for module-level color helpers in manim/utils/color/core.py

Adds tests/module/utils/test_color_helpers.py covering the standalone
helper functions exported from manim.utils.color.core (color_to_rgb,
color_to_rgba, color_to_int_rgb, color_to_int_rgba, rgb_to_color,
rgba_to_color, rgb_to_hex, hex_to_rgb, invert_color, color_gradient,
interpolate_color, average_color, random_bright_color, random_color)
and the RandomColorGenerator class.

Before this PR, only the ManimColor class itself was tested
(via tests/module/utils/test_manim_color.py); the standalone helpers
had zero direct test coverage. Coverage on manim/utils/color/core.py
goes from 71% to 80% (line+branch), and 17 of the 18 testable symbols
in the file's __all__ are now exercised. The only deferred symbol is
get_shaded_rgb, which concerns lighting math rather than color
conversion and is better suited to a follow-up.

42 tests, ~0.3s runtime, no new dependencies.

Co-authored-by: LetMarq <LetMarq@users.noreply.github.com>

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update tests/module/utils/test_color_helpers.py

Increased assertion scheme to cover all colors.

Co-authored-by: Francisco Manríquez Novoa <49853152+chopan050@users.noreply.github.com>

---------

Co-authored-by: THE-RAF <THE-RAF@users.noreply.github.com>
Co-authored-by: LetMarq <LetMarq@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Francisco Manríquez Novoa <49853152+chopan050@users.noreply.github.com>
2026-05-29 17:23:28 -04:00
Vihaan Dutta
429f25328d
Fixed inconsistent stroke width scaling for text in compound objects (#4694)
* fixed zero-stroke mobject scaling

* updated vectorized_mobject scale docstring text
2026-04-19 16:10:14 -04:00
GoThrones
c45724989d
Refactor`Mobject.put_start_and_end_on() to shift Mobject to start when it's a closed curve (#4658)
* fix: preserve geometry in put_start_and_end_on for zero-vector mobjects

* fix: preserve geometry in put_start_and_end_on for zero-vector mobjects

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* fixed asser_array_equal line

* removed commets in mobject.py and opengl_mobject.py as suggested

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* added stacklevel=2 suggestion

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Francisco Manríquez Novoa <49853152+chopan050@users.noreply.github.com>
2026-04-14 19:57:06 +00:00
dependabot[bot]
af70b6fef2
chore(deps-dev): bump requests from 2.32.5 to 2.33.0 (#4659)
Bumps [requests](https://github.com/psf/requests) from 2.32.5 to 2.33.0.
- [Release notes](https://github.com/psf/requests/releases)
- [Changelog](https://github.com/psf/requests/blob/main/HISTORY.md)
- [Commits](https://github.com/psf/requests/compare/v2.32.5...v2.33.0)

---
updated-dependencies:
- dependency-name: requests
  dependency-version: 2.33.0
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-04-07 01:57:29 +00:00
dependabot[bot]
4b32312dd1
chore(deps): bump tornado from 6.5.4 to 6.5.5 (#4635)
Bumps [tornado](https://github.com/tornadoweb/tornado) from 6.5.4 to 6.5.5.
- [Changelog](https://github.com/tornadoweb/tornado/blob/master/docs/releases.rst)
- [Commits](https://github.com/tornadoweb/tornado/compare/v6.5.4...v6.5.5)

---
updated-dependencies:
- dependency-name: tornado
  dependency-version: 6.5.5
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Francisco Manríquez Novoa <49853152+chopan050@users.noreply.github.com>
2026-04-07 01:43:47 +00:00
GoThrones
90141df105
Change VMobject._bezier_t_values typehint to ndarray of np.float64 (#4675)
Co-authored-by: Francisco Manríquez Novoa <49853152+chopan050@users.noreply.github.com>
2026-04-06 17:02:25 +00:00
Benjamin Hackl
82f93b6c3c
chore: combine dependabot updates for CI retest (#4677)
Includes the changes from PRs #4666, #4668, #4669, #4670, and #4671.

Co-authored-by: Francisco Manríquez Novoa <49853152+chopan050@users.noreply.github.com>
2026-04-06 12:19:30 -04:00
Francisco Manríquez Novoa
752b46a003
Update TinyTeX Windows/macOS installation in ci.yml to fix failing pipelines (#4679)
* Update TinyTeX installation method in CI workflow

* Fix path execution for TinyTex Windows installer
2026-04-06 11:59:03 -04:00
Mingqi Geng
21cf9998cc
Fix IndexError in get_nth_subpath() and ensure it always returns a NumPy array (#4630)
* fix #3569 and #4629

* Add changes to opengl_vectorized_mobject.py

---------

Co-authored-by: Francisco Manríquez Novoa <49853152+chopan050@users.noreply.github.com>
2026-03-18 11:15:45 -03:00
Henrik Skov Midtiby
ebb230f6f1
Update link in pyproject.toml to X / Twitter (#4642) 2026-03-18 13:40:16 +00:00
Xiuyuan (Jack) Yuan
46177d247e
Fix wrong angle ranges in Sphere documentation and add more examples (#3973)
* Made the document changes

* added additional example

* Apply some suggestions from code review

Co-authored-by: Francisco Manríquez Novoa <49853152+chopan050@users.noreply.github.com>

* Shorten sphere examples

* Fix line breaks and remove trailing whitespace

* Add example for showing portions of spheres

* Undo accidental overwrite of ExampleSphereOverlap

* Change name of manim code block

---------

Co-authored-by: Xiuyuan <u7678992@anu.edu.au>
Co-authored-by: TahitiX <136950383+TahitiX@users.noreply.github.com>
Co-authored-by: Francisco Manríquez Novoa <49853152+chopan050@users.noreply.github.com>
Co-authored-by: Francisco Manríquez Novoa <francisco.manriquezn@usm.cl>
2026-03-18 00:28:52 -03:00
Henrik Skov Midtiby
468929889b
Add type annotations to mobject.py (#4388)
* Add type annotations to `mobject.py`

* More work on type annotations for mobject.py

* ...

* Almost handled all mypy errors

* Add the mypy error messages to the lines that trigger them

* Use typing.cast to avoid some mypy errors, as suggested by JasonGrace2282

* Used the ruff linter

* Fixed one typing issue and added the error descriptions to the source code for the remaning 10 errors

* Set the type of the elements in a VGroup to VMobject

* Use typing.cast to handle some specific cases.

* Code cleaning

* Updates

* When started to use typing.cast it is needed to import / define certain elements during runtime and not only during type checking

* Fix bug introduced with the type annotations.

* Made it work again

* ..

* Fixed more issues.

* Code cleanup

* Code cleanup.

Replace self.lines with self.lines_chars and self.lines_alignment.

* Handle slicing when accessing elements inside a VGroup

* Fix missing issues.

* Silence the last mypy error

* Make _Updater, _NonTimeBasedUpdater and _TimeBasedUpdater private.

* Replace | with Union[...] in one location

* Move import of Union

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Remove comment that is no longer relevant

* Overload the auto_zoom method in MovingCamera to provide better type hinting

* Codecleanup

* Code cleanup

* Renamed lines_alignment to lines_alignments and added a TODO about a future cleanup task

* More code cleanup

* Update manim/mobject/matrix.py

Co-authored-by: Francisco Manríquez Novoa <49853152+chopan050@users.noreply.github.com>

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Addressing multiple comments from Chopan50

* Implementing more suggestions from Chopan50

* More suggestions by Chopan50

* ...

* More renaming and code cleanup, as suggested by Chopan50

* Restructure code

* anim_args

* Update typing in vector_space_scene

* Implemented a number of suggestions from chopan50

* Make a list of faces with the type list[ThreeDVMobject]

* Ensure to return a VGroup if slicing is used.

* Revert back to the original code in text_mobject.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Add the propagate_colors option to Mobject as it is used by VMobject.

Replace Self with _UpdateBuilder

* Simplify code

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Francisco Manríquez Novoa <49853152+chopan050@users.noreply.github.com>
2026-03-11 20:33:21 -03:00
xuruidong
98c458b6b2
docs(quickstart): fix incorrect terminology for SquareToCircle (#4631) 2026-03-08 09:47:57 +01:00
Colin Belhomme
d4af5b2baa
fix: fix cast crash in OpenGLMobject.arrange_in_grid() and OpenGLPoint.get_location() (#4622)
Added quotes to Vector3D and to Point3D to match other calls to `cast`, such has Chopan suggested

Issue #4550: https://github.com/ManimCommunity/manim/issues/4550

Co-authored-by: Colin Belhomme <colin.belhomme@telecom-paris.fr>
2026-03-03 23:48:31 -03:00
Benjamin Hackl
1157b746c3
Prepare new release: v0.20.1 (#4615)
* bump version, regenerate lockfile, changelog 1st pass

* fix two docbuild warnings

* update changelog, include newly merged PR + review suggestion
2026-02-27 08:09:59 +01:00
Irvanal Haq
6f825e8513
Fix unintended kwargs propagation in LaggedStartMap (#4613)
* Fix unintended kwargs propagation in LaggedStartMap

Ensure  intended for  are not forwarded to the superclass, and make  explicit.

* add test for keyword propagation in LaggedStartMap

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update test_composition.py

update the test

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update test_composition.py

add there_and_back

---------

Co-authored-by: Benjamin Hackl <mail@behackl.dev>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2026-02-27 07:14:28 +01:00
Henrik Skov Midtiby
a0414dccec
Add type annotations to manim/_config/utils.py (#4230)
* Stop ignoring  manim._config erros in mypy.ini

* Aspect ratio should be a float.

* Handled more mypy issues in _config/utils.py

* Handled more mypy issues in _config/utils.py

* Removed two assert statements that triggered errors in the unittests.

* Fix last mypy issue in utils.py and activate mypy checking

* Fix type of window_size in opengl_renderer_window.py

* ...

---------

Co-authored-by: F. Muenkel <25496279+fmuenkel@users.noreply.github.com>
Co-authored-by: Francisco Manríquez Novoa <49853152+chopan050@users.noreply.github.com>
Co-authored-by: Benjamin Hackl <devel@benjamin-hackl.at>
2026-02-22 22:15:16 +00:00
Benjamin Hackl
33a0e56d73
enhancement: optimize Docker image build and runtime footprint (#4604)
* docker: add libgl1 runtime dependency for OpenGL

* docker: tighten .dockerignore for smaller build context

* docs(docker): add runtime notes for latest image

* docs(docker): note ctex is not included by default

---------

Co-authored-by: Francisco Manríquez Novoa <49853152+chopan050@users.noreply.github.com>
2026-02-22 17:29:18 -03:00
Benjamin Hackl
80fd11efbc
Suppress pydub ffmpeg warning on import (#4603)
Co-authored-by: Henrik Skov Midtiby <hemi@mmmi.sdu.dk>
2026-02-22 19:30:13 +00:00
Piyush Acharya
498f0b9c89
docs: add alt text to all images for accessibility (#4064)
Co-authored-by: Benjamin Hackl <devel@benjamin-hackl.at>
2026-02-22 12:51:39 +01:00
Matvey Merzlikin
87cd63549c
Add support for negative z-index in AnimationGroup (#4389)
* Add support for negative z-index in AnimationGroup

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Refactor animation unpacking logic for clarity

* Fix unpacking logic to handle Mobject instances correctly

* Fix mypy check

* Fix tests

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* fix: simplify AnimationGroup unpacking for moving mobjects

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Benjamin Hackl <devel@benjamin-hackl.at>
2026-02-22 11:24:32 +00:00
u7920349
cd370610c5
Documentation: manual installation of manim as a local package (#4456)
* Documentation: additonal instalation method

* Typo fix

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* docs: simplify dev-install section and restore PR template checklist

---------

Co-authored-by: CA3000 <93896083+CA3000@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Benjamin Hackl <devel@benjamin-hackl.at>
2026-02-22 11:59:40 +01:00
Josie Thompson
a6af7f3d76
Cleanup TipableVMobject: avoid mutable default and fix assign_tip_attr typo (#4503)
* Small touch-ups before fixing tip bugs
- fixed mutable default argument in Tipable VMobject constructor
- fixed typo in method name assign_tip_attr
- added two todo's which outline unexpected behavior in tip placement and how to solve

* refactor: align tip attr naming and remove TODO comments

---------

Co-authored-by: Benjamin Hackl <devel@benjamin-hackl.at>
2026-02-22 11:36:29 +01:00
Abdelsalam
e34e707858
Fix creation or animation of a zero-length DashedLine (#4606)
* fixing #4591

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2026-02-22 11:10:21 +01:00
Benjamin Hackl
7c1c9258d0
Fix publish release workflow (#4600)
* ci: fix publish release workflow

- Add sudo to apt-get calls (runner is non-root)
- Add contents: write permission for uploading release assets
- Drop uv sync before uv build (unnecessary)
- Replace archived upload-release-asset action and redundant
  Python/requests API script with gh release upload; tag name
  is available directly from the release event context
- Strip leading v from tag name to match built artifact filename

* ci: set bash shell for release asset upload step
2026-02-22 11:05:09 +01:00
Benjamin Hackl
000e7792bd
fix: MathTex double-brace splitting no longer fires on natural LaTeX }} (#4602)
* fix: replace double-brace splitting regex with state-machine parser

The previous re.split(r'{{|}}', ...) call split on any occurrence of
{{ or }} in the input string, which broke strings whose only }} came
from closing two nested LaTeX brace groups (e.g. ^{\frac{Mq}{M+m}}).

The new _split_double_braces() static method uses a character-level
state machine with three guards:

* Escape priority: \\ is consumed before \{ / \}, so \\}} is
  correctly read as an escaped backslash followed by a real }}, not
  misinterpreted as \ + \} + lone }.

* Whitespace-gated opener: {{ is only treated as a Manim group opener
  at the start of the string or after whitespace. Naturally-occurring
  {{ in LaTeX is usually preceded by non-whitespace (e.g. \frac{{{n}}}
  or a^{{2}}), so this eliminates the most common false positives.

* Depth-tracking closer: inside a Manim group, }} only closes the
  group when the inner brace depth is zero, so {{ a^{b^{c}} }} is
  handled correctly and nested LaTeX }} cannot trigger an early close.

Fixes #4601.

* docs: document double-brace whitespace requirement

Add a Notes section to the MathTex docstring explaining:
- how {{ }} splits a string into submobjects
- that {{ must be at start-of-string or preceded by whitespace
- that this leaves natural LaTeX like \frac{{{n}}}{k} untouched
- the { { ... } } escape hatch when a split is not wanted

Apply the same explanation to the double-brace paragraph in
docs/source/guides/using_text.rst.

* fix: use r-string for _split_double_braces docstring, halve backslash escaping
2026-02-22 10:48:51 +01:00
Benjamin Hackl
704830ff5f fix: fix permission problem in python-publish workflow 2026-02-21 00:16:28 +01:00
Benjamin Hackl
d1eea48aa6
Prepare new release, v0.20.0 (#4599)
* fix: resolve parameter shadowing bug in release script changelog command

* chore: bump version to v0.20.0, regenerate lockfile, update citation

* generate v0.20.0 changelog, first round

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* a bit of copyediting, second pass

* include newly merged PR, apply suggestions from review

* Update docs/source/changelog/0.20.0-changelog.md

Co-authored-by: Francisco Manríquez Novoa <49853152+chopan050@users.noreply.github.com>

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Francisco Manríquez Novoa <49853152+chopan050@users.noreply.github.com>
2026-02-20 23:50:31 +01:00
F. Muenkel
9504757918
Replace scipy.special.comb with math.comb (#4598)
Co-authored-by: Francisco Manríquez Novoa <49853152+chopan050@users.noreply.github.com>
2026-02-20 15:15:43 -03:00
Daniel Bates
7eab4c5450
Fix coords_to_point treating single list/array as batch of x-values (#4596)
When a single flat list or 1D numpy array was passed to
`Axes.coords_to_point()` (e.g. `ax.c2p([1, 2])` or
`ax.c2p(np.array([1, 2, 1]))`), the values were incorrectly
interpreted as multiple x-coordinates instead of a single (x, y) or
(x, y, z) point.

This happened because `np.asarray(([1, 2],))` produces a 2D array
with shape (1, N), which fell through to the code path that treats
`coords[0]` as a list of x-values. The fix detects this case
(ndim == 2, shape[0] == 1) and extracts the inner array so it is
handled identically to `c2p(1, 2)`.

Closes ManimCommunity#4073

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 17:31:19 +01:00
GoThrones
fda336978b
docs: improve TransformFromCopy docstring (#4597) 2026-02-20 17:20:08 +01:00
F. Muenkel
ab7cfc54d8
Add type annotations to point_cloud_mobject.py (#4586)
* Add type annotations to point_cloud_mobject.py

* Make reset_points return Self instead of None

* Fix return type of get_array_attrs()

* Change return type of reset_points() to Self in image_mobject.py
2026-02-18 12:59:15 +00:00
Aarush Deshpande
601a007192
Implement Mobject.always (#4594) 2026-02-17 19:47:58 -05:00
F. Muenkel
ab17eb58a3
Add type annotations to ``opengl_image_mobject.py`` (#4536)
* Add type annotations to opengl_image_mobject.py

* Remove mypy entry

---------

Co-authored-by: Francisco Manríquez Novoa <49853152+chopan050@users.noreply.github.com>
2026-02-16 23:27:05 +00:00
Francisco Manríquez Novoa
a5d4ab134c
Fix YELLOW_C and add PURE_CYAN, PURE_MAGENTA and PURE_YELLOW (#4562)
* Fix YELLOW_C and add PURE_CYAN, PURE_MAGENTA and PURE_YELLOW

* update default colors YELLOW -> PURE_YELLOW throughout the library

* chore: format + check

* Modify RandomColorGenerator.next() doctest whose output changed by adding colors

---------

Co-authored-by: Benjamin Hackl <devel@benjamin-hackl.at>
2026-02-16 20:07:09 -03:00
Francisco Manríquez Novoa
f9b12e5d12
Fix ImageMobject 3D rotation/flipping and remove resampling algorithms lanczos (antialias), box and hamming (#4266)
* Fix 3D ImageMobject rotation

* Remove lanczos, box and hamming resampling algorithms

* Consider case where matrix A is singular (points are aligned)

* homographic_matrix -> homography_matrix

* Fix ImageInterpolationEx scene and increase height in ImageInterpolation test

* Regenerate unit test again

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* ManimFloat should probably not be used as dtype

* Import ImageMobject inside TYPE_CHECKING

* Add Camera.points_to_subpixel_coords() and do not render perpendicular images

* Modify algorithm to use height from longest side

* Prevent possible zero division

* Regenerate ImageMobject.npz

* Edit Image.transform() commentary

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Benjamin Hackl <devel@benjamin-hackl.at>
2026-02-16 19:46:01 -03:00
Francisco Manríquez Novoa
ae501baf19
Fix assertion in ImageMobjectFromCamera.interpolate_color() (#4593) 2026-02-16 23:18:47 +01:00
Henrik Skov Midtiby
761bc46cc8
Add type annotations to image_mobject.py (#4458)
Co-authored-by: Francisco Manríquez Novoa <49853152+chopan050@users.noreply.github.com>
2026-02-16 15:28:24 +00:00
Henrik Skov Midtiby
357bb3fbba
Rewrite MathTex to make it more robust regarding splitting (#4515)
* Extracted the method get_mob_from_shape_element

* Moved more functionality to get_mob_from_shape_element

* More cleanup

* Parse the svg file while maintaining the group structure.

* Make the svg groups available

* Handle PERF401 issue

* [pre-commit.ci] pre-commit autoupdate (#4506)

updates:
- [github.com/astral-sh/ruff-pre-commit: v0.14.7 → v0.14.8](https://github.com/astral-sh/ruff-pre-commit/compare/v0.14.7...v0.14.8)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>

* Added an example of the issue

* Experimenting with coloring elements from the latex equation

* ...

* Regular expression can now match more than one object

* Process the string by applying the substrings in the order they match

* Code refactoring and added type annotations

* ...

* Added a lot of test cases

* More examples

* More examples

* Use matched_strings_and_ids to simplify existing methods

* Remove unused code

* Update get_part_by_tex to use matched_strings_and_ids

* This is required for test_MathTable to pass

* Ensure that self.texstring is set.

* Added more examples from exising issues in the github repo

* Ensure that latex groups are maintained by adding an additional pair of curly braces around the extracted part

* ExampleScene -> Scene

* Added comment

* _break_up_by_substrings

* Refactor code

* Added comment to example

* Handle integer inputs well.

* Expose the original tex_string

* Do not treat the content of substrings_to_isolate as regular expressions.

* Updated examples

* Update examples

* Fix SVMobject caching issue.

* Remove traces from brace_notation_split_occurred

* Simplify MathTex::_break_up_by_substrings

* Fix small issue in tex that in some cases moved elements a tiny bit around

* No use of regular expressions for locate substrings.

* Updated notes to the set of test cases

* Handle issues with the center environment.

* Add example

* Fix issue with rectangles (e.g. from sqrt)

* ConvertToOpenGL

* Reduce the number of nesting levels.

* Use the specified arg_seperator

* Deal with the double curly brace markup

* Code cleanup

* Code cleanup

* Rollback a few changes

* Code cleanup

* Adjust paths the generated artefacts in tests that rely on MathTex

* Added a remark to the using text guide on enclosing snippets in curly braces for substrings_to_isolate to work

* Added space around the numerator argument to frac to avoid having double curly braces in the example.

This would otherwise trigger MathTex to split the string at that location.

* Log errors properly and display some information about the errors and their context.

* Code refactoring as suggested by Benjamin

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Benjamin Hackl <devel@benjamin-hackl.at>
2026-02-16 14:22:56 +01:00
F. Muenkel
6e9ec60b6f
Add type annotations to opengl_compatibility.py (#4585)
* Add type annotations to opengl_compatibility.py

* Tighten type hinting on namespace variables
2026-02-12 22:54:29 +00:00
Sacha
c8db165825
Resolve more race conditions potentially happening during directory creation (#4589)
* fixed division by 0

* fixed division by 0

* fixed division by 0

* updated lock file

* Revert "fixed division by 0"

This reverts commit b916a0c9c9.

* Add tests for turn_animation_into_updater with zero/negative run_time

* updated lock file

* tests

* tests

---------

Co-authored-by: Benjamin Hackl <mail@behackl.dev>
2026-02-12 08:18:26 +01:00
dependabot[bot]
b4049bd6c7
Bump pillow from 12.1.0 to 12.1.1 (#4588)
Bumps [pillow](https://github.com/python-pillow/Pillow) from 12.1.0 to 12.1.1.
- [Release notes](https://github.com/python-pillow/Pillow/releases)
- [Changelog](https://github.com/python-pillow/Pillow/blob/main/CHANGES.rst)
- [Commits](https://github.com/python-pillow/Pillow/compare/12.1.0...12.1.1)

---
updated-dependencies:
- dependency-name: pillow
  dependency-version: 12.1.1
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-02-11 16:09:06 -03:00
Oll-iver
8a5267a9ee
Enable strict=True for zip() where safe (#4547)
* sub_alphas is derived directly from to_update so they're guaranteed to be of the same length.

* self.shapes is initialised as a direct copy of the mobject, guaranteed to be of same length.

* linspace in this case guarantees both arrays are of equal size (self.n_segments).

* Any transformation already requires that each datapoint in the first tuple has a corresponding datapoint in the second (ie same length)

* Replaced arange with linspace, eliminates risk of floating point errors and forces rgbas and offset to be the same size for strict=True

* all_arc_configs is either defined specifically by length of point_pairs or strictly forced to be the same length (n). In any case they'll always be the same length so strict=True works.

* There should always be an equal amount of start and end anchors; radius_list is defined directly from the length of vertex_group; both outer_vertices and inner_vertices posess n vertices.

* boundary_times always contains has an even length so both 'slices' in the zup function are the same length.

* colors_in_gradient is defined to be the same length as p_list_complete; labels and parts are seemingly user inputs with no guarantee of equal length; val_range is defined to be same lenght as self.bar_names; however there's no authentication that self.values has a fixed length after it's been defined ie user can append to the list creating a mismatch between len(self.values) and len(self.bars)

* In most cases here, the tuples are either defined to be of same length or manipulated to be by the align_data function. In the match_points function there is currently no validation to ensure both mobjects are the same length.

* Reverting _add_x_axis_labels() zip() function back
to strict=False due to failing test cases

* Reverted strict zip usage

* color_gradient is defined to be same length as p_list_complete & within _add_x_axis_labels we define val_range to be the same length as self.bar_names

* align_data and lock_matching_data have no validation to ensure tuples in the zip() function are of the same length. Every other time zip() is used here it is generally immediately manipulating or explicitly defining the tuples to be of same length

* All tuples in zip() functions here are either clearly the same size or manipulated to be the same size using the make_even function.

* The tuples in the zip() function will clearly be of equal length, the second tuple is simply a cyclic shift of the first.

* In the ingest_submobjects function arrays is a one to one mapping of attrs so they are guaranteed to have equal lengths.

* Every usage of zip() consists of tuples that are either manipulated to be equal size or defined to be equal size.

* the zip() function in bezier_remap will always consist of equal length tuples as current_number_of_curves is read directly from the shape of bezier_tuples and is used to dictate the size of split_factors.

* The zip() function color_gradient() will always consist of equal length tuples as floors is defined directly from alphas (which also defines alphas_mod1)

* The tuples in the zip() function in adjacent_n_tuples will always be the same length so strict=True.

* The find_intersection() contains a zip() function that has been set to strict=True. While it is technically possible to pass tuples to this function that are *not* the same length, this would result in generally unexpected behaviour anyway.

* Changed zip() function to have strict=True in __init__() as custom_labels is dependent on tick_range so guaranteed to have the same length.

* Several instances of zip() set to strict=True. In add_coordinates we have axis manipulated to be the same length as tick_range. In get_riemann_rectangles() we have colors dependent on of x_range_Array forcing them to be the same length. Finally in plot_line_graph()  it is clearly intended that all inputs used in the zip() function are of the same length (except possibly z which may not exist and will be made equal length to x); while it is not guaranteed they will be the same length this would cause unintended behaviour.

* zip() function bool changed to strict=True in all these test cases. Most test cases either a) hardcode two things to be the same length, b) verify things are the same length before the function or c) explicitly exist to check whether two things are the same length.
2026-02-11 10:39:25 +01:00
Tim Hutt
6adc6e4cf6
Add py.typed to declare manim as having type hints (#4553)
* Add py.typed to declare manim as having type hints

This tells tools like Pyright that this package has its own type hints and it should try to look for them in typeshed.

Fixes #4552

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2026-02-11 10:35:12 +01:00
Henrik Skov Midtiby
21e7e0d9c1
Cleaned up mypy.ini (#4584)
Co-authored-by: Benjamin Hackl <devel@benjamin-hackl.at>
2026-02-11 10:04:31 +01:00
Sacha
7efa45492f
Fix TOCTOU Race Conditions when creating directories (#4587)
* fixed division by 0

* fixed division by 0

* fixed division by 0

* updated lock file

* Revert "fixed division by 0"

This reverts commit b916a0c9c9.

* Add tests for turn_animation_into_updater with zero/negative run_time

* updated lock file

* tests

---------

Co-authored-by: Benjamin Hackl <mail@behackl.dev>
2026-02-11 10:00:40 +01:00
dependabot[bot]
c261c61dfd
Bump nbconvert from 7.16.6 to 7.17.0 (#4582)
Bumps [nbconvert](https://github.com/jupyter/nbconvert) from 7.16.6 to 7.17.0.
- [Release notes](https://github.com/jupyter/nbconvert/releases)
- [Changelog](https://github.com/jupyter/nbconvert/blob/main/CHANGELOG.md)
- [Commits](https://github.com/jupyter/nbconvert/compare/v7.16.6...v7.17.0)

---
updated-dependencies:
- dependency-name: nbconvert
  dependency-version: 7.17.0
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-02-10 22:42:58 -03:00
Aarush Deshpande
9d98f00ee9
Remove __future__.annotations from required imports (#4571)
* Remove __future__.annotations from required imports
2026-02-05 21:57:20 -03:00
Benjamin Hackl
587e8d6546
Rework and consolidate release changelog script, add previously skipped changelog entries (#4568)
* rewrite dev_changelog script from scratch, turn into release util cli

* cleanup dependencies

* regenerate skipped changelog entries

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* remove changelog section from PR template

* fix pre-commit checks

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Francisco Manríquez Novoa <49853152+chopan050@users.noreply.github.com>
2026-02-04 10:10:39 +01:00
Sacha
d49115316e
Fixed division by 0 in "turn_animation_into_updater" (#4567)
* fixed division by 0

* fixed division by 0

* fixed division by 0

* updated lock file

* Revert "fixed division by 0"

This reverts commit b916a0c9c9.

* Add tests for turn_animation_into_updater with zero/negative run_time

* updated lock file

---------

Co-authored-by: Benjamin Hackl <mail@behackl.dev>
2026-02-03 22:40:09 +00:00
Rin
2f38426ceb
fix: initialize a_tex to prevent UnboundLocalError in PolarPlane (#4557) 2026-02-02 01:09:50 -03:00
Arnaud
bbdcda1ff5
add type annotations and docstrings for opengl_renderer.py (#4537)
* type annotations and docs for opengl_renderer.py

* add missing self

* Fix RTD build: move Window import to TYPE_CHECKING block

The Window import was moved to module-level in a recent type annotation
commit, but this causes opengl_renderer_window.py to be imported at
load time, triggering pyglet which fails on headless systems (RTD) when
it tries to create a shadow window. Moving the import into TYPE_CHECKING
preserves type hints for mypy while avoiding runtime display dependency.

* Fix mypy errors in opengl_renderer.py

- Cast np.linalg.inv() result to correct type
- Convert quaternion list to ndarray before passing to rotation_matrix_transpose_from_quaternion
- Cast get_center return value
- Fix return type for pixel_coords_to_space_coords (ensure float dtype)
- Add type: ignore for moderngl.create_context backend arg (incorrect stubs)
- Add type: ignore for blend_func assignment (incorrect stubs)

* Fix mypy errors and runtime import issues in opengl_renderer.py

- Import MatrixMN and Point3D at runtime (needed for typing.cast)
- Cast np.linalg.inv() result to correct MatrixMN type
- Convert quaternion list to ndarray before passing to rotation_matrix_transpose_from_quaternion
- Cast get_center and pixel_coords_to_space_coords return values to Point3D
- Ensure float dtype in np.array literals for type consistency

* Add runtime import of Window in init_scene

The Window class is imported inside TYPE_CHECKING for type hints, but
needs to be imported at runtime when actually creating a window. This
import is deferred to avoid triggering pyglet display initialization
on headless systems (RTD build).

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: Benjamin Hackl <devel@benjamin-hackl.at>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2026-01-25 21:24:16 +01:00
BHearron38
2c0b49be9f
fix: infinite recursion caused by accessing color of a highlighted Ta… (#4435)
* fix: infinite recursion caused by accessing color of a highlighted Table cell.

fix: removed type: ignore[attr-defined] mypy was not a fan of

* fix: added back needed mypy type ignore

* Add regression tests for Table/BackgroundRectangle color access

Tests for infinite recursion issue fixed in PR #4435 (issue #4419).

Refs: #4419

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Refactor BackgroundRectangle color test to geometry tests

Move test_background_rectangle_color from test_table.py to
test_unit_geometry.py since BackgroundRectangle lives in
geometry/shape_matchers.py, not in tables.

Regression test for ManimCommunity/manim#4419 (infinite recursion
when accessing BackgroundRectangle.color)

* Fix: Added missing manim GREEN import needed for test_BackgroundRectangle_color_access()

---------

Co-authored-by: Henrik Skov Midtiby <hemi@mmmi.sdu.dk>
Co-authored-by: Benjamin Hackl <mail@behackl.dev>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: bhearr <None>
2026-01-25 16:47:58 +01:00
Benjamin Hackl
eb8194a640
Fix broken aquabeam OpenGL link using Wayback Machine (#4545)
Refs: #4468, #4509

Co-authored-by: Henrik Skov Midtiby <hemi@mmmi.sdu.dk>
2026-01-25 12:33:39 +00:00
Aditi Juneja
eca7f17853
using color instead of fill_color with MathTeX for node labels (#4501)
* fill_color --> color for MathTeX

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Benjamin Hackl <devel@benjamin-hackl.at>
2026-01-25 11:53:05 +01:00
Arnaud
2317b0ee8b
feat: add a 'seed' option for reproducible outputs (#4532)
* feat: 'seed' option for reproducible outputs

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* enh: let Scene automatically pick global random seed, use arg as override

* chore: move import slightly

* chore: add test for color generator being reproducible with global config seed

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Benjamin Hackl <devel@benjamin-hackl.at>
2026-01-20 22:24:32 +01:00
F. Muenkel
d938533742
Add type annotations to ``rotation.py`` (#4535)
* Add type annotations to rotation.py

* Remove mypy entry

* Make typing of axis, about_point and about_edge consistent

* More typing in transform.py
2026-01-19 17:32:29 -03:00
Francisco Manríquez Novoa
0b3f28a5af
Revert "Set the default Python version to 3.13 in the uv installation guide (…" (#4534)
This reverts commit 83bcafb0e7.
2026-01-18 08:49:10 +01:00
Arnaud
6a56cc5ce6
fix: show doc of RandomColorGenerator (#4533) 2026-01-17 15:53:31 -03:00
Benjamin Hackl
cd7cd1b219
fix release pipeline: install dependencies (#4531) 2026-01-17 11:55:01 +01:00
Benjamin Hackl
9a6550d356
Prepare new release v0.19.2 (#4528)
* chore: bump version numbers etc

* chore: update lockfile

* chore: update date before release
2026-01-17 09:26:40 +01:00
Henrik Skov Midtiby
06f2fe231a
Checking version requirements for dependencies (#4529)
* Update pydub minimum version to 0.22

* numpy>=2.1

* av>=15.0

* isosurfaces>=0.1.1

* Updated lower bounds on dependencies.
2026-01-16 01:31:56 +01:00
Benjamin Hackl
d64af99f89
Add .github/release.yml for improved classifications in automatically generated changelogs (#4526)
* add release.yml file for automated changelog classification

* chore: cleanup leftover comments, add link to doc reference
2026-01-13 22:37:39 +01:00
dependabot[bot]
2e0aa8f529
Bump virtualenv from 20.35.4 to 20.36.1 (#4525)
Bumps [virtualenv](https://github.com/pypa/virtualenv) from 20.35.4 to 20.36.1.
- [Release notes](https://github.com/pypa/virtualenv/releases)
- [Changelog](https://github.com/pypa/virtualenv/blob/main/docs/changelog.rst)
- [Commits](https://github.com/pypa/virtualenv/compare/20.35.4...20.36.1)

---
updated-dependencies:
- dependency-name: virtualenv
  dependency-version: 20.36.1
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-01-13 22:05:07 +01:00
dependabot[bot]
88718ce43f
Bump filelock from 3.20.0 to 3.20.3 (#4527)
Bumps [filelock](https://github.com/tox-dev/py-filelock) from 3.20.0 to 3.20.3.
- [Release notes](https://github.com/tox-dev/py-filelock/releases)
- [Changelog](https://github.com/tox-dev/filelock/blob/main/docs/changelog.rst)
- [Commits](https://github.com/tox-dev/py-filelock/compare/3.20.0...3.20.3)

---
updated-dependencies:
- dependency-name: filelock
  dependency-version: 3.20.3
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-01-13 22:04:42 +01:00
Swarnlata
73eeacb880
fix: correct Circle.point_at_angle calculation (#4236) (#4438)
* fix: correct Circle.point_at_angle calculation for accurate arc mapping

* chore: remove unused variable 'start_angle' to fix pre-commit CI

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* test: add test for Circle.point_at_angle()

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Henrik Skov Midtiby <hemi@mmmi.sdu.dk>
Co-authored-by: Benjamin Hackl <devel@benjamin-hackl.at>
Co-authored-by: Benjamin Hackl <mail@behackl.dev>
2026-01-13 18:45:02 +01:00
Jude Nimo
739c2c3f14
Fix type error: pass scene instead of self to get_hash_from_play_call (#4524)
Co-authored-by: Jude Nimo <judenimo@users.noreply.github.com>
2026-01-13 18:19:20 +01:00
dependabot[bot]
d75f84a985
Bump actions/upload-artifact from 5 to 6 (#4522)
Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 5 to 6.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](https://github.com/actions/upload-artifact/compare/v5...v6)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-version: '6'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-01-13 17:54:32 +01:00
dependabot[bot]
b59f311331
Bump actions/cache from 4 to 5 (#4523)
Bumps [actions/cache](https://github.com/actions/cache) from 4 to 5.
- [Release notes](https://github.com/actions/cache/releases)
- [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md)
- [Commits](https://github.com/actions/cache/compare/v4...v5)

---
updated-dependencies:
- dependency-name: actions/cache
  dependency-version: '5'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-01-13 17:54:08 +01:00
Christian Clauss
dc4a8bb741
Replace legacy numpy usage ruff rule NPY002 (#4516) 2026-01-13 17:23:34 +01:00
Benjamin Hackl
4bc77b3a00
Bump Python target versions of both mypy and ruff
Merging #4520 - all CI checks passing and approved by JasonGrace2282
2026-01-13 01:13:21 +01:00
Benjamin Hackl
c424f83cb4
Bump minimum Python to 3.11 and av to 14.0.1 (#4385)
* chore: bump minimum supported python to 3.11

* fix: breaking changes from av upgrade

* chore: slightly bump minimum required version of av to 14.0.1

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* chore: update lockfile

* chore: update lockfile again with --upgrade

* Update pyproject.toml

* chore: CI pipeline os/version changes

* fix: indentation in ci.yml

* fix: use result.output instead of result.stdout for test_manim_cfg_subcommand

In Click 8.3.1 (pulled in by av>=14.0.1), help text output
behavior changed for no_args_is_help=True. Using result.output
instead of result.stdout makes the test robust across Click versions,
matching the pattern used in other tests like
test_manim_plugins_subcommand.

* fix: add UP to imports in get_winding_number doctest

* fix: add match_interpolate to imports in doctest

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2026-01-12 14:27:48 +01:00
Christian Clauss
0d2533231b
Test on Apple Silicon ARM64 (#4496)
Co-authored-by: Benjamin Hackl <devel@benjamin-hackl.at>
2026-01-12 01:22:16 +01:00
Henrik Skov Midtiby
b24b61776b
Add type annotations to three_dimensions.py (#4497)
* Initial type work

* More kwargs Any

* More typing

* _get_u_values_and_v_values cleaned

* self.checkerboard_colors

* Simplify code

* colorscale

* new_colors

* Ugly hacks to make the opengl objects behave

* checkerboard_colors

* Ignored a single type error

* Ignored the last type error

* Remove entry from mypy.ini

* set_fill_by_checkerboard

* resolution

* u_range and v_range

* ThreeDAxes

* Is tuple a color?

* resolution

* Point3D and Vector3D

* More with Point3D

* resolution

* colorscale

* checkerboard_colors Iterable

* Breaking change: checkerboard_colors can now be set to None

* Revert "Breaking change: checkerboard_colors can now be set to None"

This reverts commit d5c54cf5fa.

---------

Co-authored-by: Benjamin Hackl <devel@benjamin-hackl.at>
2026-01-11 23:47:38 +01:00
pre-commit-ci[bot]
d308ae3372
[pre-commit.ci] pre-commit autoupdate (#4518)
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.14.9 → v0.14.10](https://github.com/astral-sh/ruff-pre-commit/compare/v0.14.9...v0.14.10)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2026-01-11 23:41:24 +01:00
Benjamin Hackl
ff86ee6333 Merge remote-tracking branch 'codeberg/main' 2026-01-11 00:01:43 +01:00
TahaShams
ef0cf2a34d Docs: Fix TangentialArc example and add quadrant visualization (codeberg-mirror/#1)
## Overview: What does this pull request change?
This PR fixes the documentation for `TangentialArc`.
1. It replaces the static code block in the `TangentialArc` example with the `.. manim::` directive, allowing the example image/video to actually render in the documentation.
2. It adds a new second example scene, `TangentialArcCorners`, which visually demonstrates how the `corner` parameter (e.g., `(1,1)`, `(-1,1)`) affects the arc's orientation.

## Motivation and Explanation: Why and how do your changes improve the library?
Previously, the `TangentialArc` example was hidden inside a standard code block, so users could not see what the output looked like.
Additionally, the `corner` parameter is complex to visualize mentally. The new `TangentialArcCorners` scene provides a clear visual reference for all four possible quadrant configurations, making the class much easier to learn.

## Links to added or changed documentation pages
N/A

## Further Information and Comments
I have tested these changes locally and verified that the images generate correctly.
I am submitting this to the Codeberg mirror as per the current guidance regarding the GitHub incident.

**Visual Proof of the new example:**
I have attached the image

## Reviewer Checklist
- [ ] The PR title is descriptive enough for the changelog, and the PR is labeled correctly
- [ ] If applicable: newly added non-private functions and classes have a docstring including a short summary and a PARAMETERS section
- [ ] If applicable: newly added functions and classes are tested

Reviewed-on: https://codeberg.org/ManimCommunity/manim/pulls/1
Reviewed-by: Benjamin Hackl <behackl@noreply.codeberg.org>
Co-authored-by: TahaShams <01-134222-153@student.bahria.edu.pk>
Co-committed-by: TahaShams <01-134222-153@student.bahria.edu.pk>
2026-01-10 23:58:06 +01:00
Benjamin Hackl
75285d1f01 chore: update README 2026-01-09 23:30:49 +01:00
pre-commit-ci[bot]
d60154d024
[pre-commit.ci] pre-commit autoupdate (#4514)
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.14.8 → v0.14.9](https://github.com/astral-sh/ruff-pre-commit/compare/v0.14.8...v0.14.9)
- [github.com/pre-commit/mirrors-mypy: v1.19.0 → v1.19.1](https://github.com/pre-commit/mirrors-mypy/compare/v1.19.0...v1.19.1)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2025-12-16 14:08:38 +01:00
Henrik Skov Midtiby
976d634656
Remove deprecation warning from pytest np.trapz -> np.trapezoid (#4513) 2025-12-15 17:42:23 +01:00
pre-commit-ci[bot]
765f02f3ed
[pre-commit.ci] pre-commit autoupdate (#4506)
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.14.7 → v0.14.8](https://github.com/astral-sh/ruff-pre-commit/compare/v0.14.7...v0.14.8)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2025-12-15 12:10:32 +01:00
dependabot[bot]
a50d8363e7
Bump actions/checkout from 5 to 6 (#4498)
Bumps [actions/checkout](https://github.com/actions/checkout) from 5 to 6.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v5...v6)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: '6'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-12-02 01:18:38 +01:00
Christian Clauss
de090c1bd0
Add ruff rules PERF for performance (#4492)
* Add ruff rules PERF for performance

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2025-12-01 10:42:46 +00:00
Benjamin Hackl
e85bfca015
Prepare new release v0.19.1 and remove support for Python 3.9 (#4490)
Co-authored-by: Francisco Manríquez <francisco.manriquezn@usm.cl>
2025-11-30 23:20:20 -03:00
Benjamin Hackl
0541f9e6f1 Merge branch 'dependabot/github_actions/actions/upload-artifact-5' 2025-11-30 15:36:11 +01:00
Benjamin Hackl
c78de89e64 Merge branch 'dependabot/github_actions/github/codeql-action-4' into dependabot/github_actions/actions/upload-artifact-5 2025-11-30 15:35:10 +01:00
Benjamin Hackl
ab045f0ae1 Merge branch 'dependabot/github_actions/astral-sh/setup-uv-7' into dependabot/github_actions/actions/upload-artifact-5 2025-11-30 15:34:55 +01:00
pre-commit-ci[bot]
52820c6b65
[pre-commit.ci] pre-commit autoupdate (#4467)
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.14.2 → v0.14.6](https://github.com/astral-sh/ruff-pre-commit/compare/v0.14.2...v0.14.6)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Benjamin Hackl <devel@benjamin-hackl.at>
2025-11-30 15:18:39 +01:00
Jake Kinchen
51aa01acea
Fix duplicated arrow tips in DashedVMobject (issue #3220) (#4484)
* Fix duplicated arrow tips in DashedVMobject and add tests

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Benjamin Hackl <devel@benjamin-hackl.at>
2025-11-27 09:55:53 +00:00
dependabot[bot]
fcb9f6fee3
Bump astral-sh/setup-uv from 6 to 7
Bumps [astral-sh/setup-uv](https://github.com/astral-sh/setup-uv) from 6 to 7.
- [Release notes](https://github.com/astral-sh/setup-uv/releases)
- [Commits](https://github.com/astral-sh/setup-uv/compare/v6...v7)

---
updated-dependencies:
- dependency-name: astral-sh/setup-uv
  dependency-version: '7'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-11-26 22:20:43 +00:00
dependabot[bot]
adb0915605
Bump actions/upload-artifact from 4 to 5
Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 4 to 5.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](https://github.com/actions/upload-artifact/compare/v4...v5)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-version: '5'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-11-26 22:20:22 +00:00
dependabot[bot]
b6a464ed64
Bump github/codeql-action from 3 to 4
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 3 to 4.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/v3...v4)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-version: '4'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-11-26 22:20:21 +00:00
Francisco Manríquez Novoa
3bf384ab1e
Bump macOS image from deprecated macos-13 to macos-15-intel (#4481) 2025-11-26 22:19:19 +00:00
godalming123
a1bca6c3b9
Fix type errors and add typings for Mobject.apply_function(), its derivatives, and other utility functions (#4228)
* Fixes

Fix type errors, add types for the transformation functions, and fix one case where the about_point and about_edge options were not correctly passed in apply_complex_function in mobject.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* More fixes

- Import a couple types that should have been imported
- Remove the redefinition of self.background_stroke_width in manim/mobject/types/vectorized_mobject.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Francisco Manríquez Novoa <49853152+chopan050@users.noreply.github.com>
2025-11-26 15:11:09 -03:00
Guilherme Tomiasi
51377b530c
Pass ndarrays to mapbox_earcut.triangulate_float32() to fix TypeError in mapbox_earcut==2.0.0 (#4479)
Co-authored-by: Francisco Manríquez Novoa <49853152+chopan050@users.noreply.github.com>
2025-11-20 02:03:23 +00:00
nubDotDev
3c6ea0e2d6
Allow passing a buff to LabeledDot (#4403)
* Give LabeledDot a buffer and improve radius calculation

* fix norm calculation

* documentation

---------

Co-authored-by: Francisco Manríquez Novoa <49853152+chopan050@users.noreply.github.com>
2025-11-19 20:11:11 +00:00
Benjamin Hackl
00d0b297b4
make sure that if updating is suspended for a parent mobject, children are still updated (#4402)
Co-authored-by: Francisco Manríquez Novoa <49853152+chopan050@users.noreply.github.com>
2025-11-19 19:47:21 +00:00
Henrik Skov Midtiby
83bcafb0e7
Set the default Python version to 3.13 in the uv installation guide (#4480)
* Set the default python version to 3.13 in the uv installation guide.

* Capitalize Python

---------

Co-authored-by: Francisco Manríquez Novoa <49853152+chopan050@users.noreply.github.com>
2025-11-19 19:12:11 +00:00
Morkunas
7e950b38fa
Prevent mutation of about_point in apply_points_function_about_point - Fixes #4445 (#4478)
* Add regression tests for about_point view mutation issue

This adds regression tests for issue #4445 where using get_vertices()[0]
as about_point in transformation methods would cause incorrect results
due to numpy array view mutation.

Tests added:
- test_rotate_about_vertex_view
- test_scale_about_vertex_view
- test_stretch_about_vertex_view
- test_apply_matrix_about_vertex_view
- test_opengl_rotate_about_vertex_view (OpenGL was not affected by the bug)

Related to #4445

* Fix about_point view mutation in apply_points_function_about_point

When about_point parameter receives a numpy array view (e.g., from
get_vertices()[0]), the in-place operation `mob.points -= about_point`
would mutate the view, corrupting the transformation calculation.

This fix copies about_point before using it to prevent view mutation.

The OpenGL renderer was not affected by this bug because it uses
`arr - about_point` (creates temporary) instead of `arr -= about_point`
(mutates in-place).

Fixes #4445

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2025-11-16 21:17:08 +01:00
NightyStudios
9528337ad4
Allow selection of all scenes to render using '*' (#4470)
* added option to render all scenes by typing '*' when prompted

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2025-11-08 20:22:57 +01:00
Brainsucker92
afa4692f7b
Add implementation for tangential arc (#4469)
* Add implementation for tangential arc

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Add example

* Improve doc slightly

* Remove corner type

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Add test for TangentialArc

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Import Line only if type checking

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Add missing type hint

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Add test for tangential arc

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2025-11-06 23:05:24 +01:00
pre-commit-ci[bot]
038d16b531
[pre-commit.ci] pre-commit autoupdate (#4460)
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.14.1 → v0.14.2](https://github.com/astral-sh/ruff-pre-commit/compare/v0.14.1...v0.14.2)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2025-10-31 21:35:10 +01:00
Sir James Clark Maxwell
3e8f41c9be
Better parsing of color styles in CodeMobject (#4454)
* fixed problem: default value of color in styles in CodeMobject

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* added accidently removed test

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update code_mobject.py

Code suggested by maejam

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Henrik Skov Midtiby <hemi@mmmi.sdu.dk>
Co-authored-by: Henrik Skov Midtiby <henrikmidtiby@gmail.com>
2025-10-26 08:47:47 +01:00
F. Muenkel
4dd2937f1e
Add type annotations to cairo_renderer.py (#4393)
Co-authored-by: Francisco Manríquez Novoa <49853152+chopan050@users.noreply.github.com>
Co-authored-by: Henrik Skov Midtiby <hemi@mmmi.sdu.dk>
2025-10-24 20:59:11 +00:00
SASHAKT1290
a810f5535c
Update default resolution in CLI to match Manim’s 1920x1080 default settings (#4452)
* swapped height and width values

* updated default resolution settings
2025-10-24 21:56:35 +02:00
Henrik Skov Midtiby
dd04fce52a
Solution to issue 3562. (#4373)
Co-authored-by: Benjamin Hackl <devel@benjamin-hackl.at>
2025-10-24 21:56:08 +02:00
Sir James Clark Maxwell
e7d69834b3
Ensure that start and end points are stored as float values in Line3D (#4080)
* fixed problem with type conversions in Line3D

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* fixed broken test and Arrow3D

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update manim/mobject/three_d/three_dimensions.py

Co-authored-by: Aarush Deshpande <110117391+JasonGrace2282@users.noreply.github.com>

* Update manim/mobject/three_d/three_dimensions.py

Co-authored-by: Aarush Deshpande <110117391+JasonGrace2282@users.noreply.github.com>

* Delete unnecessary file

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* fixed typo in variable nam

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Aarush Deshpande <110117391+JasonGrace2282@users.noreply.github.com>
2025-10-24 21:14:55 +02:00
Nikhil Arora
7ffdf04dcb
Fix: correct tuple order to (height, width) and map height→pixel_height, width→pixel_width (#4440)
Co-authored-by: Henrik Skov Midtiby <hemi@mmmi.sdu.dk>
2025-10-24 13:18:04 +00:00
pre-commit-ci[bot]
e489ebf220
[pre-commit.ci] pre-commit autoupdate (#4409)
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.12.9 → v0.14.1](https://github.com/astral-sh/ruff-pre-commit/compare/v0.12.9...v0.14.1)
- [github.com/pre-commit/mirrors-mypy: v1.17.1 → v1.18.2](https://github.com/pre-commit/mirrors-mypy/compare/v1.17.1...v1.18.2)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Henrik Skov Midtiby <hemi@mmmi.sdu.dk>
2025-10-24 14:41:40 +02:00
dependabot[bot]
ce2c3c43e4
Bump actions/checkout from 4 to 5 (#4418)
Bumps [actions/checkout](https://github.com/actions/checkout) from 4 to 5.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v4...v5)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: '5'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-10-23 10:22:40 +02:00
dependabot[bot]
5ccc5bac19
Bump actions/setup-python from 5 to 6 (#4433)
Bumps [actions/setup-python](https://github.com/actions/setup-python) from 5 to 6.
- [Release notes](https://github.com/actions/setup-python/releases)
- [Commits](https://github.com/actions/setup-python/compare/v5...v6)

---
updated-dependencies:
- dependency-name: actions/setup-python
  dependency-version: '6'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Henrik Skov Midtiby <hemi@mmmi.sdu.dk>
2025-10-23 10:21:56 +02:00
Christian Clauss
e6777d6334
Fix failing pre-commit tests (#4434) 2025-10-23 08:39:17 +02:00
Riccardo Bergamaschi
855ea863b6
Add type annotations to opengl_mobject.py (#4398)
* feat(manim.mobject.opengl): added type annotations for `opengl_compatibility.py`

* feat(manim.mobject.opengl): typed almost all attribute definitions in `OpenGLMobject.__init__`

* feat(manim.mobject.opengl): typed more methods for `OpenGLMobject`

* fix(manim.mobject.opengl): import `override` from `typing_extensions`

* fix(manim.mobject.opengl): import `Never` from `typing_extensions`

* feat(manim.utils.config_ops): made `_Data` descriptor generic, to allow correctly typing `OpenGLMobject`

* fix(mypy.ini): don't ignore `manim.mobject.opengl.opengl_mobject`

* fix(manim.utils.config_ops): import `TypeVar` from `typing_extensions`, because the `typing` one does not have the `default` argument.

* feat(manim.mobject.opengl.opengl_mobject): Type checked more methods in `OpenGLMobject`.

* fix(manim.mobject.opengl.opengl_mobject): Fix a typo in `OpenGLMobject.restore`.

* feat(manim.mobject.opengl.opengl_mobject): Typed more methods in `OpenGLMobject`.

* feat(manim.mobject.opengl.opengl_mobject): Moved `overload`s inside an `if TYPE_CHECKING` statement.

* feat(manim.mobject.opengl.opengl_mobject): Added type annotations for `**kwargs` in a set of related methods.

* Revert "feat(manim.mobject.opengl): added type annotations for `opengl_compatibility.py`"

This reverts commit 1cd1550dd2.

* fix(OpenGLMobject): defined `get_array_attrs` method (and typed `_original__init__` at class scope).

I followed the advice of an existing `# TODO` comment and the implementation in `Mobject`. This also resolves a mypy error in this class (missing attribute).
It's interesting because the `get_array_attrs` method is (was) only defined in three classes:
- `Mobject`
- `PMobject`
- `OpenGLPMobject`

* feat(manim.mobject.opengl.opengl_mobject): Added type annotations for the `override_animate()`.

* feat(manim.mobject.opengl.opengl_mobject): Added type annotations to `_AnimationBuilder` and some methods in `OpenGLPoint`.

* fix(manim.mobject.opengl.opengl_mobject): fix failing tests

* fix(OpenGLMobject): default implementation of `pointwise_become_partial(…)` had to return `self`!

* feat(OpenGLMobject): added `type: ignore[no-untyped-call]` for calls to `ShaderWrapper` methods (not yet annotated).

* feat(OpenGLMobject): annotated shader-related `ClassVar`s

* feat(OpenGLMobject): typed several `**kwargs` and added `type: ignore[no-any-return]`s for cases where mypy cannot understand operations on numpy arrays.

* feat(OpenGLMobject): typed more `**kwargs` and fixed `set_color` arguments

* feat(OpenGLMobject): Added more type annotations.

* feat(OpenGLMobject): Typed `OpenGLMobject.uniforms` and `OpenGLMobject.fixed_orientation_center`

* fix(OpenGLMobject): fix tests

* fix(OpenGLGroup): annotate `**kwargs`

* fix(OpenGLPoint): annotate `**kwargs`

* fix(OpenGLPoint): corrected `**kwargs` and removed two `type: ignore`s

* fix(OpenGLPoint): removed `# type: ignore[no-untyped-call]`s

* fix(ci): import `Self` from `typing_extensions` rather than `typing`.

* fix(ci): import `TypeAlias` from `typing_extensions` rather than `typing`.

* feat(OpenGLMobject): make use of PEP 728.

* fix(ci): update `typing-extensions` requirement to the first version that supports PEP 728.

* fix(OpenGLMobject): avoid variable redefinitions in the `arrange_in_grid` method.

* fix(mypy.ini): remove unused changes to `mypy` configuration.

* fix(OpenGLMobject): use different symbols for the two `updater` variables.

* Revert "fix(ci): update `typing-extensions` requirement to the first version that supports PEP 728."

This reverts commit 69b96c6420.

* fix(OpenGLMobject): remove `TypedDict`s and switch to the less precise `**kwargs: Any`.

* Handle three no-any-return issues.

* Removed the slash divider in function parameters

* Removed the slash divider in function parameters

* Keep a single slash divider - to make return types match

---------

Co-authored-by: Henrik Skov Midtiby <henrikmidtiby@gmail.com>
2025-08-21 20:59:47 +00:00
NIKIL PAUL
8535d0675b
Added license information to documentation landing page (#3986)
* edit: added the descriptions to /docs/source/index.rst

* apply suggestions from review

---------

Co-authored-by: Benjamin Hackl <devel@benjamin-hackl.at>
2025-08-18 23:16:45 +02:00
pre-commit-ci[bot]
3ea23e9cd0
[pre-commit.ci] pre-commit autoupdate (#4405)
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.12.8 → v0.12.9](https://github.com/astral-sh/ruff-pre-commit/compare/v0.12.8...v0.12.9)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2025-08-18 21:09:36 +02:00
Benjamin Hackl
7e2ea86e98
Fix some config options specified via --config_file not being respected properly (#4401) 2025-08-17 09:40:38 -04:00
Henrik Skov Midtiby
6b668784f2
Add type annotations to moving_camera.py (#4397) 2025-08-13 18:33:51 -04:00
Henrik Skov Midtiby
dd91a8a2ee
Simplify the function remove_invisible_chars in text_mobject.py (#4394)
Co-authored-by: Francisco Manríquez Novoa <49853152+chopan050@users.noreply.github.com>
2025-08-13 15:01:20 +00:00
Henrik Skov Midtiby
ec306075a9
Add type annotations to opengl_geometry.py (#4396) 2025-08-13 10:29:45 -04:00
Benjamin Hackl
2d3aa0d2f4
Ensure leading whitespace does not change line height for lines in CodeMobject (#4392)
Co-authored-by: Francisco Manríquez Novoa <49853152+chopan050@users.noreply.github.com>
2025-08-12 21:38:42 -04:00
Francisco Manríquez Novoa
a56c06cd51
Rename types like RGBA_Array_Float to FloatRGBA and add types like FloatRGBA_Array (#4386)
Co-authored-by: Benjamin Hackl <devel@benjamin-hackl.at>
2025-08-12 10:37:59 -04:00
Henrik Skov Midtiby
03a94141d2
Add type annotations to text_mobject.py (#4381)
Co-authored-by: Benjamin Hackl <devel@benjamin-hackl.at>
2025-08-11 21:16:39 +00:00
Henrik Skov Midtiby
5a2b3384f1
Rewrite color_gradient to always return a list of ManimColors (#4380)
Co-authored-by: Francisco Manríquez Novoa <49853152+chopan050@users.noreply.github.com>
2025-08-11 15:15:38 -04:00
nubDotDev
c4dc0ea86d
Allow passing a tuple to buff in SurroundingRectangle to specify buffer in x and y direction independently (#4390)
* Give SurroundingRectangle 2D buffer

* add test for SurroundingRectangle buff parameter

---------

Co-authored-by: Benjamin Hackl <devel@benjamin-hackl.at>
2025-08-11 20:20:57 +02:00
pre-commit-ci[bot]
e822de0315
[pre-commit.ci] pre-commit autoupdate (#4391)
updates:
- [github.com/pre-commit/pre-commit-hooks: v5.0.0 → v6.0.0](https://github.com/pre-commit/pre-commit-hooks/compare/v5.0.0...v6.0.0)
- [github.com/astral-sh/ruff-pre-commit: v0.12.7 → v0.12.8](https://github.com/astral-sh/ruff-pre-commit/compare/v0.12.7...v0.12.8)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2025-08-11 20:18:58 +02:00
F. Muenkel
f69f2545d9
Rename SceneFileWriter.save_final_image() to save_image() (#4378)
* Rename save_final_image() to save_image()

* Rename SceneFileWriter.save_final_image() to save_image() and fix
  docstring

* fix some type annotations

* make docstrings consistent

* Update manim/scene/scene_file_writer.py

Co-authored-by: Francisco Manríquez Novoa <49853152+chopan050@users.noreply.github.com>

---------

Co-authored-by: Francisco Manríquez Novoa <49853152+chopan050@users.noreply.github.com>
2025-08-11 18:59:48 +02:00
F. Muenkel
48d5a36aad
Typing opengl_renderer_window.py (#4363)
Co-authored-by: Francisco Manríquez Novoa <49853152+chopan050@users.noreply.github.com>
Co-authored-by: Francisco Manríquez <francisco.manriquezn@usm.cl>
Co-authored-by: Benjamin Hackl <devel@benjamin-hackl.at>
2025-08-09 17:11:41 -04:00
Francisco Manríquez Novoa
05cc414014
Refactor imports from collections.abc, typing and typing_extensions for Python 3.9 (#4353)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2025-08-09 17:51:30 +00:00
Francisco Manríquez Novoa
b3df1cf79e
Properly define init_points methods (#4360) 2025-08-09 19:28:20 +02:00
nubDotDev
cb8af6f2d0
Bevel cube corners (#4361)
* Fixed surface animations in OpenGL

* bevel cube joints
2025-08-09 19:24:37 +02:00
Benjamin Hackl
d8a7e55ee1
Exclude check for cyclic imports by CodeQL (#4384)
* exclude check for cyclic imports by CodeQL

* also exclude py/unsafe-cyclic-import
2025-08-09 19:22:07 +02:00
pre-commit-ci[bot]
2d8d81c209
[pre-commit.ci] pre-commit autoupdate (#4204)
* [pre-commit.ci] pre-commit autoupdate

updates:
- [github.com/astral-sh/ruff-pre-commit: v0.11.0 → v0.12.7](https://github.com/astral-sh/ruff-pre-commit/compare/v0.11.0...v0.12.7)
- [github.com/pre-commit/mirrors-mypy: v1.15.0 → v1.17.1](https://github.com/pre-commit/mirrors-mypy/compare/v1.15.0...v1.17.1)

* Fix errors

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: JasonGrace2282 <aarush.deshpande@gmail.com>
2025-08-09 17:23:28 +02:00
Kabilan
fc68c10433
Add info-level logging for config files read and enhance output (#4375)
Co-authored-by: Benjamin Hackl <devel@benjamin-hackl.at>
2025-08-07 20:24:59 +00:00
Henrik Skov Midtiby
d0521fa06d
Add type annotations to movement.py (#4371)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Francisco Manríquez Novoa <49853152+chopan050@users.noreply.github.com>
2025-08-06 17:52:16 -04:00
Henrik Skov Midtiby
e339a68e54
Add type annotations to growing.py (#4368)
Co-authored-by: Francisco Manríquez Novoa <49853152+chopan050@users.noreply.github.com>
2025-08-06 21:21:57 +00:00
Henrik Skov Midtiby
c887b51d63
Add type annotations to composition.py (#4366)
Co-authored-by: Francisco Manríquez Novoa <49853152+chopan050@users.noreply.github.com>
2025-08-06 20:38:59 +00:00
Henrik Skov Midtiby
ded54e41ae
Add type annotations to indication.py (#4367)
Co-authored-by: Francisco Manríquez Novoa <49853152+chopan050@users.noreply.github.com>
2025-08-06 13:54:36 +00:00
Benjamin Hackl
04503adb70
Fix Sphinx exceptions when trying to build documentation via latex / as pdf (#4370)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2025-08-06 08:43:50 -04:00
Henrik Skov Midtiby
9c9ebf428e
Add type annotations to dot_cloud.py, vectorized_mobject_rendering.py and opengl_three_dimensions.py (#4359)
Co-authored-by: Francisco Manríquez Novoa <49853152+chopan050@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2025-08-01 11:07:09 -04:00
Francisco Manríquez Novoa
d18dc8f89b
Add VectorNDLike type aliases (#4068)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2025-08-01 04:31:30 +00:00
Henrik Skov Midtiby
7eb88562c2
Add type annotations for most of camera and mobject.graphing (#4125)
Co-authored-by: Francisco Manríquez Novoa <49853152+chopan050@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2025-08-01 00:59:29 +00:00
F. Muenkel
aa0cd4fe82
Add type hints to scene_file_writer.py, section.py, and zoomed_scene.py (#4133)
* Add type hints to scene/scene_file_write.py

* Add type hints to scene/scene_file_write.py

* Add type hints to scene/section.py

* Add type hints to scene/zoomed_scene.py

* Add type hints to scene/moving_camera_scene.py

* Fix typing of variable scene_name

* Fix typing

* Fix one more type hint
2025-07-30 08:52:22 -04:00
Henrik Skov Midtiby
a9b65eed5f
Revert change of default value (#4358) 2025-07-29 10:09:21 -04:00
Henrik Skov Midtiby
dba6fa8f99
Add type annotations to three_d_camera.py (#4356)
* Adding type annotations to three_d_camera.py

* Suggestions from Chopan50

* Removed a comment.

---------

Co-authored-by: Francisco Manríquez Novoa <49853152+chopan050@users.noreply.github.com>
2025-07-29 13:09:55 +00:00
Henrik Skov Midtiby
df36f4f196
Add type annotations to tex_mobject.py (#4355)
* Starting to work on type annotations for tex_mobject.py

* More work

* Finished.

* Code cleanup.

* ...

* Removed the ignore errors line in mypy for tex_mobject

* Fix typing of colors

---------

Co-authored-by: Francisco Manríquez Novoa <49853152+chopan050@users.noreply.github.com>
2025-07-29 12:32:23 +00:00
Francisco Manríquez Novoa
7ea765a759
Optimize Mobject.become() (#4357) 2025-07-29 07:57:02 -04:00
Henrik Skov Midtiby
21fe73b5c2
Add type annotations to manim/renderer/shader.py (#4350)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Francisco Manríquez Novoa <49853152+chopan050@users.noreply.github.com>
2025-07-27 23:14:41 +00:00
F. Muenkel
088affd876
Fix typo in import of OpenGLCamera (#4352) 2025-07-26 18:08:15 +00:00
F. Muenkel
c7ff795c0a
Add support for arithmetic operators //, %, *, ** and / on `ValueTracker` (#4351)
Co-authored-by: Francisco Manríquez Novoa <49853152+chopan050@users.noreply.github.com>
2025-07-26 17:45:05 +00:00
Irvanal Haq
dea245ad9a
Fix duplicate references in Scene.mobjects after ReplacementTransform with existing target mobject (#4242)
Co-authored-by: Francisco Manríquez Novoa <49853152+chopan050@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2025-07-26 01:30:54 +00:00
F. Muenkel
a8c16fbfb1
Add type hints to mobject/value_tracker.py (#4129)
Co-authored-by: Francisco Manríquez Novoa <49853152+chopan050@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2025-07-25 21:25:01 +00:00
gui martins
83d4301184
Add docstrings for ChangingDecimal and ChangeDecimalToValue (#4346)
Co-authored-by: Francisco Manríquez Novoa <49853152+chopan050@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2025-07-25 16:43:19 +00:00
nubDotDev
b65b0f2470
Fixed surface animations in OpenGL (#4286) 2025-07-25 15:40:52 +00:00
Abhilasha Tandon
4ddf77739d
Include Text.gradient in hash to properly regenerate Text when its gradient changes (#4099)
Co-authored-by: Benjamin Hackl <devel@benjamin-hackl.at>
Co-authored-by: Francisco Manríquez Novoa <49853152+chopan050@users.noreply.github.com>
2025-07-25 15:13:09 +00:00
Francisco Manríquez Novoa
e73b6590dd
Add classes MethodWithArgs, SceneInteractContinue and SceneInteractRerun inside new module manim.data_structures (#4315)
* Add classes MethodWithArgs, SceneInteractRerun and SceneInteractExit

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Add missing manim.data_structures file

* Rename SceneInteractExit to SceneInteractContinue and use dataclasses

* Revert using @dataclass(slots=True), because Python 3.9 does not support it

* Change order of dataclasses

* Add references to Scene.queue in docstrings

* Include data_structures in utilities_misc.rst

* Use qualified names and mark strings as code in data_structures.py

* Add module docstring to data_structures.py

* Move Scene.interact() objects from data_structures.py into scene.py

* Use qualified name in SceneInteractAction docstring

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2025-07-25 00:37:14 +02:00
Henrik Skov Midtiby
fd8ab62613
Fix BraceLabel.change_label() and document BraceText (#4347)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Francisco Manríquez Novoa <49853152+chopan050@users.noreply.github.com>
2025-07-24 22:09:02 +00:00
Henrik Skov Midtiby
047db453ff
Add type annotations to mobject/svg/brace.py (#4309)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Francisco Manríquez Novoa <49853152+chopan050@users.noreply.github.com>
2025-07-24 21:37:43 +00:00
Luka Rahne
2f02eb9328
Fix Prism rendering with wrong dimensions in OpenGL (#4003)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Benjamin Hackl <devel@benjamin-hackl.at>
Co-authored-by: Francisco Manríquez Novoa <49853152+chopan050@users.noreply.github.com>
2025-07-24 20:44:25 +00:00
dependabot[bot]
c1663f1a1e
Bump astral-sh/setup-uv from 5 to 6 (#4234)
Bumps [astral-sh/setup-uv](https://github.com/astral-sh/setup-uv) from 5 to 6.
- [Release notes](https://github.com/astral-sh/setup-uv/releases)
- [Commits](https://github.com/astral-sh/setup-uv/compare/v5...v6)

---
updated-dependencies:
- dependency-name: astral-sh/setup-uv
  dependency-version: '6'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-07-21 17:55:33 +02:00
NASAnerd05
2790a70bc5
Improved readability, grammar, as well as added docstrings for consistency (#4267)
* Improve MappingCamera, MovingCamera, Rotation, CliColors, and _init_.py readability and docstrings

* Readibility and docsstrings

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Apply suggestion from @behackl

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Benjamin Hackl <devel@benjamin-hackl.at>
2025-07-20 14:33:45 +02:00
Henrik Skov Midtiby
fdb5cb9f04
Add typing annotations to svg_mobject.py (#4318)
* Add typing annotations to svg_mobject.py

* Added ignore statements in four locations.

* cleanly resolve non-None stroke_width in svg_mobject

* revert clean solution (???)

---------

Co-authored-by: Benjamin Hackl <devel@benjamin-hackl.at>
2025-07-20 14:17:40 +02:00
Francisco Manríquez Novoa
ec501b960c
Remove manim.gui and move configure_pygui into Scene as a method (#4314) 2025-07-20 13:22:24 +02:00
Henrik Skov Midtiby
e54113e263
Handling typing errors in text/numbers.py (#4317) 2025-07-20 12:51:59 +02:00
Henrik Skov Midtiby
b83410aee0
Ensure that the stroke_width property of SVGMobject is not set to None. (#4319)
This change fixes issue 4311.
2025-07-20 12:36:09 +02:00
Henrik Skov Midtiby
f124235a9b
Adding type annotations to polyhedra.py and matrix.py (#4322)
* Fixed all mypy errors in polyhedra.py

* Added type annotations to matrix.py
2025-07-20 12:31:25 +02:00
Mohamed El Shorbagy
9e74ee7edf
Add zero to remove negative zeros (#4332) 2025-07-20 12:28:56 +02:00
OliverStrait
3721fb1612
Use utf-8 encoding to read generated .tex files. (#4334)
Co-authored-by: Oliver Strait <strait.devoliver@gmail.com>
2025-07-20 12:27:25 +02:00
Henrik Skov Midtiby
3d029c1280
Fix for issue 4255 - Arrow3D: get_start() and get_end() methods both return np.array([0,0,0]). (#4320) 2025-07-10 10:24:23 +02:00
S. M. Mohiuddin Khan Shiam
f63ba71f04
Gracefully fall back when version metadata is missing (#4324)
* Update __init__.py

* Update manim/__init__.py

Co-authored-by: Benjamin Hackl <devel@benjamin-hackl.at>

---------

Co-authored-by: Benjamin Hackl <devel@benjamin-hackl.at>
2025-07-10 10:23:12 +02:00
Benjamin Hackl
a234ff31e8
Replace setup-texlive-action in CI workflow (#4326)
* replace setup texlive action

* cleanup in packages to install

* one more
2025-07-03 08:29:01 -04:00
Henrik Skov Midtiby
9c43ad0d21
Store the original alpha channel from the image when creating the ImageMObject and then use it in the set_opacity method (#4313)
Change from PR 2923 by NicoWeio
2025-06-26 10:56:49 +02:00
Henrik Skov Midtiby
ea16d22735
Add type annotations to scene.py and vector_space_scene.py (#4260)
* Stop ignoring errors from manim/scene.py

Count: 307 errors

Type annotations on scene/vector_space_scene.py

Add type annotations to scene/vector_space_scene.py

Mypy count: 210

Reverting two changes that triggers an error in the automatic testing.

Further work on type hinting.

Avoid forwarding positional arguments from Arrow to Line in the constructor.

Revert "Avoid forwarding positional arguments from Arrow to Line in the constructor."

This reverts commit 80ae8576c1.

Removed several type ignore statements and addressed comments from JasonGrace2282

Revert "Activate mypy check of mobject.geometry.*"

This reverts commit d477c9a994.

Revert "Removed several type ignore statements and addressed comments from JasonGrace2282"

This reverts commit 07bbe3f220.

Added type annotations to zoomed_scene.py

Error count: 308 -> 303

Adding type annotations to all methods in vector_space_scene.py

Error count: 303 -> 272

Get rid of no-untyped-call errors from my in the vector_space_scene.py file

Error count: 272 -> 343

Handle type issues related to ManimColor in vector_space_scene.py

Handle var-annotated issues in vector_space_scene.py

Error count: 332 -> 330

Handling has-type type errors in vector_space_scene.py

Error count: 330 -> 285

Handled name-defined type issues in vector_space_scene.py

Error count: 285 -> 282

Address type issue with calling an untyped method.

Error count: 282 -> 281

Fix some typing issues in transform_mathcing_parts.py

Change stroke_width to float in vector_space_scene.py

Handled a few type errors.

Error count: 267

Handled several typing issues in three_d_scene.py

Error count: 267 -> 248

Dealing with type errors in scene_file_writer.py

Error count: 248 -> 216

Ensured that all methods in scene.py have type declarations.

Error count: 216 -> 225

Handle type issues related to interactivity by asserting that the camera is the OpenGLCamera

Error count: 225 -> 182

Handle type issues in scene.py

Error count: 182 -> 167

Asserting that the renderer or camera is of the proper type to use certain methods.

This is mainly related to interactive elements and the 3D camera used in the ThreeDScene

Error count: 167 -> 143

Avoid cyclic import of dependencies

Error count: 143 -> 143

Handling no-untyped-call type errors in manim/scene/scene.py

Error count: 143 -> 131

Handling assignment type errors in manim/scene/*.py

Error count: 131 -> 121

Handling arg-type type errors in manim/scene/*.py

Error count: 121 -> 116

Handling arg-type type errors in manim/scene/*.py

Error count: 116 -> 112

Fixing various type errors

Error count: 112 -> 102

Fixing various type errors

Error count: 102 -> 97

Fixing various type errors

Error count: 97 -> 90

Some aggressive changes to silence a significant number of type errors.

Error count: 90 -> 66

Commented out an import (IPython) that makes the CI tests fail.

Fix various type errors.

More type annotations.

Code cleanup.

Remove the property mobject_updater_lists of the Scene class as it is not used anywhere.

Handle import-untyped typing issues.

More work on type annotations in manin/scene/.*

More work on scenes/*.py looking at the dependency opengl_renderer.py

More work on types in scenes/*.py

Ignored an old bunch of type ignore statements.

More work on dependencies for scene.py

More work on dependencies for scene.py

* Stop ignoring errors from manim/scene/scene.py

mypy error count: 307

* Adding type annotations to scene.py (C1)

* Adding type annotations to scene.py (C2.1)

* Adding type annotations to scene.py (C2.2)

* Adding type annotations to scene.py (C2.3)

* Adding type annotations to scene.py (C3)

* Adding type annotations to scene.py (C4)

* Adding type annotations to scene.py (C5)

* Adding type annotations to scene.py (C6)

* Adding type annotations to scene.py (C7)

* ...

* Focus on scene.py

* Adding type annotations to vector_space_scene.py

* Added types to opengl_renderer.py

* Added types to cairo_renderer.py

* Fixed the last mypy errors in scene.py - many was ignored

* Fixed the last mypy errors in vector_space_scene.py - many was ignored

* Got rid of the last mypy errors.

* Activate mypy check of vector_space_scene.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Code cleanup.

* Update manim/gui/gui.py

Co-authored-by: Francisco Manríquez Novoa <49853152+chopan050@users.noreply.github.com>

* Update manim/renderer/opengl_renderer.py

Co-authored-by: Francisco Manríquez Novoa <49853152+chopan050@users.noreply.github.com>

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update manim/scene/scene.py

Co-authored-by: Francisco Manríquez Novoa <49853152+chopan050@users.noreply.github.com>

* Update manim/scene/scene.py

Co-authored-by: Francisco Manríquez Novoa <49853152+chopan050@users.noreply.github.com>

* Update manim/scene/scene.py

Co-authored-by: Francisco Manríquez Novoa <49853152+chopan050@users.noreply.github.com>

* Update manim/scene/scene.py

Co-authored-by: Francisco Manríquez Novoa <49853152+chopan050@users.noreply.github.com>

* Update manim/scene/scene.py

Co-authored-by: Francisco Manríquez Novoa <49853152+chopan050@users.noreply.github.com>

* Implementing suggestions from chopan50

* Explicitly mention all files where type errors are ignored in mypy.ini

# Conflicts:
#	mypy.ini

* Fix issue

* Updates based on comments from chopan50

* Updates suggested by Chopan50

* Addressed more comments from chopan50

* Addressing more comments from chopan50

* Added docstring to SceneInteractAction

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Differentiate between _AnimationBuilder from an mobject and an opengl_mobject

* Avoid a nameclash with the mobject module and variable name

* Last touches.

* Rolled back some changes related to _AnimationBuilder

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Francisco Manríquez Novoa <49853152+chopan050@users.noreply.github.com>
2025-06-24 13:50:40 -04:00
Henrik Skov Midtiby
c4b7a80258
Remove dead code from scene.py and vector_space_scene.py (#4310) 2025-06-24 12:23:42 -04:00
Henrik Skov Midtiby
0cec80216b
Explicit mention all files that mypy should ignore in the mypy.ini configuration file (#4306)
* Explicitly mention all files where type errors are ignored in mypy.ini

* Minor adjustments to mypy.ini suggested by chopan50
2025-06-24 07:43:57 -04:00
Louis GERARD
a1bb04947a
Fix Microsoft typo in TexFontTemplateLibrary scene in example_scenes/advanced_tex_fonts.py (#4305)
Co-authored-by: Louis Pierre Jean Gerard <louis_global@fasoo.com>
Co-authored-by: Francisco Manríquez Novoa <49853152+chopan050@users.noreply.github.com>
2025-06-23 21:15:39 -04:00
Henrik Skov Midtiby
325fa08a72
Fixing files with few typing (mypy) errors (#4263)
* Fixed mypy errors in several files with a few errors in each file.

* Fixed a few easy mypy errors.

* Fix mypy issues in animation/changing.py

* Handled mypy issues in _config/cli_colors.py

* Handled mypy issues in mobject/logo.py

* Handling mypy errors in fading.py

* Removed a default parameter (scene = None) in the method clean_up_from_scene in the class FadeOut

* Handled mypy errors in graphing/scale.py

* Handled a few mypy errors in updaters/update.py

* Handled mypy errors in three_d_utils.py

* Updated mypy.ini to check more files

* Avoid a circular import loop.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update manim/animation/changing.py

Co-authored-by: Francisco Manríquez Novoa <49853152+chopan050@users.noreply.github.com>

* Update manim/animation/changing.py

Co-authored-by: Francisco Manríquez Novoa <49853152+chopan050@users.noreply.github.com>

* Update manim/animation/changing.py

Co-authored-by: Francisco Manríquez Novoa <49853152+chopan050@users.noreply.github.com>

* Update manim/mobject/logo.py

Co-authored-by: Francisco Manríquez Novoa <49853152+chopan050@users.noreply.github.com>

* Update manim/animation/changing.py

Co-authored-by: Francisco Manríquez Novoa <49853152+chopan050@users.noreply.github.com>

* Update manim/animation/changing.py

Co-authored-by: Francisco Manríquez Novoa <49853152+chopan050@users.noreply.github.com>

* Update manim/animation/changing.py

Cleaner way to indicate the float type

Co-authored-by: Francisco Manríquez Novoa <49853152+chopan050@users.noreply.github.com>

* Update manim/animation/changing.py

Co-authored-by: Francisco Manríquez Novoa <49853152+chopan050@users.noreply.github.com>

* Updated the type annotations of MoveAlongPath and ChangingDecimal

* Suggestions from review by chopan50

* Fix missing import.

* Update mypy.ini

Co-authored-by: Francisco Manríquez Novoa <49853152+chopan050@users.noreply.github.com>

* Update mypy.ini

Co-authored-by: Francisco Manríquez Novoa <49853152+chopan050@users.noreply.github.com>

* Update mypy.ini

Co-authored-by: Francisco Manríquez Novoa <49853152+chopan050@users.noreply.github.com>

* Update mypy.ini

Co-authored-by: Francisco Manríquez Novoa <49853152+chopan050@users.noreply.github.com>

* Updated mypy.ini

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Francisco Manríquez Novoa <49853152+chopan050@users.noreply.github.com>
2025-06-23 08:08:00 -04:00
Steven Hedges
a8458cb329
Fix default config of manim init project to use correct pixel_height and pixel_width (#4213) 2025-06-23 03:27:47 +00:00
Irvanal Haq
64862994ac
Refactor Rotating and add docstrings to Mobject.rotate() and Rotating (#4147)
Co-authored-by: Francisco Manríquez Novoa <49853152+chopan050@users.noreply.github.com>
2025-06-22 04:15:12 +00:00
Ishu Bansal
c9707f281d
Introduce seed in random_color method to produce colors deterministically (#4265)
* add a random generator to hold the seed for random generation

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* add DOCSTRING for new class RandomColorGenerator

* fix RandomColorGenerator doctest

* introduce the sample colors param in RandomColorGenerator

* Update docstrings to include sample_colors param for RandomColorGenerator

* fix cyclic import issues

* fix indentations for code blocks

* docstring formatting changes

* removed performance warning
added class method

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Benjamin Hackl <devel@benjamin-hackl.at>
2025-06-21 22:39:19 +02:00
Ishu Bansal
23a2df1e5a
use the same opacity to init the super class obj of DecimalNumber (#4291) 2025-06-21 22:34:11 +02:00
Irvanal Haq
3377f6c1f6
Replace exceptions, remove unused parameters, and fix type hints in Animation, ShowPartial, Create, ShowPassingFlash, and DrawBorderThenFill (#4214)
Co-authored-by: Francisco Manríquez Novoa <49853152+chopan050@users.noreply.github.com>
Co-authored-by: Francisco Manríquez <francisco.manriquezn@usm.cl>
2025-06-20 00:38:56 +00:00
Irvanal Haq
e4b1d105a3
Rename misleading function dot_position to update_label in .add_updater() example (#4196)
Co-authored-by: Francisco Manríquez Novoa <49853152+chopan050@users.noreply.github.com>
2025-06-19 13:12:55 +00:00
Theo Barollet
204e44a106
Fixed artifact in Animation docstring (#4283) 2025-06-12 06:51:40 -04:00
Kaique Barbosa Dultra
d517b50567
Add support for pycodestyle W rule in Ruff (#4276)
* Add suport for `pycodestyle W` rule in Ruff and remove invalid noqa comments for deprecated rules

* Exclude `py/method-first-arg-is-not-self` false positive for metaclass `__init__`

---------

Co-authored-by: Aarush Deshpande <110117391+JasonGrace2282@users.noreply.github.com>
2025-06-11 14:35:39 +00:00
Giovanne
5301ab874f
Add tests for polylabel utility (#4269)
* Fix polygon inside/outside logic for edge cases

* Stop using hardcoded values and improve variable naming

* Decompose inside/outside logic into smaller functions

Improves readability and maintanance.

* Improve test readability

* Fix polylabel test logic

* Fix polylabel test by adding multiple options of pole

* Improve docstring description of argument

* Stop checking type checking blocks on coverage

* Fix OpenGLMobject methods doctests
2025-06-11 09:54:51 +02:00
Pedro Peixoto
be6a9dfaa7
docs: add explanation about the rate_func in the custom animation (#4278) 2025-06-11 09:50:11 +02:00
Pedro Zanelato
e569fd47ad
test: add matrix tests (#4279) 2025-06-11 09:48:39 +02:00
Irvanal Haq
bf72127152
Enhance and Paraphrase Description of Manim Community Edition in README.md (#4141)
Co-authored-by: Francisco Manríquez Novoa <49853152+chopan050@users.noreply.github.com>
2025-06-10 06:52:47 -04:00
Benjamin Hackl
ffa6ffa548
Fix formatting of color space documentation (#4274) 2025-06-08 12:53:56 -04:00
Akshat
bcab73a3d2
Fix(graph): Allow any Line subclass as edge_type in Graph/DiGraph (#4251)
* Fix(graph) : fix Line subclass usage for Graph and DiGraph

Fix(graph): LabeledLine can now be used in _add_edge

* Test(test_graph.py): add tests for LabeledLine as edge_type in Graph and DiGraph

Fix(test_graph): Fixed test_graph_accepts_labeledline_as_edge_type() always failing.
2025-05-27 17:30:19 +02:00
F. Muenkel
fdc496c211
Complete typing for logger_utils.py (#4134)
* Complete typing for logger_utils.py

* Stop ignoring  manim._config erros in mypy.ini

* Ignore manim._config errors in mypy.ini

---------

Co-authored-by: Francisco Manríquez Novoa <49853152+chopan050@users.noreply.github.com>
2025-05-23 01:17:08 +00:00
Irvanal Haq
f6cdb547d2
Fix add_points_as_corners not connecting single point to existing path (#4219) 2025-05-22 15:40:11 +00:00
SAYAN02-DEV
5a3dcf77fa
fix: update incorrect docstring for ManimConfig.gui_location property (#4254)
Co-authored-by: Francisco Manríquez Novoa <49853152+chopan050@users.noreply.github.com>
2025-05-22 12:53:46 +00:00
Irvanal Haq
c53ac5544a
Add docstring to :meth:Mobject.family_members_with_points (#4128)
* Add example to family_members_with_points method in Mobject

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Add the word 'recursively' to clarify the method description

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Improve the sentence of method description

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Improve the method description

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Adding brackets

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Add 'See also' section

* Update manim/mobject/mobject.py

Co-authored-by: Francisco Manríquez Novoa <49853152+chopan050@users.noreply.github.com>

* chenge list to list[Mobject]

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Francisco Manríquez Novoa <49853152+chopan050@users.noreply.github.com>
2025-05-22 12:23:40 +00:00
Irvanal Haq
7f6743e97c
Fix :meth:VMobject.pointwise_become_partial failing when vmobject is self (#4193)
* Fix Line failing with buff and path_arc
- make copy of vmobject.points if necessary

* change self to self.copy() in Line, and remove the previous change in pointwise_become_partial()

* Revert to first approach: copy points if self is vmobject

* Add unit test for pointwise_become_partial and Line

---------

Co-authored-by: Francisco Manríquez Novoa <49853152+chopan050@users.noreply.github.com>
2025-05-22 07:59:46 -04:00
Irvanal Haq
a2876dc77c
Add docstrings to Line and remove None handling for path_arc parameter (#4223)
* In Line: simplify _account_for_buff and set default path_arc to 0.0

* In Line: add docstring

* change 0.0 to 0

* Use explicit check for path_arc == 0 in _account_for_buff

---------

Co-authored-by: Francisco Manríquez Novoa <49853152+chopan050@users.noreply.github.com>
2025-05-22 10:26:08 +00:00
Irvanal Haq
de210bad8b
Improve docstring for interpolate method in Mobject class (#4149)
Co-authored-by: Francisco Manríquez Novoa <49853152+chopan050@users.noreply.github.com>
2025-05-21 22:40:29 +00:00
Irvanal Haq
ab4855728f
Improve Mobject.align_data docstring (#4152)
Co-authored-by: Francisco Manríquez Novoa <49853152+chopan050@users.noreply.github.com>
2025-05-21 22:09:33 +00:00
Francisco Manríquez Novoa
f304bd93ea
Fix return type of Polygram.get_vertex_groups() and rename variables in .round_corners() (#4063) 2025-04-26 02:16:14 +00:00
xinoehp512
384350cf3b
Replace poetry with uv in the README (#4226) 2025-04-21 19:02:31 -04:00
thehugwizard
593010b87b
Bugfix: HSL color ordering in ManimColor (#4202)
* Bugfix: colorsys uses HLS (hue, luminance, saturation) ordering when converting to/from rgb. Manim says it uses HSL ordering. Fixed order of parameters in call to colorsys for ManimColor.from_hsl and ManimColor.to_hsl.
Added tests ensure correct HSL ordering.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update to fix the correct color tests

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: SonnyRoomex <sonny.campbell@roomex.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Aarush Deshpande <110117391+JasonGrace2282@users.noreply.github.com>
2025-04-21 01:46:59 +00:00
Ryan Gibson
3c6a1ee80b
docs: Fix links to Pango website (#4217) 2025-04-14 14:59:52 -04:00
pre-commit-ci[bot]
44da20d71d
[pre-commit.ci] pre-commit autoupdate (#4181)
* [pre-commit.ci] pre-commit autoupdate

updates:
- [github.com/astral-sh/ruff-pre-commit: v0.9.7 → v0.11.0](https://github.com/astral-sh/ruff-pre-commit/compare/v0.9.7...v0.11.0)

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2025-03-17 14:34:57 -04:00
Hasan Mesbaul Ali Taher
e1925e46dc
Add missing line break in Code of Conduct conflict of interest policy (#4185) 2025-03-11 13:59:35 -03:00
pre-commit-ci[bot]
2ab99b53d3
[pre-commit.ci] pre-commit autoupdate (#4148)
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.9.3 → v0.9.7](https://github.com/astral-sh/ruff-pre-commit/compare/v0.9.3...v0.9.7)
- [github.com/pre-commit/mirrors-mypy: v1.14.1 → v1.15.0](https://github.com/pre-commit/mirrors-mypy/compare/v1.14.1...v1.15.0)
- [github.com/codespell-project/codespell: v2.4.0 → v2.4.1](https://github.com/codespell-project/codespell/compare/v2.4.0...v2.4.1)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2025-02-24 16:56:54 -05:00
Benjamin Hackl
2bdd5ac230
Make new Code mobject compatible with OpenGL renderer (#4164)
* fix: enable opengl compatibility for Code

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2025-02-11 06:29:23 +01:00
Benjamin Hackl
9479febef2
docs: add explicit instructions for installing pkg-config and cairo as required by pycairo for macos (#4146) 2025-02-10 20:52:36 +01:00
BenKirkels
d85ddb0ca5
refactor: improved consistency of rate_functions (#4144)
Co-authored-by: Benjamin Hackl <devel@benjamin-hackl.at>
Co-authored-by: Aarush Deshpande <110117391+JasonGrace2282@users.noreply.github.com>
2025-02-09 17:19:36 +00:00
F. Muenkel
cd2a3b92f6
Fixed Tex environment doubling braces (#4159)
* Fix environment formating for Tex() mobject

* Add test for handling of Tex() environments
2025-02-09 11:56:59 -05:00
Benjamin Hackl
01fc1ef71f
fix: re-add ffmpeg to docker container (#4150) 2025-02-04 09:10:33 -05:00
pre-commit-ci[bot]
d521bc9104
[pre-commit.ci] pre-commit autoupdate (#4140)
* [pre-commit.ci] pre-commit autoupdate

updates:
- [github.com/astral-sh/ruff-pre-commit: v0.9.2 → v0.9.3](https://github.com/astral-sh/ruff-pre-commit/compare/v0.9.2...v0.9.3)
- [github.com/codespell-project/codespell: v2.3.0 → v2.4.0](https://github.com/codespell-project/codespell/compare/v2.3.0...v2.4.0)

* fix: typos in two files

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Benjamin Hackl <devel@benjamin-hackl.at>
2025-02-02 17:28:20 +01:00
Benjamin Hackl
95fba7da10
Change project management tool from poetry to uv (#4138)
* rewrite pyproject.toml to support uv; version upgrades of several dev dependencies

* codespellrc: poetry.lock -> uv.lock

* rewrite workflows, first attempt

* change name of pre-commit-hook

* dev-dependencies -> dependency-groups.dev

* lint + format

* Update .github/workflows/ci.yml

Co-authored-by: Aarush Deshpande <110117391+JasonGrace2282@users.noreply.github.com>

* convert development.rst to myst markdown

* fix (most) docbuild warnings from theme upgrade

* development instructions: switch to uv, plus minor updates

* update entrypoint config in plugin docs + tests

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: Aarush Deshpande <110117391+JasonGrace2282@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2025-02-02 17:16:46 +01:00
Irvanal Haq
a6990bd83c
Fix link formatting and clarify the distinction between Manim versions in index.rst (#4131)
* Fix link formatting and clarify the distinction between Manim versions

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2025-01-22 10:28:18 +01:00
Irvanal Haq
8f919b1726
Add docstring to :meth:.Mobject.get_family (#4127)
* Add example to get_family method in Mobject

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2025-01-21 13:29:47 -05:00
pre-commit-ci[bot]
6ca08fd187
[pre-commit.ci] pre-commit autoupdate (#4122)
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.9.1 → v0.9.2](https://github.com/astral-sh/ruff-pre-commit/compare/v0.9.1...v0.9.2)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2025-01-21 00:52:52 +01:00
Aarush Deshpande
106b849a6d
Bump typing extensions minimum version (#4121) 2025-01-20 16:37:26 +00:00
Aarush Deshpande
c2dfb597ff
Create changelog for 0.19.0 (#4032)
* First draft of Changelog for 0.19.0

* fix typos

* added 3967

* Add #4037

* Update count 97 -> 98

* Add #4039

* Add #3930 and #4044

* Add this PR to changelog

* Add small description to changelog

* Add #3924, #3951, and #4038

* Bump Manim version to 0.19.0

* Update CITATION.cff to be more consistent

* remove github-security[bot]

* Feedback + missing PRs

* add newly merged PRs

* added more details to highlights + breaking changes

* bump date

* sort PRs in breaking changes section and include 3964

* sort highlights section

* fix: add required configuration key in .readthedocs.yml

* Update docs/source/changelog/0.19.0-changelog.rst

---------

Co-authored-by: Benjamin Hackl <devel@benjamin-hackl.at>
2025-01-20 14:36:53 +01:00
Francisco Manríquez Novoa
765c090027
Complete typing of manim.utils.color and polish its documentation (#4065)
* Type color and polish docstrings

* Stop ignoring manim.utils.color MyPy errors

* Remove manim.mobject.mobject from mypy.ini (put there on accident)

* Fix MyPy errors in GitHub pre-commit

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Modify _construct_from_space parameter type

* Modify _construct_from_space parameter type

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* fix: remove duplicate property definitions

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Benjamin Hackl <devel@benjamin-hackl.at>
2025-01-19 19:46:26 +01:00
Francisco Manríquez Novoa
8bb28aae8e
Draw more accurate circular Arcs for larger angles (#4034)
Co-authored-by: Benjamin Hackl <devel@benjamin-hackl.at>
2025-01-19 18:32:58 +00:00
czuzu
bad88a11f9
Update README and documentation landing page, improve way how 3b1b is credited (#4077)
* Update readme to properly credit Grant Sanderson and revise dismissive language

* Adjust readme and add landing-page mention about Grant's Manim

* Apply suggestions from code review

---------

Co-authored-by: Benjamin Hackl <devel@benjamin-hackl.at>
2025-01-19 18:57:53 +01:00
Benjamin Hackl
1efe869293
Completely rewrite Code mobject + add support for short notation RGB(A) hex code specifications to ManimColor (#4115)
Co-authored-by: Francisco Manríquez Novoa <49853152+chopan050@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2025-01-19 14:39:13 -03:00
Sophia Wisdom
86a971940f
Add __hash__ to ManimColor (#4051)
* add __hash__ to ManimColor

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update core.py

* add test

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* fix: correct typehint

* fix test

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Benjamin Hackl <devel@benjamin-hackl.at>
2025-01-19 18:09:26 +01:00
pre-commit-ci[bot]
97f818eb7f
[pre-commit.ci] pre-commit autoupdate (#4035)
* [pre-commit.ci] pre-commit autoupdate

updates:
- [github.com/astral-sh/ruff-pre-commit: v0.8.0 → v0.9.1](https://github.com/astral-sh/ruff-pre-commit/compare/v0.8.0...v0.9.1)
- [github.com/pre-commit/mirrors-mypy: v1.13.0 → v1.14.1](https://github.com/pre-commit/mirrors-mypy/compare/v1.13.0...v1.14.1)

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* enh: ignore ruff lint rule A005 (module shadowing standard library module)

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Benjamin Hackl <devel@benjamin-hackl.at>
2025-01-19 18:08:36 +01:00
Romit Mohane
c933c74a40
Add Noto fonts install command to Dockerfile (#4069)
* added notosans fonts install command to dockerfile

* enh: move fonts-noto package to other packages

---------

Co-authored-by: Benjamin Hackl <devel@benjamin-hackl.at>
2025-01-19 17:23:13 +01:00
F. Muenkel
530dd4d782
Fix broken link to Poetry installation guidelines (#4116) 2025-01-19 17:11:08 +01:00
Henrik Skov Midtiby
95b4625ef2
Fix of ImageMobject opacity bug (#4089)
* Fix issue 4072.

* Added a unittest for the interpolate function in utils/bezier.py
2025-01-19 16:56:47 +01:00
Irvanal Haq
def7241db3
Add Homotopy example for waving square (#4100)
* Add missing changes for homotopy example

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2025-01-19 16:38:30 +01:00
Aarush Deshpande
f18a2b46e5
Remove PT004 from Ruff (#4102) 2025-01-19 16:34:16 +01:00
modjfy
9d51c0d44d
Corrected spelling mistake in documentation (#4107) 2025-01-19 16:26:28 +01:00
Irvanal Haq
9e45cf6ff8
Remove duplicate __all__ declarations in vectorized_mobject.py (#4108) 2025-01-19 16:18:48 +01:00
Francisco Manríquez Novoa
7879fe4377
Fix VMobject.add_points_as_corners() to return self and safely handle empty points parameter (#4091)
* Fix VMobject.add_points_as_corners() to return self and safely handle case where no points are passed

* Add test_vmobject_add_points_as_corners()

* assert np.allclose() -> np.testing.assert_allclose()
2025-01-05 10:46:43 -03:00
Henrik Skov Midtiby
17d4a7f635
Add type annotations to manim.utils.* (#3999)
Co-authored-by: Francisco Manríquez Novoa <49853152+chopan050@users.noreply.github.com>
Co-authored-by: Francisco Manríquez <francisco.manriquezn@usm.cl>
2025-01-02 07:12:59 +00:00
Francisco Manríquez Novoa
dbad8a86bc
Rename InternalPoint3D to Point3D, Point3D to Point3DLike and other point-related type aliases (#4027) 2024-12-17 19:17:34 +00:00
Aarush Deshpande
112c99ba4a
Fix SyntaxWarnings when building the docs and bump readthedocs to Python 3.13 (#3924)
Co-authored-by: Benjamin Hackl <devel@benjamin-hackl.at>
Co-authored-by: Francisco Manríquez Novoa <49853152+chopan050@users.noreply.github.com>
2024-12-16 16:04:07 +00:00
Laifsyn
46dbf3d3ed
Call .finish() for every animation in AnimationGroup on finish (#3951)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Francisco Manríquez Novoa <49853152+chopan050@users.noreply.github.com>
Co-authored-by: JasonGrace2282 <aarush.deshpande@gmail.com>
Co-authored-by: Aarush Deshpande <110117391+JasonGrace2282@users.noreply.github.com>
2024-12-16 11:50:35 -03:00
Aarush Deshpande
6abcc611b9
Fix typehint of :meth:.Scene.play to allow .animate (#4038) 2024-12-07 16:56:55 +00:00
Aarush Deshpande
953888e68e
Rewrite installation instructions (#3930)
Follow-up to #3501

This commit combines all the installation documentation onto one page, and switches to recommending the usage
of `uv` for installing Manim.
2024-12-06 18:50:18 -05:00
Francisco Manríquez Novoa
d485986122
Add support in documentation for type aliases using Python 3.12 type definition (#4044) 2024-12-06 20:07:31 -03:00
ChungLeeCN
263623e10c
Added a `delay parameter to :func:.turn_animation_into_updater` (#4039) 2024-12-03 14:02:53 +00:00
Benjamin Hackl
73d22454f1
pin av to <14 (#4037) 2024-12-02 16:06:53 -05:00
Aarush Deshpande
e74933049e
Add support for Python 3.13 (#3967)
* Allow python 3.13

* Specify scipy more strictly

* try using 3rd-party audioop package

* debug: wrap context generation in try-block

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* remove audioop-lts, update dependencies

* add wrapt pre-release (wheels!)

* update lockfile

* CI, windows: try installing all tinytex packages at once

* tmp: verbosity of pytest

* tmp: pass -n 0 for testing

* tmp: disable pytest-xdist

* remove deprecated poetry installer option

* try running tests via uv-provided env

* tmp: run -> run --no-project

* try --full-trace

* try running tests via python -v ...

* tmp: test import of suspicious modules

* test click/cloup

* ci: back to poetry

* ci: disable pytest plugins altogether

* update lockfile

* ci: upgrade pytest

* remove all flags from pytest call

* ci: move conftest, temporarily disable test header

* fix test fixture

* try with more recent version of pytest-xdist

* loadfile -> loadscope

* explicitly test pytest for non-manim module

* some proper tests

* only keep fixtures in new conftest.py

* remove all non-necessary fixtures

* try a literal try/except in fixture file

* simplify tests further

* try and explicitly trigger non-silent errors

* Revert "try and explicitly trigger non-silent errors"

This reverts commit 35b862d483.

* more pytest debug output

* test whether manim can be imported correctly

* test with upgraded numpy

* revert all sorts of debug changes, attempt clean pytest run

* fix whitespace

* pre-commit hooks

* apply config fixture to render tests

* let config fixture ensure renderer is set to cairo

* update doctests for numpy>=2.0

* missed some

* upgrade required numpy version, revert separate treatment of numpy in ci

* upgraded moderngl-window to latest

* more delicate versioning of numpy dependency

---------

Co-authored-by: Benjamin Hackl <devel@benjamin-hackl.at>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-12-02 08:50:14 +01:00
Francisco Manríquez Novoa
f81d5713b3
Allow animations with run_time=0 and implement convenience Add animation (#4017)
* Allow animations with run_time=0 and implement convenience Add animation

* Modify examples so that there are less characters per line

* Docstring fixes

* Update manim/animation/animation.py

* Address comments

---------

Co-authored-by: Benjamin Hackl <devel@benjamin-hackl.at>
2024-11-27 01:00:54 +00:00
Jay Gupta
862504fa45
Added ConvexHull, ConvexHull3D, Label and LabeledPolygram (#3933)
* initial commit

* Update labeled.py

* general fixes

fixed added utils (i.e., Incomplete ordering and Explicit returns mixed with implicit), added :quality: high to docstrings, made ConvexHullExample determined

* typing

added typing to `qhull.py` and `polylabel.py` for debugging. simplified test cases for `ConvexHull` and `ConvexHull3D` and rewrote control data. added tip to LabeledPolygon documentation.

* response to feedback

added `label_config` and `box_config` and `frame_config` for additional configuration options and cleaner interface. added `InternalPointND` and `PointND ` and `InternalPointND_Array` and `PointND_Array` for typing. updated docstring.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* typing

* Update manim/mobject/geometry/labeled.py

Co-authored-by: Francisco Manríquez Novoa <49853152+chopan050@users.noreply.github.com>

* Update manim/mobject/geometry/labeled.py

Co-authored-by: Francisco Manríquez Novoa <49853152+chopan050@users.noreply.github.com>

* typing, docstring, class name

* typing

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Francisco Manríquez Novoa <49853152+chopan050@users.noreply.github.com>
2024-11-26 21:32:14 -03:00
Hugo Chargois
fac0aa5218
Add darker, lighter and contrasting methods to ManimColor (#3992)
* Add darker, lighter and contrasting methods to ManimColor

* Fixes

---------

Co-authored-by: Benjamin Hackl <devel@benjamin-hackl.at>
2024-11-25 11:05:08 +01:00
pre-commit-ci[bot]
faecdd3365
[pre-commit.ci] pre-commit autoupdate (#3987)
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.7.0 → v0.8.0](https://github.com/astral-sh/ruff-pre-commit/compare/v0.7.0...v0.8.0)
- [github.com/pre-commit/mirrors-mypy: v1.12.1 → v1.13.0](https://github.com/pre-commit/mirrors-mypy/compare/v1.12.1...v1.13.0)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-11-24 12:59:04 +01:00
dependabot[bot]
8f6eaf372e
Bump tornado from 6.4.1 to 6.4.2 (#4023)
Bumps [tornado](https://github.com/tornadoweb/tornado) from 6.4.1 to 6.4.2.
- [Changelog](https://github.com/tornadoweb/tornado/blob/v6.4.2/docs/releases.rst)
- [Commits](https://github.com/tornadoweb/tornado/compare/v6.4.1...v6.4.2)

---
updated-dependencies:
- dependency-name: tornado
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-11-22 17:33:43 -05:00
Benjamin Hackl
c516932f9f
Fix scene skipping for config.upto_animation_number (-n flag in CLI) set to 0 to end after first animation (#4013)
* make checks involving from/upto_animation_number more explicit

* add test for flag -n 0,0 for only rendering first animation

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Aarush Deshpande <110117391+JasonGrace2282@users.noreply.github.com>
2024-11-13 21:23:50 -03:00
Francisco Manríquez Novoa
ab577dc2ea
Add typings to manim/__main__.py (#4007)
* Add typings to __main__.py

* Remove `Unused parameter.` from docstrings
2024-11-13 22:16:17 +00:00
Francisco Manríquez Novoa
a21a5e5719
Stop ignoring manim.plugins errors in mypy.ini (#4006) 2024-11-11 00:44:52 +01:00
Aarush Deshpande
97efef4542
Add a time property to Scene (#3997)
* Add a time property to scene

* fix mistaken search/replace

* Add typehint
2024-11-07 21:45:46 +00:00
Francisco Manríquez Novoa
ee0501c2b6
Add type hints to manim.cli module (#3988)
* Add type hints to cli

* Import click.Parameter instead of non existing cloup.Parameter

* Stop ignoring manim.cli errors in mypy.ini

* Fix mypy errors

* Remove unused TypeVar C

* click.Command.command -> cloup.Group.command

* Address Jason's requested changes

* exit() -> sys.exit()
2024-11-04 16:05:07 +00:00
Christopher Hampson
c6edb330a9
Feat: dvipsnames and svgnames color palettes (#3913)
* feat: added dvipsnames color palette

* added svgnames color palette

* fixed docstrings

* Commit changes requested by JasonGrace2282

* Double backticks in xcolor

---------

Co-authored-by: Francisco Manríquez <francisco.manriquezn@usm.cl>
Co-authored-by: Francisco Manríquez Novoa <49853152+chopan050@users.noreply.github.com>
Co-authored-by: Aarush Deshpande <110117391+JasonGrace2282@users.noreply.github.com>
2024-11-04 14:13:28 +00:00
Nemo2510
9f1f239f10
Allow :class:.SurroundingRectangle to accept multiple Mobjects (#3964)
* Implement SurroundingRectangle.multiple and BackgroundRectangle.multiple

* Integrate SurroundingRectangle constructor for multiple objects into __init__

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* SurroundingRectangle now takes multiple Mobjects as positional args

* Add tests for multiple Mobjects in SurroundingRectangle

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Fix example that was not using keyword args for SurroundingRectangle

* Remove duplicate code from BackgroundRectangle

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Add typing to manim argument of SurroundingRecrabgle constructor

Co-authored-by: Aarush Deshpande <110117391+JasonGrace2282@users.noreply.github.com>

* Remove redundant argument from test_SurroundingRectangle

Co-authored-by: Aarush Deshpande <110117391+JasonGrace2282@users.noreply.github.com>

* Remove type check from SurroundingRectangle

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Fix missing line issue

* resolve merge conflict

* Fix Group import

* Move Group import into the body of SurroundingRectangle

* Return type checking to SurroundingRectangle

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* small change to error message

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* fix missing imports

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Aarush Deshpande <110117391+JasonGrace2282@users.noreply.github.com>
Co-authored-by: JasonGrace2282 <aarush.deshpande@gmail.com>
2024-10-29 23:30:32 +00:00
Nemo2510
2570a251c9
Add scale_stroke boolean parameter to VMobject.scale() to allow scaling stroke_width along with the VMobject (#3965)
* Add option to scale object outlines with objects

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Move outline scaling into VMobject.scale()

* Add unit tests for stroke width

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Fix docstring for VMobject.scale

Co-authored-by: Aarush Deshpande <110117391+JasonGrace2282@users.noreply.github.com>

* Remove tautology from VMobject.scale

Co-authored-by: Aarush Deshpande <110117391+JasonGrace2282@users.noreply.github.com>

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Aarush Deshpande <110117391+JasonGrace2282@users.noreply.github.com>
Co-authored-by: Francisco Manríquez Novoa <49853152+chopan050@users.noreply.github.com>
2024-10-28 14:48:46 +00:00
Francisco Manríquez Novoa
f65b7f8085
Refactored run_time validation for Animation and Scene.wait() (#3982)
* Refactored Animation run_time validation

* Rewrite error and warning messages, and add validations to wait(), pause() and wait_until()

* Undo rewriting of imports
2024-10-28 14:24:29 +00:00
Francisco Manríquez Novoa
20f44b456b
Added PointND and PointND_Array typing aliases (#3980)
Co-authored-by: Aarush Deshpande <110117391+JasonGrace2282@users.noreply.github.com>
2024-10-28 01:28:31 +00:00
Henrik Skov Midtiby
87732527d3
Type annotation work in manim/mobject/geometry/ (#3961)
Fixes typehints in manim.mobject.geometry, and enables type checking of those modules. Part of #3375
2024-10-27 21:13:58 +00:00
Larry Skuse
a395ffd698
Allow videos to be embedded in Google Colab without explicitly setting config.media_embed = True (#3974)
Co-authored-by: Francisco Manríquez Novoa <49853152+chopan050@users.noreply.github.com>
2024-10-24 17:34:49 +00:00
Xiuyuan (Jack) Yuan
327db11c54
Added example to documentation for moving_camera_scene module (#3972)
Co-authored-by: Xiuyuan <u7678992@anu.edu.au>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Tianxiong Dai <u7581325@anu.edu.au>
2024-10-24 07:35:53 -04:00
Nikhila Gurusinghe
d5b8b41283
Implemented VGroup parsing iterables (#3966) 2024-10-23 08:08:52 -04:00
pre-commit-ci[bot]
39382e6ba8
[pre-commit.ci] pre-commit autoupdate (#3929)
* [pre-commit.ci] pre-commit autoupdate

updates:
- [github.com/pre-commit/pre-commit-hooks: v4.6.0 → v5.0.0](https://github.com/pre-commit/pre-commit-hooks/compare/v4.6.0...v5.0.0)
- [github.com/astral-sh/ruff-pre-commit: v0.6.2 → v0.7.0](https://github.com/astral-sh/ruff-pre-commit/compare/v0.6.2...v0.7.0)
- [github.com/pre-commit/mirrors-mypy: v1.11.2 → v1.12.1](https://github.com/pre-commit/mirrors-mypy/compare/v1.11.2...v1.12.1)

* Fixes for ruff 0.7.0

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: JasonGrace2282 <aarush.deshpande@gmail.com>
Co-authored-by: Aarush Deshpande <110117391+JasonGrace2282@users.noreply.github.com>
2024-10-22 14:32:12 +00:00
Aarush Deshpande
96e58aeb05
Fix typehints of ParametricFunction (#3926)
* Fix typehints of ParametricFunction

* add typehint
2024-10-22 14:07:01 +00:00
nitzanbueno
ce1fff645d
Improve line rendering performance by decreasing redundant subdivision count (#3893)
* Reduce line cylinder height resolution to 2

Subdividing a line cylinder by its height adds no extra resolution -
since it's not checkerboarded, all new rectangles would look the same as
one long rectangle. Decreasing the default subdivision resolution to 2
reduces submobject count by 12x while sacrificing no quality.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Allow for 2 resolution values in Line3D

This prevents a breaking change where a tuple of resolution values
passed to Line3D.resolution would no longer work.
Also applies to Arrow3D.

* Assign field before init

* Add checkered line info to docstring

* Regenerate test control frame

* Regenerate missing control frames

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Francisco Manríquez Novoa <49853152+chopan050@users.noreply.github.com>
2024-10-20 01:01:04 +00:00
Aarush Deshpande
fc58a46615
Fixed typehint in types.rst and replaced outdated reference to manim.typing.Image with manim.typing.PixelArray (#3878)
Co-authored-by: Francisco Manríquez Novoa <49853152+chopan050@users.noreply.github.com>
2024-10-20 00:36:32 +00:00
Aarush Deshpande
225efcad22
Use Github Markdown on README (#3925)
* test out new Github markdown README stuff

* Change warning -> caution
2024-10-20 00:24:14 +02:00
Rehmatpal Singh
0cdfd4b304
Fix: .to_edge()'s example demonstration in docs (#3958)
* ToEdgeExample's circle is added to the scene

* Made it consistent to the surrounding code

---------

Co-authored-by: Aarush Deshpande <110117391+JasonGrace2282@users.noreply.github.com>
2024-10-19 21:54:34 +00:00
Francisco Manríquez Novoa
75a7525ed5
Optimized interpolate and bezier in manim.utils.bezier (#3960)
* Optimized bezier and interpolate in bezier.py

* Minor doc changes

---------

Co-authored-by: Benjamin Hackl <devel@benjamin-hackl.at>
2024-10-19 21:32:12 +00:00
Achille Fouilleul
5788f8131f
Set AAC codec for audio in mp4 files, add transcoding utility (#3956)
* scene_file_writer: convert frame_rate to fraction

* Set audio codec to AAC when format=mp4

* refactor: change import uv.utils.Fraction -> fractions.Fraction

* use config as single source of truth for container format

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: Benjamin Hackl <devel@benjamin-hackl.at>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-10-19 23:12:07 +02:00
Achille Fouilleul
0a96aacb24
os.system -> subprocess (#3955)
Quoting the python library documentation:

> The subprocess module provides more powerful facilities for spawning
> new processes and retrieving their results; using that module is
> preferable to using this function.
2024-10-15 20:43:02 -03:00
Geoo Chi
d6f066c131
Fix np.float_ to np.float64 while using numpy >= 2.0 (#3940)
Co-authored-by: Geoo Chi <szchixy@gmail.com>
2024-10-04 16:28:15 +02:00
dependabot[bot]
1dcb81268a
Bump cryptography from 43.0.0 to 43.0.1 (#3931)
Bumps [cryptography](https://github.com/pyca/cryptography) from 43.0.0 to 43.0.1.
- [Changelog](https://github.com/pyca/cryptography/blob/main/CHANGELOG.rst)
- [Commits](https://github.com/pyca/cryptography/compare/43.0.0...43.0.1)

---
updated-dependencies:
- dependency-name: cryptography
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-03 21:56:21 -04:00
Aarush Deshpande
74f79a42b6
Use Ruff pygrep rules (#3923)
* Add config for ruff pygrep

* Fix pygrep linting errors
2024-09-01 17:55:22 +02:00
Christopher Hampson
2536b7fafb
feat: preserve original TeX colors (#3903)
* feat: preserve original Tex colors

* added test for preserving tex color

* fix: fixed breaking change to tex color inheritance

* updated docstring and comment

* Update manim/mobject/text/tex_mobject.py

Co-authored-by: Aarush Deshpande <110117391+JasonGrace2282@users.noreply.github.com>

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: Aarush Deshpande <110117391+JasonGrace2282@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-09-01 15:45:30 +00:00
Aarush Deshpande
1097ed9692
Standardize docstrings with ruff pydocstyle rules (#3881)
Used Ruff rules for `pydocstyle` to standardize docstring formatting.

* Add config for ruff pydocstyle

* Safe fixes from ruff

* Unsafe fixes from ruff
2024-09-01 08:03:38 -04:00
Irvanal Haq
8deac51abc
Changing the 'side_length' attribute to a property (#3901)
* Changing the 'side_length' attribute to a property

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Add tests for Square side_length property

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update tests/module/mobject/geometry/test_unit_geometry.py

Co-authored-by: Aarush Deshpande <110117391+JasonGrace2282@users.noreply.github.com>

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Aarush Deshpande <110117391+JasonGrace2282@users.noreply.github.com>
2024-08-31 11:40:09 +00:00
Irvanal Haq
76e6a57164
Remove inner radius for :class:.Sector (#3922)
A Sector is a special case of `AnnualarSector` where the inner radius is zero. As such, it does not make sense to also have a parameter for the inner radius.

* Simplify Sector Class by Removing Redundant Parameters

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-08-30 16:29:41 -04:00
pre-commit-ci[bot]
95966a7f61
[pre-commit.ci] pre-commit autoupdate (#3918)
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.6.1 → v0.6.2](https://github.com/astral-sh/ruff-pre-commit/compare/v0.6.1...v0.6.2)
- [github.com/pre-commit/mirrors-mypy: v1.11.1 → v1.11.2](https://github.com/pre-commit/mirrors-mypy/compare/v1.11.1...v1.11.2)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-08-26 14:19:46 -04:00
Irvanal Haq
32cc7abee1
fix type hint, change int to float (#3916) 2024-08-26 16:03:19 +00:00
pre-commit-ci[bot]
2462d0d011
[pre-commit.ci] pre-commit autoupdate (#3911)
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.5.7 → v0.6.1](https://github.com/astral-sh/ruff-pre-commit/compare/v0.5.7...v0.6.1)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-08-19 16:55:47 -04:00
Benjamin Hackl
d029beb2b7
bugfix: convert non-.wav/.raw files to .wav before passing to pydub (#3832)
pydub will try to use `ffmpeg` for non-`.wav`/`.raw` files, which is no longer a dependency of Manim. To avoid this, we convert non `.wav`/`.raw` files into `.wav` files before passing it to pydub.

---------

Co-authored-by: JasonGrace2282 <aarush.deshpande@gmail.com>
2024-08-14 16:42:15 +00:00
pre-commit-ci[bot]
99ce78fd60
[pre-commit.ci] pre-commit autoupdate - Ruff (#3904)
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.5.6 → v0.5.7](https://github.com/astral-sh/ruff-pre-commit/compare/v0.5.6...v0.5.7)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-08-12 13:59:07 -04:00
fogsong233
aa660c77ec
Fix typehint of :meth:.Scene.restructure_mobjects. (#3902) 2024-08-12 07:05:18 -04:00
Aarush Deshpande
c0b04876db
Run poetry lock (#3895) 2024-08-06 15:31:53 +02:00
pre-commit-ci[bot]
0ac03869f5
[pre-commit.ci] pre-commit autoupdate (#3896)
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.5.5 → v0.5.6](https://github.com/astral-sh/ruff-pre-commit/compare/v0.5.5...v0.5.6)
- [github.com/PyCQA/flake8: 7.1.0 → 7.1.1](https://github.com/PyCQA/flake8/compare/7.1.0...7.1.1)
- [github.com/pre-commit/mirrors-mypy: v1.11.0 → v1.11.1](https://github.com/pre-commit/mirrors-mypy/compare/v1.11.0...v1.11.1)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-08-05 14:36:37 -04:00
Saveliy Yusufov
11ea41633c
Significantly reduce rendering time with a separate thread for writing frames to stream (#3888)
* Add separate thread for writing frames to stream

* [pre-commit.ci] pre-commit autoupdate (#3889)

updates:
- [github.com/astral-sh/ruff-pre-commit: v0.5.4 → v0.5.5](https://github.com/astral-sh/ruff-pre-commit/compare/v0.5.4...v0.5.5)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>

* Replace the TypeError message code in the _typecheck_input method in … (#3890)

* Replace the TypeError message code in the _typecheck_input method in the DrawBorderThenFill class.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>

* Remove print statements used for debugging

* Remove writing process termination

- This is probably leftover from back when manim used subprocess to
  write frames to FFmpeg via stdin

* Add type hints to modified methods & instance vars

* Fix inline code in docstring & type hint for queue

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Irvanal Haq <125118413+irvanalhaq9@users.noreply.github.com>
2024-08-04 17:15:58 -04:00
Irvanal Haq
17e5a77b09
Replace the TypeError message code in the _typecheck_input method in … (#3890)
* Replace the TypeError message code in the _typecheck_input method in the DrawBorderThenFill class.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-07-30 06:31:12 -04:00
pre-commit-ci[bot]
85d9ac8f47
[pre-commit.ci] pre-commit autoupdate (#3889)
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.5.4 → v0.5.5](https://github.com/astral-sh/ruff-pre-commit/compare/v0.5.4...v0.5.5)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-07-29 14:19:17 -04:00
Aarush Deshpande
5bda1075e6
Fix typo from HSV PR (#3887) 2024-07-28 08:31:38 +02:00
Tristan Schulz
c47b2d5f44
Experimenting with an HSV class (#3518)
* Experimenting with an HSL class

* Add some more functionality

* Adding a lot of tests and implementing fully functional conversion between color spaces over proxy rgba

* Fixing tests

* Fixing typing

* return str to normal

* Additional documentation

* Update manim/utils/color/core.py

Co-authored-by: adeshpande <110117391+JasonGrace2282@users.noreply.github.com>

* Update manim/utils/color/core.py

Co-authored-by: adeshpande <110117391+JasonGrace2282@users.noreply.github.com>

* Update manim/utils/color/core.py

Co-authored-by: adeshpande <110117391+JasonGrace2282@users.noreply.github.com>

* Update manim/utils/color/core.py

Co-authored-by: adeshpande <110117391+JasonGrace2282@users.noreply.github.com>

* Fix documentation and typing and revamp operators to respect color spaces

* Fix color operator typing and add operator tests

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Fix typeguard

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Import ManimFloat

* Update manim/utils/color/core.py

Co-authored-by: Aarush Deshpande <110117391+JasonGrace2282@users.noreply.github.com>

* Update manim/utils/color/core.py

Co-authored-by: Aarush Deshpande <110117391+JasonGrace2282@users.noreply.github.com>

* Add docstring to _internal_space

* naming of functions according to pep8

* Fix naming

* Update manim/utils/color/core.py

Co-authored-by: Aarush Deshpande <110117391+JasonGrace2282@users.noreply.github.com>

* Update manim/utils/color/core.py

Co-authored-by: Aarush Deshpande <110117391+JasonGrace2282@users.noreply.github.com>

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: Jason Grace <110117391+JasonGrace2282@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-07-25 22:44:22 +02:00
Aarush Deshpande
2075f82bed
Fix :meth:.OpenGLMobject.invert not reassembling family (#3885)
* fix OpenGLMobject.invert

* return self to match typehint
2024-07-25 18:58:58 +00:00
alembcke
20d0194074
Added colorscale to axes.plot() (#3148)
* add colorscale to plot

* Update manim/mobject/graphing/coordinate_systems.py

Co-authored-by: Benjamin Hackl <devel@benjamin-hackl.at>

* updated typing and moved one line

* added test

* fix input_to_graph_point error

* Performance improvement by using cairo color drawing

* Add OpenGL support

* Add OpenGL tests and split test for x and y axis for more behavior coverage

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Updated gradient_line tests

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: Benjamin Hackl <devel@benjamin-hackl.at>
Co-authored-by: MrDiver <mrdiverlp@gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Francisco Manríquez Novoa <49853152+chopan050@users.noreply.github.com>
Co-authored-by: chopan <francisco.manriquezn@usm.cl>
2024-07-25 18:46:15 +00:00
Aarush Deshpande
3a4ab4cd25
Rename parameters and variables conflicting with builtin functions (#3884)
* Config for flake8-builtins

* Manual changes for flake8-builtins
2024-07-25 20:06:18 +02:00
Aarush Deshpande
d6dac76fa3
Change flake8-comprehensions and flake8-bugbear to ruff (#3882)
* Add config for bugbear/comprehensions

note: flake8-comprehensions has 0 changes to the files

* Safe fixes from pre-commit

* Manual changes to make pre-commit pass

* Remove deps from pyproject
2024-07-25 10:40:13 -04:00
pre-commit-ci[bot]
3aad3553d8
[pre-commit.ci] pre-commit autoupdate (#3880)
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.5.2 → v0.5.4](https://github.com/astral-sh/ruff-pre-commit/compare/v0.5.2...v0.5.4)
- [github.com/pre-commit/mirrors-mypy: v1.10.1 → v1.11.0](https://github.com/pre-commit/mirrors-mypy/compare/v1.10.1...v1.11.0)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-07-22 17:35:46 +00:00
adeshpande
f463423abe
Use ruff instead of flake8-simplify (#3873)
* pyproject

* Autofixes from pre-commit

* use get over get(x, None)

Co-authored-by: Victorien <65306057+Viicos@users.noreply.github.com>

---------

Co-authored-by: Victorien <65306057+Viicos@users.noreply.github.com>
2024-07-22 16:22:11 +00:00
Christopher Hampson
0843632932
feat: set_default for Animation class (#3876)
* feat: Animation.set_default

Adds set_default class method to Animation class based on existing implementation for Mobject class.

Addresses issue #3142

* test: added missing test

* fix: docstring formatting

---------

Co-authored-by: Benjamin Hackl <devel@benjamin-hackl.at>
2024-07-22 13:37:16 +02:00
adeshpande
c8fe4d9e4f
Use ruff for pytest style (#3872)
* Add ruff config for pytest

* Fixes for pre-commit

* Changes to make pre-commit happy (Unrelated to PR)

---------

Co-authored-by: Tristan Schulz <tristanschulz1200@gmail.com>
2024-07-21 14:37:57 +00:00
adeshpande
fa65b488b0
Fix pre-commit linting (#3877) 2024-07-21 15:03:31 +02:00
pre-commit-ci[bot]
a03e73c822
[pre-commit.ci] pre-commit autoupdate (#3865)
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.5.1 → v0.5.2](https://github.com/astral-sh/ruff-pre-commit/compare/v0.5.1...v0.5.2)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-07-15 22:54:45 -04:00
Abulafia
f1ce512225
Fixed behavior of config.background_opacity < 1 and duplicated log messages (#3680)
* Fixes #3614

Setting background_transparency=0.0 should have the same effect than
setting transparent=True. The output format must be compatible
with transparency (.mov, .webm). Otherwise ffpmeg fails.

This patch ensures that background_transparency=0.0 triggers the
change of the output format. Also a WARNING is raised about
the change in the output format.

I want to thank @SirJamesClarkMaxwell for inspiring me to tackle
this issue.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* test config.background_opacity < 1

* fix config behavior for config.background_opacity < 1

* fix logger messages being emitted twice

* actually cleanup usage of loggers, remove logger-imports; black

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* dry_run fixture

* remove debug print

* applied suggestion from review

* remove custom fixture from test_deprecation, use manim_caplog

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: Benjamin Hackl <devel@benjamin-hackl.at>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-07-15 00:50:44 +02:00
adeshpande
205f746bbd
Update docker to use ENV x=y instead of ENV x y (#3858) 2024-07-14 21:13:26 +02:00
CJ Lee
b064af9abb
Update macos.rst (#3857)
* Update macos.rst

As of July/2024, brew installs Manim and its dependencies.
Guideline for installing dependencies with brew, and attempt to install using pip3 will no longer work either venv or not.
Now homebrew team manages python resources as "System-wide" only with Brew installed resources. 
Hence, to give first time installer just leave a single line install command would be the simplest option we have.

* Update docs/source/installation/macos.rst

---------

Co-authored-by: Benjamin Hackl <devel@benjamin-hackl.at>
2024-07-14 12:00:08 +00:00
Francisco Manríquez Novoa
374eeeba0d
Optimize VMobject.pointwise_become_partial() (#3760)
* Optimize VMobject.pointwise_become_partial()

* selftransformation -> self

* Small factorization of nppc
2024-07-13 19:57:08 +02:00
Francisco Manríquez Novoa
3a71411527
Log execution time of scene rendering in the Manim Checkhealth command (#3855)
* Log execution time of scene rendering in the Manim Checkhealth command

* Use timeit.timeit instead of time.time for more reliable profiling
2024-07-13 17:13:14 +00:00
Francisco Manríquez Novoa
1df1709e49
Rewrite manim.utils.bezier.get_quadratic_approximation_of_cubic() to produce curves which can be animated smoothly (#3829)
* Rewrite get_quadratic_approximation_of_cubic() and add test

* Move test_get... to end of file

* Complete docstring for get_quadratic...()
2024-07-13 18:27:45 +02:00
adeshpande
628a54535b
Fix :attr:.ManimConfig.format not updating movie file extension (#3839)
* Fix config.format not updating config.movie_file_extension

* Add test
2024-07-13 11:37:17 +02:00
adeshpande
75625964b6
Change from tempconfig to a config fixture in tests (#3853)
* Implement changes to fixtures

* Change tests to use the config fixture
2024-07-12 22:41:51 +02:00
Francisco Manríquez Novoa
67f95db213
Rename typing.Image type aliases to PixelArray to avoid conflict with PIL.Image (#3851) 2024-07-12 14:07:44 +00:00
dependabot[bot]
bf2feee19e
Bump zipp from 3.18.2 to 3.19.1 (#3847)
Bumps [zipp](https://github.com/jaraco/zipp) from 3.18.2 to 3.19.1.
- [Release notes](https://github.com/jaraco/zipp/releases)
- [Changelog](https://github.com/jaraco/zipp/blob/main/NEWS.rst)
- [Commits](https://github.com/jaraco/zipp/compare/v3.18.2...v3.19.1)

---
updated-dependencies:
- dependency-name: zipp
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-07-11 13:18:45 -04:00
adeshpande
246e44b3d0
Fix incorrect version number in plugin section in docs (#3849) 2024-07-11 11:24:19 -04:00
dependabot[bot]
bb98eca37a
Bump certifi from 2024.2.2 to 2024.7.4 (#3841)
Bumps [certifi](https://github.com/certifi/python-certifi) from 2024.2.2 to 2024.7.4.
- [Commits](https://github.com/certifi/python-certifi/compare/2024.02.02...2024.07.04)

---
updated-dependencies:
- dependency-name: certifi
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: adeshpande <110117391+JasonGrace2282@users.noreply.github.com>
2024-07-08 18:53:08 +00:00
pre-commit-ci[bot]
8614b9832e
[pre-commit.ci] pre-commit autoupdate (#3844)
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.5.0 → v0.5.1](https://github.com/astral-sh/ruff-pre-commit/compare/v0.5.0...v0.5.1)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-07-08 14:34:16 -04:00
dependabot[bot]
73200d6644
Bump docker/build-push-action from 5 to 6 (#3835)
Bumps [docker/build-push-action](https://github.com/docker/build-push-action) from 5 to 6.
- [Release notes](https://github.com/docker/build-push-action/releases)
- [Commits](https://github.com/docker/build-push-action/compare/v5...v6)

---
updated-dependencies:
- dependency-name: docker/build-push-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-07-01 21:17:46 +00:00
pre-commit-ci[bot]
1260346f4e
[pre-commit.ci] pre-commit autoupdate (#3834)
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.4.10 → v0.5.0](https://github.com/astral-sh/ruff-pre-commit/compare/v0.4.10...v0.5.0)
- [github.com/pre-commit/mirrors-mypy: v1.10.0 → v1.10.1](https://github.com/pre-commit/mirrors-mypy/compare/v1.10.0...v1.10.1)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-07-01 15:14:32 -04:00
Chin Zhe Ning
d117c9f4b5
Doc: add docstrings to Brace (#3715)
* Add docstrings to `Brace` methods

* Add full NumPy format docstring for the `Brace` methods

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* feedback

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: JasonGrace2282 <aarush.deshpande@gmail.com>
Co-authored-by: adeshpande <110117391+JasonGrace2282@users.noreply.github.com>
Co-authored-by: Benjamin Hackl <devel@benjamin-hackl.at>
2024-06-30 10:35:26 +00:00
adeshpande
8d70b0e886
Fix docker profile (#3827) 2024-06-27 23:53:24 +02:00
Francisco Manríquez Novoa
64ab9ade2b
Optimized manim.utils.bezier.get_smooth_cubic_bezier_handle_points() (#3767)
* Optimized manim.utils.get_smooth_cubic_bezier_handle_points()

* Fixed typo in docstring regarding vector u

* Add tests for get_smooth_cubic_bezier_handle_points

* Fix backreference in test docstrings

Co-authored-by: adeshpande <110117391+JasonGrace2282@users.noreply.github.com>

---------

Co-authored-by: adeshpande <110117391+JasonGrace2282@users.noreply.github.com>
2024-06-26 16:33:39 +00:00
Sir James Clark Maxwell
0d21a7e6ed
Fixed Arrow3D.put_start_and_end_on() to use the actual end of the arrow (#3706)
* my test is not passing, i need to add a little bit of docs. except that everything is fine. Issue is solved!

* fixed the issue #3655

* removed comments

* fix: 3706 original issue, without adding unnecessary dot
added: i added self.height parameter in Cone class
my tests passes

* Changes that way how end point of Arrow3D is calculated.

* I've improved the methods get_start and get_end for the Cone class, and get_end for the Arrow3D class to ensure they return accurate geometrical points after transformations. Additionally, I've included unit tests to verify the correctness of these methods for the Cone class.

* Finished! Replaced VMobject by VectorizedPoint as Ben suggested while ago

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Francisco Manríquez Novoa <49853152+chopan050@users.noreply.github.com>
2024-06-26 15:33:33 +00:00
adeshpande
93a20cd9e7
feat(autoaliasattr): Implement documentation of TypeVar's (#3818)
* feat(autoaliasattr): Implement Documentation of TypeVar's

* Feedback

---------

Co-authored-by: Francisco Manríquez Novoa <49853152+chopan050@users.noreply.github.com>
2024-06-26 14:55:03 +00:00
pre-commit-ci[bot]
a70aeee723
[pre-commit.ci] pre-commit autoupdate (#3823)
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.4.9 → v0.4.10](https://github.com/astral-sh/ruff-pre-commit/compare/v0.4.9...v0.4.10)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-06-24 13:35:32 -04:00
Nikhil Iyer
d5cdd79709
Fix DiGraph edges not fading correctly on FadeIn and FadeOut (#3786)
* Make `Line::set_points_by_ends` behavior consistent with constructor

* Use `Line::set_points_by_ends` in edge updaters

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Undo unnecessary change to Graph

* Update manim/mobject/geometry/line.py

Co-authored-by: Francisco Manríquez Novoa <49853152+chopan050@users.noreply.github.com>

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Francisco Manríquez Novoa <49853152+chopan050@users.noreply.github.com>
2024-06-22 20:35:21 +00:00
adeshpande
fdb4e37f75
docs(contributing): add manim.typing guide (#3669)
* docs: add manim.typing guide

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Add colors

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Add another example for when to typehint as Vector

* Add docs for images+functions

* write Beziers

* Improve based on feedback

* type -> Type

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Francisco Manríquez Novoa <49853152+chopan050@users.noreply.github.com>
2024-06-22 20:14:36 +00:00
Cameron Burdgick
89d5ed4398
Fixed infinite loop in OpenGL BackgroundRectangle.get_color() (#3732)
Co-authored-by: Francisco Manríquez Novoa <49853152+chopan050@users.noreply.github.com>
2024-06-21 16:56:34 +00:00
adeshpande
82ff488f9c
Update macos packages (#3812) 2024-06-19 13:47:12 -04:00
dependabot[bot]
56354af1e5
Bump urllib3 from 2.2.1 to 2.2.2 (#3810)
Bumps [urllib3](https://github.com/urllib3/urllib3) from 2.2.1 to 2.2.2.
- [Release notes](https://github.com/urllib3/urllib3/releases)
- [Changelog](https://github.com/urllib3/urllib3/blob/main/CHANGES.rst)
- [Commits](https://github.com/urllib3/urllib3/compare/2.2.1...2.2.2)

---
updated-dependencies:
- dependency-name: urllib3
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-06-18 11:47:10 -04:00
pre-commit-ci[bot]
7802e73b88
[pre-commit.ci] pre-commit autoupdate (#3809)
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.4.8 → v0.4.9](https://github.com/astral-sh/ruff-pre-commit/compare/v0.4.8...v0.4.9)
- [github.com/PyCQA/flake8: 7.0.0 → 7.1.0](https://github.com/PyCQA/flake8/compare/7.0.0...7.1.0)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-06-17 13:34:33 -04:00
Eddie Ruiz
3ed86a820b
fix: importing manim should not trigger pygments.styles.get_all_styles (#3797)
* fix: importing manim should not trigger pygments.styles.get_all_styles

Removed the Code.styles_list attribute.

Rewrote the documentation to say that a list of all styles can be generated by calling list(pygments.styles.get_all_styles()).

The example in the docstring of Code was rewritten to use an explicit code style name.

* fix: small change to documentation

* Added potential class method to get available code styles.

* Adding typehints to newly-added attributes.

Co-authored-by: adeshpande <110117391+JasonGrace2282@users.noreply.github.com>

* Removing unnecessary lines.

Co-authored-by: adeshpande <110117391+JasonGrace2282@users.noreply.github.com>

---------

Co-authored-by: adeshpande <110117391+JasonGrace2282@users.noreply.github.com>
2024-06-17 08:31:44 -04:00
Francisco Manríquez Novoa
4641c0a808
Add typings to OpenGLMobject (#3803)
* Add typings to OpenGLMobject

* Import typing_extensions

* Add explicit returns to inner functions in .arrange_in_grid()

* Add quotes to parameters in ValueError

* Add some more typings

* Address requested changes

* Type apply_over_attr_arrays with TypeVar

* Fix use of TypeVar

* Add Vector3D typing in set_x, set_y and set_z
2024-06-13 18:07:43 -04:00
pre-commit-ci[bot]
ece1235d49
[pre-commit.ci] pre-commit autoupdate (#3801)
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.4.7 → v0.4.8](https://github.com/astral-sh/ruff-pre-commit/compare/v0.4.7...v0.4.8)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-06-10 14:18:56 -04:00
yang-tsao
c2fa4f926b
Update opengl_vectorized_mobject.py (#3790)
The "insert_n_curves_to_point_list" function requires the "points" argument to be a numpy array, since it calls the "get_bezier_tuples_from_points" function, which requires "points" to be a numpy array because it has the "return points.reshape((-1, nppc, 3))" statement. Ordinary lists do not have a "reshape" method.

So we need to convert "sp1" and "sp2" to numpy arrays before calling the "insert_n_curves_to_point_list" function.

Co-authored-by: Francisco Manríquez Novoa <49853152+chopan050@users.noreply.github.com>
2024-06-10 08:07:20 -04:00
dependabot[bot]
e30ed6ed82
Bump tornado from 6.4 to 6.4.1 (#3796)
Bumps [tornado](https://github.com/tornadoweb/tornado) from 6.4 to 6.4.1.
- [Changelog](https://github.com/tornadoweb/tornado/blob/master/docs/releases.rst)
- [Commits](https://github.com/tornadoweb/tornado/compare/v6.4.0...v6.4.1)

---
updated-dependencies:
- dependency-name: tornado
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-06-09 23:18:12 -04:00
adeshpande
e74f37ed68
Replace Pyupgrade with Ruff rule (#3795)
* Add config for pyupgrade

* Fix pyupgrade errors

* Unsafe-fixes

* Nicer way of formatting

Co-authored-by: Victorien <65306057+Viicos@users.noreply.github.com>

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Revert "Nicer way of formatting"

This reverts commit 48013f4a30.

---------

Co-authored-by: Victorien <65306057+Viicos@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-06-05 08:08:21 -04:00
adeshpande
252aac30da
Add Ruff Lint (#3780)
Adds Ruff Linting to CI, and replaces isort in the pre-commit config with Ruff's isort rules.

Co-authored-by: Victorien <65306057+Viicos@users.noreply.github.com>

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Victorien <65306057+Viicos@users.noreply.github.com>
2024-06-03 23:39:08 -04:00
pre-commit-ci[bot]
aec3d86122
[pre-commit.ci] pre-commit autoupdate (#3794)
updates:
- [github.com/astral-sh/ruff-pre-commit: v0.4.5 → v0.4.7](https://github.com/astral-sh/ruff-pre-commit/compare/v0.4.5...v0.4.7)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-06-03 23:16:13 -04:00
pre-commit-ci[bot]
31df6d0a23
[pre-commit.ci] pre-commit autoupdate (#3784)
* [pre-commit.ci] pre-commit autoupdate

updates:
- [github.com/astral-sh/ruff-pre-commit: v0.4.4 → v0.4.5](https://github.com/astral-sh/ruff-pre-commit/compare/v0.4.4...v0.4.5)
- [github.com/codespell-project/codespell: v2.2.6 → v2.3.0](https://github.com/codespell-project/codespell/compare/v2.2.6...v2.3.0)

* Fix typo

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: JasonGrace2282 <aarush.deshpande@gmail.com>
2024-05-27 20:19:22 +00:00
adeshpande
90ae6ad804
Add @ shorthand for CoordinateSystem methods coords_to_point (c2p) and point_to_coords (p2c) (#3754)
* Add shorthand for axes

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Add spacing

Co-authored-by: Victorien <65306057+Viicos@users.noreply.github.com>

* Convert CoordinateSystem example, and add to NumberLine

* Add doctest for NumberLine

* Add test

* Fix typehint for c2p

Co-authored-by: Victorien <65306057+Viicos@users.noreply.github.com>

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Victorien <65306057+Viicos@users.noreply.github.com>
Co-authored-by: Francisco Manríquez Novoa <49853152+chopan050@users.noreply.github.com>
2024-05-27 17:34:08 +00:00
Francisco Manríquez Novoa
938b8fc344
Optimize VMobject methods which append to points (#3765) 2024-05-23 10:30:25 -04:00
jkjkil4
0a2fbbeffb
Fixed there_and_back_with_pause() rate function behaviour with different pause_ratio values (#3778)
Co-authored-by: Francisco Manríquez Novoa <49853152+chopan050@users.noreply.github.com>
2024-05-22 18:22:35 +00:00
Victorien
c9776be7da
Ignore Ruff format in git blame (#3781) 2024-05-22 13:32:50 -04:00
adeshpande
24025b60d5
pre-commit change to ruff (#3779)
* pre-commit change to ruff

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* fixes

* astral-sh ruff bump

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-05-22 12:03:23 -04:00
adeshpande
21eb0b7769
Add pyproject for ruff formatting (#3777)
* Add pyproject for ruff

* add black config back

* Make only formatting

* rearrange isort to undo diff

* poetry lock

* Feedback

* style

Co-authored-by: Victorien <65306057+Viicos@users.noreply.github.com>

---------

Co-authored-by: Victorien <65306057+Viicos@users.noreply.github.com>
2024-05-22 10:56:40 +00:00
Francisco Manríquez Novoa
0d67dcdc6e
Fix assertions and improve error messages when adding submobjects (#3756)
* Optimized AnimationGroup computation of start-end times with lag ratio

* Added extra comment for init_run_time

* Added full path to imports in composition.py

* Optimized AnimationGroup.interpolate

* Fixed final bugs

* Removed accidental print

* Final fix to AnimationGroup.interpolate

* Fixed animations being skipped unintentionally

* Fix and improve Mobject assertions when adding submobjects

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update examples in Mobject.add() and OpenGLMobject.add() docstrings

* overriden -> overridden

* Joined string in OpenGLMobject error message

* Address requested changes

* OpenGLVMObjects -> OpenGLVMobjects

* Use tuplify in VGroup.__setitem__()

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-05-21 15:30:46 -04:00
dependabot[bot]
739958514f
Bump requests to 2.32.0 (#3776)
updated-dependencies:
- dependency-name: requests
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-05-21 09:00:12 -04:00
Francisco Manríquez Novoa
7b841c27cc
Created and optimized Bézier splitting functions such as partial_bezier_points() in manim.utils.bezier (#3766)
* Optimized manim.utils.partial_bezier_points()

* Added split_bezier, subdivide_bezier and bezier_remap, and tests

* Use bezier_remap() in VMobject and OpenGLVMobject()

* Note that partial_bezier_points is similar to calling split_bezier twice
2024-05-21 05:26:59 +00:00
Francisco Manríquez Novoa
b4156045a3
Optimized manim.utils.bezier.is_closed() (#3768)
* Optimized manim.utils.bezier.is_closed()

* oops, that shouldn't have been there

* Slightly optimized is_closed() even more

* Added doctest for is_closed()
2024-05-20 03:49:52 +00:00
adeshpande
203a5366c2
Use --py39-plus in pre-commit (#3761)
* Use --py39-plus in pre-commit

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* fix indication.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-05-15 17:24:16 -04:00
Benjamin Hackl
1f249e45b9
Let SceneFileWriter access ffmpeg via av instead of via external process (#3501)
* added av as a dependency

* make partial movie files use av instead of piping to external ffmpeg

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* opengl rendering: use av for movie files

* no need to check for ffmpeg executable

* refactor: *_movie_pipe -> *_partial_movie_stream

* improve (oneline) documentation

* pass more options to partial movie file rendering

* move ffmpeg verbosity settings to config; renamed option dict

* replaced call to ffmpeg in combine_files by using av

Co-authored-by: Jérome Eertmans <jeertmans@icloud.com>

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* there was one examples saved as a gif?

* chore(deps): re-order av

* chore(lib): simplify `write_frame` method

Reduces the overall code complexity

* chore(lib): add audio

* fix(lib): same issue for conversion

* fix(lib): webm export

* fix(lib): transparent export

Though the output video is weird

* try(lib): fix gif + TODOs

* chore(deps): lower dep crit

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* feat(lib): add support for GIF

* fix(ci): rewrite tests

* fix

* chore(ci): prevent calling concat on empty list

* add missing dot

* fix(ci): update frame comparison ?

* fix(log): add handler to libav logger

* chore: add TODO

* fix(lib): concat issue

* Revert "fix(ci): update frame comparison ?"

This reverts commit 904cfb46ae.

* fix(ci): make it pass tests

* chore(lib/docs/ci): remove FFMPEG entirely

This removes any reference to FFMPEG, except in translation files

* added av as a dependency

* make partial movie files use av instead of piping to external ffmpeg

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* opengl rendering: use av for movie files

* no need to check for ffmpeg executable

* refactor: *_movie_pipe -> *_partial_movie_stream

* improve (oneline) documentation

* pass more options to partial movie file rendering

* move ffmpeg verbosity settings to config; renamed option dict

* replaced call to ffmpeg in combine_files by using av

Co-authored-by: Jérome Eertmans <jeertmans@icloud.com>

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* there was one examples saved as a gif?

* chore(deps): re-order av

* chore(lib): simplify `write_frame` method

Reduces the overall code complexity

* chore(lib): add audio

* fix(lib): same issue for conversion

* fix(lib): webm export

* fix(lib): transparent export

Though the output video is weird

* try(lib): fix gif + TODOs

* chore(deps): lower dep crit

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* feat(lib): add support for GIF

* fix(ci): rewrite tests

* fix

* chore(ci): prevent calling concat on empty list

* add missing dot

* fix(ci): update frame comparison ?

* fix(log): add handler to libav logger

* chore: add TODO

* fix(lib): concat issue

* Revert "fix(ci): update frame comparison ?"

This reverts commit 904cfb46ae.

* fix(ci): make it pass tests

* chore(lib/docs/ci): remove FFMPEG entirely

This removes any reference to FFMPEG, except in translation files

* chore(deps): update lockfile

* chore(lib): rewrite ffprobe

* fix typo

* slightly more aggressive removal of ffmpeg in docs; minor language changes

* fix gif output stream dimensions

* minor style change

* fix encoding of (transparent) mov files

* fixed metadata / comment

* set frame rate for --format=gif in output_stream

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* more video tests for different render settings, also test pix_fmt

* improve default bitrate setting via crf

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* parametrized format/transparency rendering test

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* context managers for (some) av.open

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update manim/utils/commands.py

Co-authored-by: Jérome Eertmans <jeertmans@icloud.com>

* fixed segfault

* update test data involving implicit functions (output improved!)

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* explicity set pix_fmt for transparent webms

* special-special case extracting frame from vp9-encoded file with transparency

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* fix transparent gifs, more special casing in parametrized video format test

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* run tests on macos-latest again

* removed old control data

* Revert "run tests on macos-latest again"

This reverts commit f50efa4b88.

* added sound to codec test; fixed issue with sound track in gif (disabled) and webm (now via opus)

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* manual wav -> ogg transcoding

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* fixed f-string

* refactored codec test, split out gif

* check for non-zero audio samples

* more cleanup

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* remove ffmpeg from readthedocs apt_packages

* round up run_time if positive and shorter than current frame rate

* added more run_time tests

* black

* improve implementation of test

* removed some unused imports

* improve wording of logged warning

Co-authored-by: Jérome Eertmans <jeertmans@icloud.com>

* move run_time checks from Animation.begin to Scene.get_run_time

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* remove unused import

* flake: PT012

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Jérome Eertmans <jeertmans@icloud.com>
2024-05-15 13:23:09 +00:00
adeshpande
4bd2f860b4
Add typehints to manim.utils.iterables (#3751)
* typehint iterables

* organize typing hints

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* remove any

* Add overloads for tuplify

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Remove example

* feedback

* Make TypeVars accessible at runtime

* Add hints for zip

Co-authored-by: Victorien <65306057+Viicos@users.noreply.github.com>

* typing -> collections.abc

Co-authored-by: Victorien <65306057+Viicos@users.noreply.github.com>

* try to make mypy happy

* zip[tuple[T, ...]] instead of zip[T]

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Victorien <65306057+Viicos@users.noreply.github.com>
2024-05-11 21:33:03 -04:00
dependabot[bot]
94cd27c234
Bump jinja2 from 3.1.3 to 3.1.4 (#3750)
Bumps [jinja2](https://github.com/pallets/jinja) from 3.1.3 to 3.1.4.
- [Release notes](https://github.com/pallets/jinja/releases)
- [Changelog](https://github.com/pallets/jinja/blob/main/CHANGES.rst)
- [Commits](https://github.com/pallets/jinja/compare/3.1.3...3.1.4)

---
updated-dependencies:
- dependency-name: jinja2
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-05-06 19:41:58 -04:00
dependabot[bot]
e4ee9a06a1
Bump tqdm from 4.66.1 to 4.66.3 (#3746)
Bumps [tqdm](https://github.com/tqdm/tqdm) from 4.66.1 to 4.66.3.
- [Release notes](https://github.com/tqdm/tqdm/releases)
- [Commits](https://github.com/tqdm/tqdm/compare/v4.66.1...v4.66.3)

---
updated-dependencies:
- dependency-name: tqdm
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-05-04 15:08:19 -04:00
anagorko
93c601f013
Fixes #3744 (#3745)
Co-authored-by: Andrzej Nagórko <>
2024-05-03 20:46:20 +02:00
pre-commit-ci[bot]
31f189519b
[pre-commit.ci] pre-commit autoupdate (#3739)
updates:
- [github.com/psf/black: 24.4.0 → 24.4.2](https://github.com/psf/black/compare/24.4.0...24.4.2)
- [github.com/pre-commit/mirrors-mypy: v1.9.0 → v1.10.0](https://github.com/pre-commit/mirrors-mypy/compare/v1.9.0...v1.10.0)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-04-29 14:17:54 -04:00
adeshpande
a56c0c9fee
Fix release documentation building (#3737) 2024-04-29 00:37:27 +02:00
VPC
4a0c7057db
feat: Add three animations that together simulate a typing animation (#3612)
* feat: Add animations that together simulate typing

AddTextLetterByLetterWithCursor

RemoveTextLetterByLetterWithCursor

Blink

* Revert "feat: Add animations that together simulate typing"

This reverts commit 5fe256880d.

* Revert "Revert "feat: Add animations that together simulate typing""

This reverts commit 6a8244a157.

* Add new animations to __all__

* Temporarily remove docs example

* Modify "Blink" and add docstring examples back in

To avoid 0-second animations, which fail docstring test

* Address requested changes

Fix imports
Remove redundant constructor arguments
Improve names

* Shorten names
2024-04-28 16:19:24 +00:00
Benjamin Hackl
33e560473d
Prepare new release: v0.18.1 (#3719)
* add note about changelog in changelog.rst

* bump version

* Update CITATION.cff
2024-04-28 09:02:22 +00:00
Benjamin Hackl
6cb89a06ba
fixed [""] being set as loaded plugins (#3734) 2024-04-28 00:35:29 +02:00
Jinchu Li
c4e7502968
Fixed ``get_anchors()`` Return Type Inconsistency (#3214)
* changed return type of get_anchors()

* Ensured consistency with OpenGLVMobject

* Fixed CodeQl, updated docstring

* Update manim/mobject/types/vectorized_mobject.py

Co-authored-by: Benjamin Hackl <devel@benjamin-hackl.at>

* Update manim/mobject/opengl/opengl_vectorized_mobject.py

Co-authored-by: Benjamin Hackl <devel@benjamin-hackl.at>

* fixed typo, t -> e

* fixed doctest

---------

Co-authored-by: Tristan Schulz <mrdiverlp@gmail.com>
Co-authored-by: Benjamin Hackl <devel@benjamin-hackl.at>
Co-authored-by: Francisco Manríquez Novoa <49853152+chopan050@users.noreply.github.com>
2024-04-27 23:54:24 +02:00
Francisco Manríquez Novoa
1ce3edd97a
AnimationGroup: optimized interpolate() and fixed alpha bug on finish() (#3542)
* Optimized AnimationGroup computation of start-end times with lag ratio

* Added extra comment for init_run_time

* Added full path to imports in composition.py

* Optimized AnimationGroup.interpolate

* Fixed final bugs

* Removed accidental print

* Final fix to AnimationGroup.interpolate

* Fixed animations being skipped unintentionally

* Addressed requested changes

---------

Co-authored-by: Benjamin Hackl <devel@benjamin-hackl.at>
2024-04-27 23:34:17 +02:00
adeshpande
98641a2f82
Add `--preview_command` cli flag (#3615)
* Add preview_command cli flag

* Edit help for --preview_command

* Change back from subprocess.run

* Remove old comment

* Bug with timg stopped happening with sp.run

* Fix docstring

* Revert "Fix docstring"

This reverts commit d2c00fc24dc46586f994237f1d2758528b78d6a3.

* Actually fix docstring

* Change help for option

Co-authored-by: Benjamin Hackl <devel@benjamin-hackl.at>

---------

Co-authored-by: Benjamin Hackl <devel@benjamin-hackl.at>
2024-04-27 23:18:48 +02:00
adeshpande
a3d584b7f4
build(ci): change from macos-latest to macos-13 (#3729) 2024-04-27 00:57:17 +02:00
Amirreza A
791a892be3
Update coordinate_systems.py (#3730)
small change
2024-04-27 00:55:03 +02:00
Benjamin Hackl
0f268e6f9c
Follow-up to graph layout cleanup: improvements for tests and typing (#3728)
* suggestions from review on #3434

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-04-25 00:38:16 +02:00
Nikhil Iyer
a3adcaaab3
Clean Graph layouts and increase flexibility (#3434)
* allow user-defined layout functions for Graph
+ fixup type annotations

* only pass relevant args

* write tests

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* change_layout forward root_vertex and partitions
- deduplicated layout code in __init__ and change_layout
- fixed change_layout backwards compatibility

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* add test for change_layout

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* fix copy/paste error

* fix

* fixup types for CodeQL

* static type the Layout Names

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* fix dynamic union type for Python 3.9

* add example scenes to LayoutFunction protocol documentation

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Replace references to np.ndarray with standard Manim types

* Label NxGraph as a TypeAlias

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Tristan Schulz <mrdiverlp@gmail.com>
Co-authored-by: Benjamin Hackl <devel@benjamin-hackl.at>
2024-04-24 23:33:44 +02:00
Greg Rupp
aa3e2cf54e
Fix issue where SpiralIn doesn't show elements. (#3589)
* Set SpiralIn to use fill_opacity 1 if not set

* Create SpiralIn control data

* Create test for SpiralIn

* Fix spiralin to separate fill and stroke opacity

* resolve opacity issue

* fix test data

---------

Co-authored-by: Benjamin Hackl <devel@benjamin-hackl.at>
2024-04-24 22:02:13 +02:00
adeshpande
c32f0fd83a
build(deps): read-the-docs sphinx (#3720) 2024-04-24 16:52:15 +02:00
adeshpande
a4e5233273
fix(autoaliasattr): search for type aliases under if TYPE_CHECKING (#3671) 2024-04-24 08:02:43 -04:00
pre-commit-ci[bot]
1aee37bfb5
[pre-commit.ci] pre-commit autoupdate (#3332)
* [pre-commit.ci] pre-commit autoupdate

updates:
- [github.com/pre-commit/pre-commit-hooks: v4.4.0 → v4.6.0](https://github.com/pre-commit/pre-commit-hooks/compare/v4.4.0...v4.6.0)
- [github.com/pycqa/isort: 5.12.0 → 5.13.2](https://github.com/pycqa/isort/compare/5.12.0...5.13.2)
- [github.com/asottile/pyupgrade: v3.10.1 → v3.15.2](https://github.com/asottile/pyupgrade/compare/v3.10.1...v3.15.2)
- [github.com/psf/black: 23.7.0 → 24.4.0](https://github.com/psf/black/compare/23.7.0...24.4.0)
- [github.com/asottile/blacken-docs: 1.15.0 → 1.16.0](https://github.com/asottile/blacken-docs/compare/1.15.0...1.16.0)
- [github.com/PyCQA/flake8: 6.1.0 → 7.0.0](https://github.com/PyCQA/flake8/compare/6.1.0...7.0.0)
- [github.com/pre-commit/mirrors-mypy: v1.5.1 → v1.9.0](https://github.com/pre-commit/mirrors-mypy/compare/v1.5.1...v1.9.0)
- [github.com/codespell-project/codespell: v2.2.5 → v2.2.6](https://github.com/codespell-project/codespell/compare/v2.2.5...v2.2.6)

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* make smoothererstep readable again, avoid overlong line

* zoom_value more readable

* fix blacken-docs touching .github

* fix codespell setup, remove unnecessary file, fix some typos

* flake8: ignore E704, triggered by overload

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update docs/source/tutorials/quickstart.rst

* more flake fixes

* try to make blacken-docs happy

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Benjamin Hackl <devel@benjamin-hackl.at>
2024-04-24 13:11:03 +02:00
MontroyJosh
0fd16b8918
Fixed Mobject.put_start_and_end_on with same start and end point (#3718)
* fix put_start_and_end_on() at the same point

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-04-24 12:37:44 +02:00
Stefano Ottolenghi
563810a772
Fix typo (#3721) 2024-04-24 12:21:37 +02:00
dependabot[bot]
dff83be61f
Bump pillow from 10.2.0 to 10.3.0 (#3672)
Bumps [pillow](https://github.com/python-pillow/Pillow) from 10.2.0 to 10.3.0.
- [Release notes](https://github.com/python-pillow/Pillow/releases)
- [Changelog](https://github.com/python-pillow/Pillow/blob/main/CHANGES.rst)
- [Commits](https://github.com/python-pillow/Pillow/compare/10.2.0...10.3.0)

---
updated-dependencies:
- dependency-name: pillow
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-04-21 11:23:20 +02:00
dependabot[bot]
83957b9c2f
Bump idna from 3.6 to 3.7 (#3693)
Bumps [idna](https://github.com/kjd/idna) from 3.6 to 3.7.
- [Release notes](https://github.com/kjd/idna/releases)
- [Changelog](https://github.com/kjd/idna/blob/master/HISTORY.rst)
- [Commits](https://github.com/kjd/idna/compare/v3.6...v3.7)

---
updated-dependencies:
- dependency-name: idna
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-04-21 11:22:37 +02:00
adeshpande
f8e3408f9e
Fix some typehints in mobject.py (#3668)
* refactor(mobject): fix some typehints

* Move typing_extensions import under `if TYPE_CHECKING`
* Change from using `def animate(self: T ,...) -> T` to `def
  animate(self, ...) -> Self` as stated in PEP 673
* Fix incorrect usage of `T` in a method

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* move updaters type alias into TYPE_CHECKING

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-04-20 16:16:29 +02:00
adeshpande
679b89a43f
fix(copyright): automate copyright updating for docs (#3708) 2024-04-19 23:42:17 +02:00
Daniel Zhu
f9dc9c7a5b
Update documentation and typings for ParametricFunction (#3703)
* Update documentation and typings for ParametricFunction

* Use manim tyings

Co-authored-by: adeshpande <110117391+JasonGrace2282@users.noreply.github.com>

* fix typings

* a few doc fixes

* Update manim/mobject/graphing/functions.py

Co-authored-by: adeshpande <110117391+JasonGrace2282@users.noreply.github.com>

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* update typings

* remove extraneous line

* update example code

* add line back for comptibility

* import TYPE_CHECKING

---------

Co-authored-by: adeshpande <110117391+JasonGrace2282@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-04-19 07:11:13 -04:00
adeshpande
5139765ff4
docs: update typing guidelines (#3704)
* Update typing guidelines

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* fix formatting

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci
2024-04-16 21:40:15 -04:00
dependabot[bot]
04bfa22107
Bump ssciwr/setup-mesa-dist-win from 1 to 2 (#3609)
Bumps [ssciwr/setup-mesa-dist-win](https://github.com/ssciwr/setup-mesa-dist-win) from 1 to 2.
- [Release notes](https://github.com/ssciwr/setup-mesa-dist-win/releases)
- [Commits](https://github.com/ssciwr/setup-mesa-dist-win/compare/v1...v2)

---
updated-dependencies:
- dependency-name: ssciwr/setup-mesa-dist-win
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-04-14 22:18:04 +00:00
dependabot[bot]
dc0db41245
Bump FedericoCarboni/setup-ffmpeg from 2 to 3 (#3608)
Bumps [FedericoCarboni/setup-ffmpeg](https://github.com/federicocarboni/setup-ffmpeg) from 2 to 3.
- [Release notes](https://github.com/federicocarboni/setup-ffmpeg/releases)
- [Commits](https://github.com/federicocarboni/setup-ffmpeg/compare/v2...v3)

---
updated-dependencies:
- dependency-name: FedericoCarboni/setup-ffmpeg
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-04-14 21:50:46 +00:00
dependabot[bot]
a45c0d4b67
Bump actions/cache from 3 to 4 (#3607)
Bumps [actions/cache](https://github.com/actions/cache) from 3 to 4.
- [Release notes](https://github.com/actions/cache/releases)
- [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md)
- [Commits](https://github.com/actions/cache/compare/v3...v4)

---
updated-dependencies:
- dependency-name: actions/cache
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: adeshpande <110117391+JasonGrace2282@users.noreply.github.com>
2024-04-14 21:20:24 +00:00
Sir James Clark Maxwell
27766127e2
Fix successive calls of :meth:.LinearTransformationScene.apply_matrix (#3675)
* docs: improve installation FAQ's

* I have potentially resolved the issue when in LinearTransformationScene between two animations of transforming space we invoke the self.wait()

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* added another solutions in comments, added tests and removed wrong files from git

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* yeah , i forgot to save the file xd

* fixed the test, removed the comments my in changed file

* fix test and speed up test time for test_apply_matrix

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* fixed the test, removed the comments my in changed file

* fixed the test

* Revert "docs: improve installation FAQ's"

This reverts commit e53a1c8d6f.

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: JasonGrace2282 <aarush.deshpande@gmail.com>
Co-authored-by: adeshpande <110117391+JasonGrace2282@users.noreply.github.com>
2024-04-14 13:22:36 +00:00
Pavel Zwerschke
2a4c2da1d7
Mention pixi in installation guide (#3678)
* Mention pixi in installation guide

* Update docs/source/installation/conda.rst

Co-authored-by: adeshpande <110117391+JasonGrace2282@users.noreply.github.com>

* Apply suggestions from code review

Co-authored-by: Benjamin Hackl <devel@benjamin-hackl.at>

* Add note

---------

Co-authored-by: adeshpande <110117391+JasonGrace2282@users.noreply.github.com>
Co-authored-by: Benjamin Hackl <devel@benjamin-hackl.at>
2024-04-14 11:56:25 +00:00
adeshpande
902c3f4215
only do actions if try succeeded (#3694) 2024-04-14 10:31:40 +02:00
HairlessVillager
aef8184379
Docs: fix out-dated CLI option in Manim's Output Settings (#3674)
* Docs: fix out-dated CLI option in Manim's Output Settings

* Docs: more fluent English

Co-authored-by: adeshpande <110117391+JasonGrace2282@users.noreply.github.com>

* Docs: break lines

* Docs: more fluent English

* Docs: remove a space

Co-authored-by: adeshpande <110117391+JasonGrace2282@users.noreply.github.com>

---------

Co-authored-by: adeshpande <110117391+JasonGrace2282@users.noreply.github.com>
2024-04-13 09:02:34 -04:00
Chin Zhe Ning
b750152700
Fix typo (#3696) 2024-04-12 06:42:28 -04:00
adeshpande
93cf85cd42
Attempted fix for windows cp1252 encoding failure (#3687)
* Attempt to fix windows test

* Revert "Attempt to fix windows test"

This reverts commit e31c2077cd.

* try a different fix

* maybe both fixes together?

* try adding in CI

* Update ci.yml

* Update logger_utils.py

* maybe needs a dash?

* try utf8 again

* Remove legacy_windows

* try changing test

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Try decoding after capturing bytes output

* Nicer fix

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci
2024-04-11 23:56:59 +02:00
adeshpande
294313d683
Remove deprecated parameters and animations (#3688)
* Remove deprecated parameters/animations

* Remove test

* Remove test data
2024-04-11 19:49:02 +02:00
adeshpande
a6da37b88c
fix(LICENSE): update year (#3689) 2024-04-11 17:57:55 +02:00
Chin Zhe Ning
d62a04f059
Fix minor grammatical errors found in the index page of the documentation (#3690)
* Fix some minor grammatical errors in the index page of the docs

* Fix grammar

* Undo uneccessary change in phrasing
2024-04-11 17:57:40 +02:00
Chin Zhe Ning
7936c7d08a
Fix broken link to Poetry's installation guide in the first time contributors page (#3692) 2024-04-11 17:55:40 +02:00
Christian Clauss
1aad0c7b1a
Flake8 rule C901 is about McCabe code complexity (#3673)
* Flake8 rule C901 is about McCabe code complexity

It is not about flake8-comprehensions.

* max-complexity = 29
2024-04-09 08:22:30 +02:00
Abulafia
c025be6516
Fix bug in :class:.VMobjectFromSVGPath (#3677)
* Fixes #3676

* Update manim/mobject/svg/svg_mobject.py

Co-authored-by: adeshpande <110117391+JasonGrace2282@users.noreply.github.com>

* Fixed problem and added test

---------

Co-authored-by: adeshpande <110117391+JasonGrace2282@users.noreply.github.com>
2024-04-08 18:46:43 +02:00
adeshpande
ef675b64f0
Fix typehint of Vector direction parameter (#3640)
* Fix typehint of Vector

* Change from Vector to Point in typehint

In `TipableVMobject._pointify` it converts a 3D
list of the form [x, y, z] to a Vector3D. Therefore
the direction parameter can take lists, not just numpy arrays.
2024-04-02 18:44:41 +00:00
adeshpande
afe1d18de5
Added some examples for Mobject/VMobject methods (#3641)
* Add examples to mobject+vmobject methods

* Add missing import

* Separate whitespace to point_from_proportion

* Fixes!

* Changed example of Mobject.get_color

* Remove unneccessary import

* Add in import
2024-04-01 13:50:10 +00:00
Tristan Schulz
909ffded28
Fixing the behavior of .become to not modify target mobject via side effects fix color linking (#3508)
* Copied ndarray for rgbas when interpolating

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* changing .become to copy the target mobject

* change tests and test data to reflect .become new behavior

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update tests/test_graphical_units/test_mobjects.py

* removed unused copy_submobject kwarg

* added doctests and improved documentation

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Benjamin Hackl <devel@benjamin-hackl.at>
2024-04-01 03:41:57 +00:00
adeshpande
7a794e341f
Code Cleanup: removing unused imports and global variables (#3620)
* Remove unused import

* More security fixes

* Remove unused global variable

* More fixes

* Revert change (actual fix would require some rewrite)

* Add exception for edge case to satisfy warning

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Stuff

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-04-01 03:21:14 +00:00
dependabot[bot]
d1cf1c5750
Bump cryptography from 42.0.0 to 42.0.4 (#3629)
Bumps [cryptography](https://github.com/pyca/cryptography) from 42.0.0 to 42.0.4.
- [Changelog](https://github.com/pyca/cryptography/blob/main/CHANGELOG.rst)
- [Commits](https://github.com/pyca/cryptography/compare/42.0.0...42.0.4)

---
updated-dependencies:
- dependency-name: cryptography
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-04-01 02:55:22 +00:00
dependabot[bot]
f65ebf2194
Bump black from 23.12.1 to 24.3.0 (#3649)
Bumps [black](https://github.com/psf/black) from 23.12.1 to 24.3.0.
- [Release notes](https://github.com/psf/black/releases)
- [Changelog](https://github.com/psf/black/blob/main/CHANGES.md)
- [Commits](https://github.com/psf/black/compare/23.12.1...24.3.0)

---
updated-dependencies:
- dependency-name: black
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-04-01 04:26:37 +02:00
adeshpande
9f3d486095
Fix Vector3 -> Vector3D in contributing docs (#3639) 2024-03-17 15:13:08 -04:00
Abulafia
77d42d2a46
Update jupyter.rst (#3630)
Pinpoint IPython==8.21.0 for Google Colab, because more recent versions are incompatible with their runtime.
2024-02-24 00:08:47 +01:00
Jason Grace
c7e7ca2e46
Run poetry lock --no-update (#3621) 2024-02-15 17:17:29 -05:00
Victorien
206f8740b9
Remove support for dynamic plugin imports (#3524)
* Remove call to deprecated `pkg_resources`

* Remove support for dynamic plugin imports, update plugin utilities

* fix affected tests

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* more fixes

* Last fix

* Fix import

* Update docs

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Jason Villanueva <a@jsonvillanueva.com>
2024-02-15 08:17:13 -08:00
Said Taghadouini
fcd81b21a4
Improve handling of specified font name (#3429)
Co-authored-by: Jason Grace <110117391+JasonGrace2282@users.noreply.github.com>
Co-authored-by: JasonGrace2282 <aarush.deshpande@gmail.com>

The proposed fix does two things :

* If the specified font is 'sans-serif' : change it to 'sans' as this is the name used in the list of fonts
* if the font name is not in the list of fonts, automatically check if the capitalized version of the font exists in the list of fonts. If not, print a warning to the user.
2024-02-13 15:26:54 -05:00
Francisco Manríquez Novoa
011c36a634
Revert vector type aliases to NumPy ndarrays (#3595) 2024-02-13 00:27:39 +01:00
yuan
ed1b203993
fix type hint of indication.py (#3613) 2024-02-03 19:14:16 -05:00
Benjamin Hackl
1520481812
Update ci.yml (#3611) 2024-02-01 19:22:24 -05:00
Jason Grace
65d352d0ab
Fix typehint (#3592) 2024-02-02 00:31:53 +01:00
Jason Grace
f70980aa40
Add ref_class (#3598) 2024-02-01 23:27:49 +01:00
Sparsh Goenka
e2cec98f9a
fix get_arc_center() returning reference of point (#3599) 2024-02-01 23:27:17 +01:00
yuan
d0fe0c3894
fix typo in value_tracker.py (#3594) 2024-01-25 08:27:18 +01:00
NotWearingPants
f8b5066899
Update docker.rst to use bash from the PATH (#3582) 2024-01-25 00:41:38 +01:00
yuan
175cb89400
fix write_subcaption_file error when using opengl renderer (#3546)
* fix write_subcaption_file error when using opengl renderer

* Update manim/scene/scene_file_writer.py

---------

Co-authored-by: Benjamin Hackl <devel@benjamin-hackl.at>
2024-01-25 00:40:30 +01:00
Greg Rupp
7006d6b79e
Removed -s / --save_last_frame flag from CLI arguments (#3528)
* Remove -s flag

* Make help text more verbose
2024-01-24 21:12:24 +01:00
Benjamin Hackl
8264595e3b
updated several packages (pillow, jupyterlab, notebook, jupyterlab-lsp, jinja2, gitpython) (#3593) 2024-01-24 21:07:17 +01:00
dependabot[bot]
9289a5c68d
Bump actions/setup-python from 4 to 5 (#3565)
Bumps [actions/setup-python](https://github.com/actions/setup-python) from 4 to 5.
- [Release notes](https://github.com/actions/setup-python/releases)
- [Commits](https://github.com/actions/setup-python/compare/v4...v5)

---
updated-dependencies:
- dependency-name: actions/setup-python
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-24 20:22:51 +01:00
dependabot[bot]
9d880c2f80
Bump actions/upload-artifact from 3 to 4 (#3566)
Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 3 to 4.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](https://github.com/actions/upload-artifact/compare/v3...v4)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-24 20:21:47 +01:00
dependabot[bot]
775482bc20
Bump github/codeql-action from 2 to 3 (#3567)
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 2 to 3.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/v2...v3)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-24 20:21:21 +01:00
Viicos
68bd79093e
Refactor TexTemplate (#3520)
* Refactor `TexTemplate`

* Add tests, refactor some things

* Fixed Some tests

* Move typing imports

* Fix remaining tests

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: JasonGrace2282 <aarush.deshpande@gmail.com>
Co-authored-by: Jason Grace <110117391+JasonGrace2282@users.noreply.github.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-01-15 18:39:03 +00:00
Francisco Manríquez Novoa
a57fb69f68
Add 'to be used in the future' TODOs to ManimFrame (#3553) 2024-01-15 18:07:50 +00:00
Dan Davison
9a84ec6a45
Fix typing of Animation (#3568) 2024-01-13 18:39:40 +01:00
Hydromel Victor Doledji
4e3cfd207a
exception add if new_rings is none (#3574)
* exception add if new_rings is none

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-01-11 08:23:49 -05:00
Václav Volhejn
3b496ea2e6
Add helpful hints to VGroup.add() error message (#3561)
* Improve VGroup creation error message

* Use .__name__ for the type

Co-authored-by: Jason Grace <110117391+JasonGrace2282@users.noreply.github.com>

---------

Co-authored-by: Jason Grace <110117391+JasonGrace2282@users.noreply.github.com>
2024-01-03 00:30:53 +01:00
Francisco Manríquez Novoa
286f366a35
Improve documentation section about contributing to docs (#3555)
* Improve section in docs about contributing to docs

* Add note about doc build command depending on the OS

* Improve section in docs about contributing to docs

* Add note about doc build command depending on the OS

* Fix wrong toctree path in docs/source/contributing/docs.rst
2023-12-30 00:22:24 +01:00
Francisco Manríquez Novoa
02391d71ac
Added support for Manim type aliases in Sphinx docs + Added new TypeAliases (#3484)
* Updated manim.typing and included TypeAliases in docs.source.conf

* Added Vector2 and reorganized manim_type_aliases

* Fixed __all__ exports for __all__ of manim

* Update manim/cli/render/global_options.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Draft of new typing docs and new autotyping directive

* Changed vertical bars to Unions

* Updated poetry.lock

* Created custom file parser for manim.typing

* Got reST parser going

* Updated autotyping and parsing

* Update parsing

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Added code_block toggle

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Added typings to directives

* Renamed Tuple to tuple in manim.typings

* Added missing docs for type aliases

* Fixed exponent typo in ManimInt

* Hyperlinks to types work - removed Module Attributes section

* Removed Unused Import

Remove ``import re``

* Added freeglut-devel to workflows for Linux

Hopefully (?) fix the GLU import error

* Fix package name

* Add support for Type Aliases section in every module - Renaming of Vector types

* Add/fix docs for directive, parser and others

* Fixed alias typo in module_parsing

* Fix decode/import bugs, fix minor details in docs

* Added missing docs for utils.docbuild and utils.testing

* Sort alphabetically entries in utilities_misc.rst

* Address review comments, add notes about Vector and hyperlinks inside definition blocks

---------

Co-authored-by: MrDiver <mrdiverlp@gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: JasonGrace2282 <aarush.deshpande@gmail.com>
2023-12-29 19:04:31 +01:00
Jason Grace
4a963c45ab
add note in docstring of ManimColor about class constructors (#3554) 2023-12-28 18:57:21 +01:00
Jason Grace
472eaae6fe
Fix use of Mobject's deprecated get_*() and set_*() methods in Cairo tests (#3549)
* Fix Deprecation warnings in cairo tests

* Fix animation/specialized.py
2023-12-26 22:36:26 +01:00
Jason Grace
9b18a861f3
Finish TODO's in `contributing/typings.rst` (#3545)
* Updated typing docs

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Added link for protocols

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Added object vs Any

* Fix Typo

* Rephrase TypeVar

Co-authored-by: Viicos <65306057+Viicos@users.noreply.github.com>

* Compare between tuple vs list

Co-authored-by: Viicos <65306057+Viicos@users.noreply.github.com>

* typing -> collections.abc

Co-authored-by: Viicos <65306057+Viicos@users.noreply.github.com>

* typing -> collections.abc

Co-authored-by: Viicos <65306057+Viicos@users.noreply.github.com>

* change method to attr

Co-authored-by: Viicos <65306057+Viicos@users.noreply.github.com>

* clarify object typehint

Co-authored-by: Viicos <65306057+Viicos@users.noreply.github.com>

* Fix code typo

Co-authored-by: Viicos <65306057+Viicos@users.noreply.github.com>

* Added if TYPE_CHECKING section

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Fix reST for inline code

* Elaborate on if TYPE_CHECKING

Co-authored-by: Viicos <65306057+Viicos@users.noreply.github.com>

* functions -> collections

Co-authored-by: Viicos <65306057+Viicos@users.noreply.github.com>

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Viicos <65306057+Viicos@users.noreply.github.com>
2023-12-24 12:33:45 -05:00
yuan
34e7d68644
Fix typo of get_y_axis_label docstring (#3547) 2023-12-23 15:58:07 +01:00
Jason Grace
3037f0e713
Remove wag method from Mobject (#3539)
Co-authored-by: Francisco Manríquez Novoa <49853152+chopan050@users.noreply.github.com>
2023-12-22 16:01:59 -05:00
Jason Grace
dd327a37ca
Fixed Animate Type-hint (#3543) 2023-12-21 01:37:24 +00:00
Jason Grace
8ea8f25576
Fix formatting of `MoveAlongPath` docs (#3541)
* Remove wag method from Mobject

* Fixed MoveAlongPath

* Revert remove wag

Created a new branch with the wrong base, sorry ;)
2023-12-21 00:33:56 +00:00
Jérome Eertmans
196fa1fa2f
chore(docs): add some words about Cairo 1.18 (#3530)
* chore(docs): add some words about Cairo 1.18

Closes #3521

* fix(docs): typo

* Update testing.rst

* Update testing.rst
2023-12-17 17:37:01 +01:00
Benjamin Hackl
cac608bf2a follow-up to #3491, made errors more consistent. fixes #3527 2023-12-17 17:32:38 +01:00
Tristan Schulz
b69e1d72cf
Adding the ability to pass lists and generators to .play() (#3365)
* adding the ability to pass lists and generators to .play()

* fix for _AnimationBuilder

* Changed handling of generators to accept lists of generators and normal arguments at the same time

* Animation group handles generators

* Refactored into own function for reusability

* Fix typing

* Fix typing

---------

Co-authored-by: Jason Grace <110117391+JasonGrace2282@users.noreply.github.com>
2023-12-13 11:24:05 +00:00
TheMathematicFanatic
fc4271061c
Add Documentation to .to_edge and to_corner (#3408)
* Added docstrings and example renders to Mobject.to_corner() and Mobject.to_edge

* Added docstrings and example renders to Mobject.to_corner() and Mobject.to_edge

* Update manim/mobject/mobject.py

* Update manim/mobject/mobject.py

* Update manim/mobject/mobject.py

* Update manim/mobject/mobject.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update manim/mobject/mobject.py

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: Tristan Schulz <mrdiverlp@gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2023-12-13 12:06:22 +01:00
Yash Mundada
98a7f42ed2
fixed the stroke width issue with single color in streamlines (#3436)
* fixed the stroke width issue with single color in streamlines

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Added test for streamlines

* Added test for streamlines

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: MrDiver <mrdiverlp@gmail.com>
2023-12-12 19:44:49 +00:00
Tristan Schulz
17043747ef
Fix animations with zero runtime length to give a useful error instead of a broken pipe (#3491)
* Fix animation group not erroring when instantiated with an empty list

* Move error messages into Animation.begin()

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Added tests

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update manim/animation/animation.py

* Update manim/animation/composition.py

* Update manim/animation/animation.py

Co-authored-by: Jason Grace <110117391+JasonGrace2282@users.noreply.github.com>

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Jason Grace <110117391+JasonGrace2282@users.noreply.github.com>
2023-12-12 20:19:16 +01:00
Paul Uhlenbruck
d39097825a
Fix rectangle grid properties (#3082) (#3513)
* Import  for both vertical and horizontal gridlines in

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: Tristan Schulz <mrdiverlp@gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2023-12-12 19:44:07 +01:00
Robin Dimasin
9938bf59a3
Added grid_lines attribute to Rectangle to add individual styling to the grid lines (#3428)
* Added 'grid_line_stroke_width' parameter in Rectangle

* Added 'grid_lines' (VGroup) attribute to 'Rectangle' class

---------

Co-authored-by: Tristan Schulz <mrdiverlp@gmail.com>
2023-12-12 18:09:51 +00:00
Jérome Eertmans
0a24cad22a
Account for dtype in the pixel array so the maximum value stays correct in the invert function (#3493)
* fix(lib): fix

This fixes an issue where the `invert` argument would only work for `uint8` dtypes. Now the `max` value is updated according to the pixel array dtype.

Maybe we should add unit tests for that, but haven't found an obvious place to put unit tests.

* chore(ci): add basic test

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* fix(ci): wrong attr name

* Update tests/module/mobject/test_image.py

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Benjamin Hackl <devel@benjamin-hackl.at>
2023-12-12 13:31:28 +01:00
dependabot[bot]
912ae76f8f
Bump jupyter-server from 2.9.1 to 2.11.2 (#3497)
Bumps [jupyter-server](https://github.com/jupyter-server/jupyter_server) from 2.9.1 to 2.11.2.
- [Release notes](https://github.com/jupyter-server/jupyter_server/releases)
- [Changelog](https://github.com/jupyter-server/jupyter_server/blob/main/CHANGELOG.md)
- [Commits](https://github.com/jupyter-server/jupyter_server/compare/v2.9.1...v2.11.2)

---
updated-dependencies:
- dependency-name: jupyter-server
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-12-12 12:53:52 +01:00
Tristan Schulz
18a7294164
Fix formatting building blocks (#3515)
* Fix formatting building blocks

* Fix formatting building blocks

---------

Co-authored-by: Jason Grace <110117391+JasonGrace2282@users.noreply.github.com>
2023-12-12 10:45:39 +01:00
Jason Grace
9a35756048
Explain `.Transform vs .ReplacementTransform` in quickstart examples (#3500)
* Explained ReplacementTransform vs Transform

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Added section explaining Transform vs ReplacementTransform

* Added a->b->c example

* Clarified explanation

* Fixed Typo

* Fixed missing colon

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Tristan Schulz <mrdiverlp@gmail.com>
2023-12-10 23:56:55 +00:00
Doaa Muhammad
64a0e9db43
Reformatting the --save_sections output to have the format <Scene>_<SecNum>_<SecName><extension> (#3499)
* Worked on issue 3471, fixing rendered file names to inherit section name

* Modified file name to include section number and name

* Modified tests for file names to include number and name, in order to pass

---------

Co-authored-by: Tristan Schulz <mrdiverlp@gmail.com>
2023-12-10 23:17:38 +00:00
Jérome Eertmans
018e4a3c1a
feat(cli): optionally hide version splash (#3329)
* feat(cli): optionally hide version splash

As discussed in #3326, this PR proposes a new optional flag to hide the version splash when manim command in launched. Additionally, the splash print is now inly executed when the CLI is executed, not on module import.

After looking at the current documentation, it does not seem to change anything. I only saw that you documented a version splash for when the CLI is used, but not when the module is imported. So removing it should not break the api docs.

In the future, users can still have version information with `import manim; print(manim.__version__)`.

Closes #3326

* chore(tests): make tests pass

---------

Co-authored-by: Tristan Schulz <mrdiverlp@gmail.com>
2023-12-10 22:47:11 +00:00
Benjamín Ubilla
03f9d4b90b
Added cap_style feature to VMobject (#3516)
* Added cap_style feature to VMobject

* Added an example to `set_cap_style` method

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Unsplitted line 2501

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Added graphical test for cap_style

* Added vmobject_cap_styles.npz for testing cap_styles

* Removed # noqa comments from vectorized_mobject.py

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2023-12-10 23:10:34 +01:00
Francisco Manríquez Novoa
3f118e4921
Removed deprecated new command (#3512)
Co-authored-by: Naveen M K <naveen521kk@gmail.com>
2023-12-10 19:05:32 +00:00
Tristan Schulz
370d883374
Implement caching of fonts list to improve runtime performance (#3316)
* Implement caching of fonts list to improve runtime performance

* Fix small use_svg_cache kwargs error

* replaced font list with LRU cache
2023-12-11 00:21:41 +05:30
yuan
0cba710a38
fix typo in docstring for DtUpdater example: line -> square (#3509) 2023-12-09 20:26:18 +00:00
szchixy
27d53606d4
fix line_join to joint_type in example_scenes/basic.py (#3510) 2023-12-09 20:57:32 +01:00
Melody Griesen
40766cb648
Update Docker base image to python3.12-slim (#3458) (#3459)
* Update Docker base image to python3.12-slim (#3458)

* Update docker/Dockerfile

---------

Co-authored-by: Melody Griesen <jvgriese@ncsu.edu>
Co-authored-by: Benjamin Hackl <devel@benjamin-hackl.at>
2023-12-07 00:30:17 +01:00
szchixy
7590086753
fix 360° to 180° in quickstart tutorial (#3498) 2023-12-06 18:06:35 +01:00
Viicos
61a2d05b69
Update dependency constraints, fix deprecation warnings (#3376)
* WIP: Update metadata

* Finish removing upper bounds

Drop requests dependency, use urllib instead
order depencencies

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Fix issues on 3.12

* Order dev dependencies

* Update most dev deps, update lint config

* Add missing import

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* trigger CI

* More deprecation fixes

* Missing argument

* Deprecation fixes, again

* Use older xdist to fix test flakyness

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2023-12-06 14:44:13 +01:00
Francisco Manríquez Novoa
6949c66922
Optimized get_unit_normal() and replaced np.cross() with custom cross() in manim.utils.space_ops (#3494)
* Added cross and optimized get_unit_normal in manim.utils.space_ops

* Added missing border case to new get_unit_normal where one vector is nonzero

* Updated test_threed.py::test_Sphere test data
2023-12-06 14:40:10 +01:00
JosephD
7cead84d21
Update indication.py (#3477)
reading docs, im sure oppising isnt a word
2023-11-30 13:10:39 +01:00
Lawrence Qupty
28bf4dd2a6
Fix Idicate docs typo (#3461) 2023-11-20 19:32:11 +01:00
Viicos
212bca09ca
Add type hints to _config (#3440)
* Add type hints to `_config`

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Fix call issues

* Fix wrong value being used

* Fix test

* Fix wrong value being set

* lint

* Few type fixes

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2023-11-20 19:31:18 +01:00
Jason Grace
94711f742d
Allow accessing ghost vectors in :class:.LinearTransformationScene (#3435)
* Fix CSV reader adding empty files

Fixes issue #3311

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Added LinearTransformationScene.ghost_vectors

* Added test and prevented empty VGroups as ghost vectors

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Fixed typo in example

* Added ability to join together multiple renders

* Revert "Added ability to join together multiple renders" (wrong branch)

This reverts commit dee29c390f.

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2023-11-19 09:20:59 +01:00
Benjamin Hackl
4315549c31
Fixed wrong path in action building downloadable docs (#3450)
* fixed wrong path in action building downloadable docs

* fix second occurrence of wrong path
2023-11-12 10:42:37 +01:00
553 changed files with 31689 additions and 16488 deletions

View file

@ -1 +0,0 @@
<path id="nd" d="m 464.7,68.6 -1.1,2.8 .8,1.4 -.3,5.1 -.5,1.1 2.7,9.1 1.3,2.5 .7,14 1,2.7 -.4,5.8 2.9,7.4 .3,5.8 -.1,2.1 -29.5,-.4 -46,-2.1 -39.2,-2.9 5.2,-66.7 44.5,3.4 55.3,1.6 z">

5
.codespell_ignorewords Normal file
View file

@ -0,0 +1,5 @@
nam
sherif
falsy
medias
strager

View file

@ -1,4 +1,4 @@
[codespell]
exclude-file=.codespell_ignorelines
check-hidden=True
ignore-words-list = nam,sherif,falsy
check-hidden = True
skip = .git,*.js,*.js.map,*.css,*.css.map,*.html,*.po,*.pot,uv.lock,*.log,*.svg
ignore-words = .codespell_ignorewords

View file

@ -1 +1,20 @@
.git
# Development / test artifacts
__pycache__
**/__pycache__
*.pyc
*.pyo
*.pyd
*.egg-info
dist/
build/
coverage.xml
# Not needed to install the package
docs/
tests/
example_scenes/
media/
logo/
scripts/

View file

@ -2,7 +2,7 @@
# Exclude the grpc generated code
exclude = ./manim/grpc/gen/*, __pycache__,.git,
per-file-ignores = __init__.py:F401
max-complexity = 15
max-complexity = 29
max-line-length = 88
statistics = True
# Prevents some flake8-rst-docstrings errors
@ -18,6 +18,9 @@ extend-ignore = E203, W503, D202, D212, D213, D404
# Misc
F401, F403, F405, F841, E501, E731, E402, F811, F821,
# multiple statements on one line (overload)
E704,
# Plug-in: flake8-builtins
A001, A002, A003,
@ -27,9 +30,6 @@ extend-ignore = E203, W503, D202, D212, D213, D404
# Plug-in: flake8-simplify
SIM105, SIM106, SIM119,
# Plug-in: flake8-comprehensions
C901
# Plug-in: flake8-pytest-style
PT001, PT004, PT006, PT011, PT018, PT022, PT023,

2
.git-blame-ignore-revs Normal file
View file

@ -0,0 +1,2 @@
# Switched to ruff format:
24025b60d57301b0a59754c38d77bccd8ed69feb

View file

@ -70,14 +70,5 @@ PASTE HERE
<!-- output of `tlmgr list --only-installed` for TeX Live or a screenshot of the Packages page for MikTeX -->
</details>
<details><summary>FFMPEG</summary>
Output of `ffmpeg -version`:
```
PASTE HERE
```
</details>
## Additional comments
<!-- Add further context that you think might be relevant for this issue here. -->

View file

@ -53,14 +53,5 @@ PASTE HERE
<!-- output of `tlmgr list --only-installed` for TeX Live or a screenshot of the Packages page for MikTeX -->
</details>
<details><summary>FFMPEG</summary>
Output of `ffmpeg -version`:
```
PASTE HERE
```
</details>
## Additional comments
<!-- Add further context that you think might be relevant for this issue here. -->

View file

@ -1,10 +1,6 @@
<!-- Thank you for contributing to Manim! Learn more about the process in our contributing guidelines: https://docs.manim.community/en/latest/contributing.html -->
## Overview: What does this pull request change?
<!-- If there is more information than the PR title that should be added to our release changelog, add it in the following changelog section. This is optional, but recommended for larger pull requests. -->
<!--changelog-start-->
<!--changelog-end-->
## Motivation and Explanation: Why and how do your changes improve the library?
<!-- Optional for bugfixes, small enhancements, and documentation-related PRs. Otherwise, please give a short reasoning for your changes. -->

6
.github/codeql.yml vendored
View file

@ -9,6 +9,12 @@ query-filters:
id: py/multiple-calls-to-init
- exclude:
id: py/missing-call-to-init
- exclude:
id: py/method-first-arg-is-not-self
- exclude:
id: py/cyclic-import
- exclude:
id: py/unsafe-cyclic-import
paths:
- manim
paths-ignore:

View file

@ -4,7 +4,10 @@
"standalone",
"preview",
"doublestroke",
"ms",
"count1to",
"multitoc",
"prelim2e",
"ragged2e",
"everysel",
"setspace",
"rsfs",
@ -29,7 +32,10 @@
"standalone",
"preview",
"doublestroke",
"ms",
"count1to",
"multitoc",
"prelim2e",
"ragged2e",
"everysel",
"setspace",
"rsfs",

67
.github/release.yml vendored Normal file
View file

@ -0,0 +1,67 @@
# https://docs.github.com/en/repositories/releasing-projects-on-github/automatically-generated-release-notes
changelog:
exclude:
labels:
- duplicate/wontfix
- invalid
- question
- release
authors:
- dependabot[bot]
- pre-commit-ci[bot]
categories:
# High Impact
- title: "Breaking Changes 🚨"
labels:
- breaking changes
# Highlights
- title: "Highlights 🌟"
labels:
- highlight
# User-facing
- title: "New Features ✨"
labels:
- new feature
- title: "Enhancements 🚀"
labels:
- enhancement
- title: "Bug Fixes 🐛"
labels:
- pr:bugfix
- title: "Deprecations & Removals ⚠️"
labels:
- pr:deprecation
# Developer-facing
- title: "Documentation 📚"
labels:
- documentation
- title: "Testing 🧪"
labels:
- testing
- title: "Infrastructure & Build 🔨"
labels:
- infrastructure
- title: "Code Quality & Refactoring 🧹"
labels:
- maintenance
- refactor
- title: "Type Hints 📝"
labels:
- typehints
# Catch-all (must be last)
- title: "Other Changes"
labels:
- "*"

View file

@ -14,8 +14,8 @@ import subprocess
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
@ -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
@ -144,10 +144,38 @@ def main():
]
)
env_vars = {
# add the venv bin directory to PATH so that meson can find ninja
"PATH": f"{os.path.join(tmpdir, VENV_NAME, 'bin')}{os.pathsep}{os.environ['PATH']}",
}
# Inherit the current environment so PKG_CONFIG_PATH, CFLAGS, LDFLAGS, etc. are preserved.
env_vars = os.environ.copy()
# Prepend the venv bin directory so meson/ninja from the venv are used.
env_vars["PATH"] = f"{os.path.join(tmpdir, VENV_NAME, 'bin')}{os.pathsep}{env_vars.get('PATH','')}"
# Ensure Homebrew-provided pkgconfig and include/lib paths are present on macOS ARM.
if sys.platform == "darwin":
try:
# Try to get specific prefix for lzo (safer for opt path), fall back to generic brew prefix.
brew_prefix = subprocess.check_output(["brew", "--prefix", "lzo"], text=True).strip()
except subprocess.CalledProcessError:
try:
brew_prefix = subprocess.check_output(["brew", "--prefix"], text=True).strip()
except Exception:
brew_prefix = None
if brew_prefix:
# pkg-config files can live in lib/pkgconfig or opt/<pkg>/lib/pkgconfig
pkgconfig_paths = [f"{brew_prefix}/lib/pkgconfig", f"{brew_prefix}/opt/lzo/lib/pkgconfig"]
# merge with any existing PKG_CONFIG_PATH
existing_pc = env_vars.get("PKG_CONFIG_PATH", "")
merged_pc = ":".join([p for p in pkgconfig_paths if p]) + (f":{existing_pc}" if existing_pc else "")
env_vars["PKG_CONFIG_PATH"] = merged_pc
# Ensure compiler & linker flags include brew include/lib
existing_cflags = env_vars.get("CFLAGS", "")
existing_ldflags = env_vars.get("LDFLAGS", "")
env_vars["CFLAGS"] = f"-I{brew_prefix}/include {existing_cflags}".strip()
env_vars["LDFLAGS"] = f"-L{brew_prefix}/lib {existing_ldflags}".strip()
# Debugging: log environment keys relevant to detection
# logger.info(f"env vars for meson: {env_vars}")
with gha_group("Building and Installing Cairo"):
logger.info("Running meson setup")

View file

@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Check out a copy of the repository
uses: actions/checkout@v4
uses: actions/checkout@v6
- name: Check whether the citation metadata from CITATION.cff is valid
uses: citation-file-format/cffconvert-github-action@2.0.0

View file

@ -18,31 +18,29 @@ jobs:
env:
DISPLAY: :0
PYTEST_ADDOPTS: "--color=yes" # colors in pytest
PYTHONIOENCODING: "utf8"
strategy:
fail-fast: false
matrix:
os: [ubuntu-22.04, macos-latest, windows-latest]
python: ["3.9", "3.10", "3.11", "3.12"]
python: ["3.11", "3.12", "3.13", "3.14"]
include:
- os: macos-15-intel
python: "3.13"
steps:
- name: Checkout the repository
uses: actions/checkout@v4
- name: Install Poetry
run: |
pipx install "poetry==1.5.*"
poetry config virtualenvs.prefer-active-python true
uses: actions/checkout@v6
- name: Setup Python ${{ matrix.python }}
uses: actions/setup-python@v4
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python }}
cache: "poetry"
- name: Setup macOS PATH
if: runner.os == 'macOS'
run: |
echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
enable-cache: true
- name: Setup cache variables
shell: bash
@ -50,25 +48,22 @@ jobs:
run: |
echo "date=$(/bin/date -u "+%m%w%Y")" >> $GITHUB_OUTPUT
- name: Install and cache ffmpeg (all OS)
uses: FedericoCarboni/setup-ffmpeg@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
id: setup-ffmpeg
- name: Install system dependencies (Linux)
if: runner.os == 'Linux'
uses: awalsh128/cache-apt-pkgs-action@latest
with:
packages: python3-opengl libpango1.0-dev xvfb
packages: python3-opengl libpango1.0-dev xvfb freeglut3-dev
version: 1.0
- 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'
@ -77,12 +72,12 @@ jobs:
sudo /usr/bin/Xvfb $DISPLAY -screen 0 1280x1024x24 &
- name: Setup Cairo Cache
uses: actions/cache@v3
uses: actions/cache@v5
id: cache-cairo
if: runner.os == 'Linux' || runner.os == 'macOS'
with:
path: ${{ github.workspace }}/third_party
key: ${{ runner.os }}-dependencies-cairo-${{ hashFiles('.github/scripts/ci_build_cairo.py') }}
key: ${{ runner.os }}-${{ runner.arch }}-dependencies-cairo-${{ hashFiles('.github/scripts/ci_build_cairo.py') }}
- name: Build and install Cairo (Linux and macOS)
if: (runner.os == 'Linux' || runner.os == 'macOS') && steps.cache-cairo.outputs.cache-hit != 'true'
@ -93,7 +88,7 @@ jobs:
run: python .github/scripts/ci_build_cairo.py --set-env-vars
- name: Setup macOS cache
uses: actions/cache@v3
uses: actions/cache@v5
id: cache-macos
if: runner.os == 'macOS'
with:
@ -109,8 +104,8 @@ jobs:
oriPath=$PATH
sudo mkdir -p $PWD/macos-cache
echo "Install TinyTeX"
sudo curl -L -o "/tmp/TinyTeX.tgz" "https://github.com/yihui/tinytex-releases/releases/download/daily/TinyTeX-1.tgz"
sudo tar zxf "/tmp/TinyTeX.tgz" -C "$PWD/macos-cache"
sudo curl -L -o "/tmp/TinyTeX.tar.xz" "https://github.com/rstudio/tinytex-releases/releases/download/daily/TinyTeX-1-darwin.tar.xz"
sudo tar xJf "/tmp/TinyTeX.tar.xz" -C "$PWD/macos-cache"
export PATH="$PWD/macos-cache/TinyTeX/bin/universal-darwin:$PATH"
sudo tlmgr update --self
for i in "${ttp[@]}"; do
@ -124,18 +119,17 @@ jobs:
shell: bash
run: |
echo "/Library/TeX/texbin" >> $GITHUB_PATH
echo "$HOME/.poetry/bin" >> $GITHUB_PATH
echo "$PWD/macos-cache/TinyTeX/bin/universal-darwin" >> $GITHUB_PATH
- name: Setup Windows cache
id: cache-windows
if: runner.os == 'Windows'
uses: actions/cache@v3
uses: actions/cache@v5
with:
path: ${{ github.workspace }}\ManimCache
key: ${{ runner.os }}-dependencies-tinytex-${{ hashFiles('.github/manimdependency.json') }}-${{ steps.cache-vars.outputs.date }}-1
- uses: ssciwr/setup-mesa-dist-win@v1
- uses: ssciwr/setup-mesa-dist-win@v3
- name: Install system dependencies (Windows)
if: runner.os == 'Windows' && steps.cache-windows.outputs.cache-hit != 'true'
@ -143,14 +137,11 @@ jobs:
$tinyTexPackages = $(python -c "import json;print(' '.join(json.load(open('.github/manimdependency.json'))['windows']['tinytex']))") -Split ' '
$OriPath = $env:PATH
echo "Install Tinytex"
Invoke-WebRequest "https://github.com/yihui/tinytex-releases/releases/download/daily/TinyTeX-1.zip" -O "$($env:TMP)\TinyTex.zip"
Expand-Archive -LiteralPath "$($env:TMP)\TinyTex.zip" -DestinationPath "$($PWD)\ManimCache\LatexWindows"
Invoke-WebRequest "https://github.com/rstudio/tinytex-releases/releases/download/daily/TinyTeX-1-windows.exe" -OutFile "$($env:TMP)\TinyTex.exe"
.$env:TMP\TinyTex.exe -o"$($PWD)\ManimCache\LatexWindows"
$env:Path = "$($PWD)\ManimCache\LatexWindows\TinyTeX\bin\windows;$($env:PATH)"
tlmgr update --self
foreach ($c in $tinyTexPackages){
$c=$c.Trim()
tlmgr install $c
}
tlmgr install $tinyTexPackages
$env:PATH=$OriPath
echo "Completed Latex"
@ -158,22 +149,20 @@ jobs:
if: runner.os == 'Windows'
run: |
$env:Path += ";" + "$($PWD)\ManimCache\LatexWindows\TinyTeX\bin\windows"
$env:Path = "$env:USERPROFILE\.poetry\bin;$($env:PATH)"
echo "$env:Path" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
- name: Install manim
- name: Install dependencies and manim
run: |
poetry config installer.modern-installation false
poetry install
uv sync --all-extras --locked
- name: Run tests
run: |
poetry run python -m pytest
uv run python -m pytest
- name: Run module doctests
run: |
poetry run python -m pytest -v --cov-append --ignore-glob="*opengl*" --doctest-modules manim
uv run python -m pytest -v --cov-append --ignore-glob="*opengl*" --doctest-modules manim
- name: Run doctests in rst files
run: |
cd docs && poetry run make doctest O=-tskip-manim
cd docs && uv run make doctest O=-tskip-manim

View file

@ -24,19 +24,19 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v6
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
uses: github/codeql-action/init@v4
with:
languages: ${{ matrix.language }}
config-file: ./.github/codeql.yml
queries: +security-and-quality
- name: Autobuild
uses: github/codeql-action/autobuild@v2
uses: github/codeql-action/autobuild@v4
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
uses: github/codeql-action/analyze@v4
with:
category: "/language:${{ matrix.language }}"

View file

@ -13,19 +13,19 @@ jobs:
if: github.event_name != 'release'
steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
uses: docker/setup-qemu-action@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
uses: docker/setup-buildx-action@v4
- name: Login to DockerHub
uses: docker/login-action@v3
uses: docker/login-action@v4
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v5
uses: docker/build-push-action@v7
with:
platforms: linux/arm64,linux/amd64
push: true
@ -38,13 +38,13 @@ jobs:
if: github.event_name == 'release'
steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
uses: docker/setup-qemu-action@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
uses: docker/setup-buildx-action@v4
- name: Login to DockerHub
uses: docker/login-action@v3
uses: docker/login-action@v4
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
@ -61,7 +61,7 @@ jobs:
print(f"tag_name={ref_tag}", file=f)
- name: Build and push
uses: docker/build-push-action@v5
uses: docker/build-push-action@v7
with:
platforms: linux/arm64,linux/amd64
push: true

View file

@ -6,65 +6,42 @@ on:
jobs:
release:
name: "Publish release"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
environment: release
permissions:
id-token: write
contents: write
- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: 3.11
steps:
- uses: actions/checkout@v6
- name: Install dependencies
run: python -m pip install --upgrade poetry
run: sudo apt-get update && sudo apt-get install -y build-essential python3-dev libcairo2-dev libpango1.0-dev
# TODO: Set PYPI_API_TOKEN to api token from pip in secrets
- name: Configure pypi credentials
env:
PYPI_API_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
run: poetry config http-basic.pypi __token__ "$PYPI_API_TOKEN"
- name: Set up Python 3.13
uses: actions/setup-python@v6
with:
python-version: 3.13
- name: Publish release to pypi
- name: Install uv
uses: astral-sh/setup-uv@v7
- name: Build and push release to PyPI
run: |
poetry publish --build
poetry build
uv build
uv publish
- name: Store artifacts
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v7
with:
path: dist/*.tar.gz
name: manim.tar.gz
- name: Install Dependency
run: pip install requests
- name: Get Upload URL
id: create_release
shell: python
env:
access_token: ${{ secrets.GITHUB_TOKEN }}
tag_act: ${{ github.ref }}
run: |
import requests
import os
ref_tag = os.getenv('tag_act').split('/')[-1]
access_token = os.getenv('access_token')
headers = {
"Accept":"application/vnd.github.v3+json",
"Authorization": f"token {access_token}"
}
url = f"https://api.github.com/repos/ManimCommunity/manim/releases/tags/{ref_tag}"
c = requests.get(url,headers=headers)
upload_url=c.json()['upload_url']
with open(os.getenv('GITHUB_OUTPUT'), 'w') as f:
print(f"upload_url={upload_url}", file=f)
print(f"tag_name={ref_tag[1:]}", file=f)
- name: Upload Release Asset
id: upload-release
uses: actions/upload-release-asset@v1
shell: bash
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: dist/manim-${{ steps.create_release.outputs.tag_name }}.tar.gz
asset_name: manim-${{ steps.create_release.outputs.tag_name }}.tar.gz
asset_content_type: application/gzip
run: |
TAG=${{ github.event.release.tag_name }}
gh release upload "$TAG" "dist/manim-${TAG#v}.tar.gz"

View file

@ -9,40 +9,43 @@ jobs:
build-and-publish-htmldocs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- name: Set up Python 3.11
uses: actions/setup-python@v4
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: 3.11
python-version: 3.13
- name: Install uv
uses: astral-sh/setup-uv@v7
- name: Install system dependencies
run: |
sudo apt update && sudo apt install -y \
pkg-config libcairo-dev libpango1.0-dev ffmpeg wget fonts-roboto
pkg-config libcairo-dev libpango1.0-dev wget fonts-roboto
wget -qO- "https://yihui.org/tinytex/install-bin-unix.sh" | sh
echo ${HOME}/.TinyTeX/bin/x86_64-linux >> $GITHUB_PATH
- name: Install LaTeX and Python dependencies
run: |
tlmgr update --self
tlmgr install \
babel-english ctex doublestroke dvisvgm frcursive fundus-calligra jknapltx \
mathastext microtype physics preview ragged2e relsize rsfs setspace standalone \
wasy wasysym
python -m pip install --upgrade poetry
poetry install
uv sync --extra typst
- name: Build and package documentation
run: |
cd docs/
poetry run make html
uv run make html
cd build/html/
tar -czvf ../html-docs.tar.gz *
- name: Store artifacts
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v7
with:
path: ${{ github.workspace }}/manim/docs/build/html-docs.tar.gz
path: ${{ github.workspace }}/docs/build/html-docs.tar.gz
name: html-docs.tar.gz
- name: Install Dependency
@ -79,6 +82,6 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ${{ github.workspace }}/manim/docs/build/html-docs.tar.gz
asset_path: ${{ github.workspace }}/docs/build/html-docs.tar.gz
asset_name: manim-htmldocs-${{ steps.create_release.outputs.tag_name }}.tar.gz
asset_content_type: application/gzip

View file

@ -1,9 +1,9 @@
default_stages: [commit, push]
default_stages: [pre-commit, pre-push]
fail_fast: false
exclude: ^(manim/grpc/gen/|docs/i18n/)
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v6.0.0
hooks:
- id: check-ast
name: Validate Python
@ -11,54 +11,27 @@ repos:
- id: mixed-line-ending
- id: end-of-file-fixer
- id: check-toml
name: Validate Poetry
- repo: https://github.com/pycqa/isort
rev: 5.12.0
name: Validate pyproject.toml
- repo: https://github.com/codespell-project/codespell
rev: v2.4.1
hooks:
- id: isort
name: isort (python)
- id: isort
name: isort (cython)
types: [cython]
- id: isort
name: isort (pyi)
types: [pyi]
- repo: https://github.com/asottile/pyupgrade
rev: v3.10.1
- id: codespell
files: ^.*\.(py|md|rst)$
args: ["-L", "medias,nam"]
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.14.10
hooks:
- id: pyupgrade
name: Update code to new python versions
args: [--py37-plus]
- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.10.0
hooks:
- id: python-check-blanket-noqa
name: Precision flake ignores
- repo: https://github.com/psf/black
rev: 23.7.0
hooks:
- id: black
- repo: https://github.com/asottile/blacken-docs
rev: 1.15.0
hooks:
- id: blacken-docs
additional_dependencies: [black==22.3.0]
- repo: https://github.com/PyCQA/flake8
rev: 6.1.0
hooks:
- id: flake8
additional_dependencies:
[
flake8-bugbear==21.4.3,
flake8-builtins==1.5.3,
flake8-comprehensions>=3.6.1,
flake8-docstrings==1.6.0,
flake8-pytest-style==1.5.0,
flake8-rst-docstrings==0.2.3,
flake8-simplify==0.14.1,
]
- id: ruff
name: ruff lint
types: [python]
args: [--exit-non-zero-on-fix]
- id: ruff-format
types: [python]
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.5.1
rev: v1.19.1
hooks:
- id: mypy
additional_dependencies:
@ -70,10 +43,3 @@ repos:
types-setuptools,
]
files: ^manim/
- repo: https://github.com/codespell-project/codespell
rev: v2.2.5
hooks:
- id: codespell
files: ^.*\.(py|md|rst)$
args: ["-L", "medias,nam"]

View file

@ -1,13 +1,16 @@
version: 2
sphinx:
configuration: docs/source/conf.py
build:
os: ubuntu-22.04
tools:
python: "3.11"
python: "3.13"
apt_packages:
- libpango1.0-dev
- ffmpeg
- graphviz
python:

View file

@ -4,10 +4,10 @@ authors:
-
name: "The Manim Community Developers"
cff-version: "1.2.0"
date-released: 2024-04-08
date-released: 2026-02-27
license: MIT
message: "We acknowledge the importance of good software to support research, and we note that research becomes more valuable when it is communicated effectively. To demonstrate the value of Manim, we ask that you cite Manim in your work."
title: Manim Mathematical Animation Framework
url: "https://www.manim.community/"
version: "v0.18.0.post0"
version: "v0.20.1"
...

View file

@ -152,6 +152,7 @@ Examples of conflicts of interest include:
* The reporter or reported person is a maintainer who regularly reviews your contributions
* The reporter or reported person is your metamour.
* The reporter or reported person is your family member
Committee members do not need to state why they have a conflict of interest, only that one exists. Other team members should not ask why the person has a conflict of interest.
Anyone who has a conflict of interest will remove themselves from the discussion of the incident, and recluse themselves from voting on a response to the report.

View file

@ -1,6 +1,6 @@
MIT License
Copyright (c) 2021, the Manim Community Developers
Copyright (c) 2024, the Manim Community Developers
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

View file

@ -1,17 +1,15 @@
<p align="center">
<a href="https://www.manim.community/"><img src="https://raw.githubusercontent.com/ManimCommunity/manim/main/logo/cropped.png"></a>
<a href="https://www.manim.community/"><img src="https://raw.githubusercontent.com/ManimCommunity/manim/main/logo/cropped.png" alt="Manim Community logo"></a>
<br />
<br />
<a href="https://pypi.org/project/manim/"><img src="https://img.shields.io/pypi/v/manim.svg?style=flat&logo=pypi" alt="PyPI Latest Release"></a>
<a href="https://hub.docker.com/r/manimcommunity/manim"><img src="https://img.shields.io/docker/v/manimcommunity/manim?color=%23099cec&label=docker%20image&logo=docker" alt="Docker image"> </a>
<a href="https://mybinder.org/v2/gh/ManimCommunity/jupyter_examples/HEAD?filepath=basic_example_scenes.ipynb"><img src="https://mybinder.org/badge_logo.svg"></a>
<a href="https://mybinder.org/v2/gh/ManimCommunity/jupyter_examples/HEAD?filepath=basic_example_scenes.ipynb"><img src="https://mybinder.org/badge_logo.svg" alt="Launch Binder"></a>
<a href="http://choosealicense.com/licenses/mit/"><img src="https://img.shields.io/badge/license-MIT-red.svg?style=flat" alt="MIT License"></a>
<a href="https://www.reddit.com/r/manim/"><img src="https://img.shields.io/reddit/subreddit-subscribers/manim.svg?color=orange&label=reddit&logo=reddit" alt="Reddit" href=></a>
<a href="https://twitter.com/manim_community/"><img src="https://img.shields.io/twitter/url/https/twitter.com/cloudposse.svg?style=social&label=Follow%20%40manim_community" alt="Twitter">
<a href="https://www.manim.community/discord/"><img src="https://img.shields.io/discord/581738731934056449.svg?label=discord&color=yellow&logo=discord" alt="Discord"></a>
<a href="https://github.com/psf/black"><img src="https://img.shields.io/badge/code%20style-black-000000.svg" alt="Code style: black">
<a href="https://twitter.com/manimcommunity/"><img src="https://img.shields.io/twitter/url/https/twitter.com/cloudposse.svg?style=social&label=Follow%20%40manimcommunity" alt="Twitter">
<a href="https://manim.community/discord/"><img src="https://img.shields.io/discord/581738731934056449.svg?label=discord&color=yellow&logo=discord" alt="Discord"></a>
<a href="https://docs.manim.community/"><img src="https://readthedocs.org/projects/manimce/badge/?version=latest" alt="Documentation Status"></a>
<a href="https://pepy.tech/project/manim"><img src="https://pepy.tech/badge/manim/month?" alt="Downloads"> </a>
<img src="https://github.com/ManimCommunity/manim/workflows/CI/badge.svg" alt="CI">
<br />
<br />
@ -21,21 +19,23 @@
Manim is an animation engine for explanatory math videos. It's used to create precise animations programmatically, as demonstrated in the videos of [3Blue1Brown](https://www.3blue1brown.com/).
> NOTE: This repository is maintained by the Manim Community and is not associated with Grant Sanderson or 3Blue1Brown in any way (although we are definitely indebted to him for providing his work to the world). If you would like to study how Grant makes his videos, head over to his repository ([3b1b/manim](https://github.com/3b1b/manim)). This fork is updated more frequently than his, and it's recommended to use this fork if you'd like to use Manim for your own projects.
> [!NOTE]
> The community edition of Manim (ManimCE) is a version maintained and developed by the community. It was forked from 3b1b/manim, a tool originally created and open-sourced by Grant Sanderson, also creator of the 3Blue1Brown educational math videos. While Grant Sanderson continues to maintain his own repository, we recommend this version for its continued development, improved features, enhanced documentation, and more active community-driven maintenance. If you would like to study how Grant makes his videos, head over to his repository ([3b1b/manim](https://github.com/3b1b/manim)).
## Table of Contents:
- [Installation](#installation)
- [Usage](#usage)
- [Documentation](#documentation)
- [Docker](#docker)
- [Help with Manim](#help-with-manim)
- [Contributing](#contributing)
- [License](#license)
- [Installation](#installation)
- [Usage](#usage)
- [Documentation](#documentation)
- [Docker](#docker)
- [Help with Manim](#help-with-manim)
- [Contributing](#contributing)
- [License](#license)
## Installation
> **WARNING:** These instructions are for the community version _only_. Trying to use these instructions to install [3b1b/manim](https://github.com/3b1b/manim) or instructions there to install this version will cause problems. Read [this](https://docs.manim.community/en/stable/faq/installation.html#why-are-there-different-versions-of-manim) and decide which version you wish to install, then only follow the instructions for your desired version.
> [!CAUTION]
> These instructions are for the community version _only_. Trying to use these instructions to install [3b1b/manim](https://github.com/3b1b/manim) or instructions there to install this version will cause problems. Read [this](https://docs.manim.community/en/stable/faq/installation.html#why-are-there-different-versions-of-manim) and decide which version you wish to install, then only follow the instructions for your desired version.
Manim requires a few dependencies that must be installed prior to using it. If you
want to try it out first before installing it locally, you can do so
@ -88,9 +88,9 @@ The `-p` flag in the command above is for previewing, meaning the video file wil
Some other useful flags include:
- `-s` to skip to the end and just show the final frame.
- `-n <number>` to skip ahead to the `n`'th animation of a scene.
- `-f` show the file in the file browser.
- `-s` to skip to the end and just show the final frame.
- `-n <number>` to skip ahead to the `n`'th animation of a scene.
- `-f` show the file in the file browser.
For a thorough list of command line arguments, visit the [documentation](https://docs.manim.community/en/stable/guides/configuration.html).
@ -118,8 +118,8 @@ The contribution guide may become outdated quickly; we highly recommend joining
[Discord server](https://www.manim.community/discord/) to discuss any potential
contributions and keep up to date with the latest developments.
Most developers on the project use `poetry` for management. You'll want to have poetry installed and available in your environment.
Learn more about `poetry` at its [documentation](https://python-poetry.org/docs/) and find out how to install manim with poetry at the [manim dev-installation guide](https://docs.manim.community/en/stable/contributing/development.html) in the manim documentation.
Most developers on the project use `uv` for management. You'll want to have uv installed and available in your environment.
Learn more about `uv` at its [documentation](https://docs.astral.sh/uv/) and find out how to install manim with uv at the [manim dev-installation guide](https://docs.manim.community/en/latest/contributing/development.html) in the manim documentation.
## How to Cite Manim

382
agents/typst_selector.md Normal file
View file

@ -0,0 +1,382 @@
# Design: Sub-Expression Selection for `Typst` / `TypstMath`
## Problem Statement
Users need to interact with individual parts of a Typst-rendered expression:
color a variable, animate the numerator of a fraction, morph one sub-expression
into another, etc. The `MathTex` class solves this with:
1. **`{{ ... }}` double-brace notation** — splits the TeX string into named
submobject groups at compile time.
2. **`substrings_to_isolate` / `get_part_by_tex`** — identifies submobjects
whose TeX source matches a given string.
Both mechanisms ultimately rely on injecting `\special{dvisvgm:raw <g id='...'>}`
markers into the LaTeX source so that the resulting SVG contains `<g>` elements
with known `id` attributes, which SVGMobject's parser maps to `VGroup`
sub-trees via `id_to_vgroup_dict`.
We need an analogous mechanism for Typst.
## Key Discovery: `data-typst-label` in SVG Output
Typst's SVG renderer (`typst-svg` crate) already emits a `data-typst-label`
attribute on `<g>` elements whenever a `GroupItem` (hard frame) carries a
label. The relevant code path:
```rust
// typst-svg/src/lib.rs — render_group()
if let Some(label) = group.label {
svg.init().attr("data-typst-label", label.resolve());
}
```
A **hard frame** is created by the `box` element (and `block`, etc.). Crucially,
`box` can be used inline inside math mode, and labels can be attached to it.
### Proof of Concept
The following Typst helper wraps content in a labeled `box`:
```typst
#let grp(lbl, body) = [#box(body) #label(lbl)]
```
When used in math:
```typst
$ #grp("numerator", $a + b$) / #grp("denom", $c - d$) = #grp("result", $x$) $
```
The compiled SVG contains:
```xml
<g class="typst-group" ... data-typst-label="numerator">
<!-- glyphs for a + b -->
</g>
<g class="typst-group" ... data-typst-label="denom">
<!-- glyphs for c - d -->
</g>
<g class="typst-group" ... data-typst-label="result">
<!-- glyph for x -->
</g>
```
**Nesting works.** A `grp` wrapping a fraction that itself contains `grp`-ed
sub-parts produces nested `data-typst-label` groups:
```typst
$ #grp("whole-frac", $frac(#grp("numerator", $a + b$), #grp("denom", $c - d$))$) $
```
SVG output:
```xml
<g ... data-typst-label="whole-frac">
<g ... data-typst-label="numerator"> ... </g>
<g ... data-typst-label="denom"> ... </g>
<path class="typst-shape" ... /> <!-- fraction bar -->
</g>
```
### SVG Parser Compatibility
Manim uses `svgelements` to parse SVGs. The library preserves
`data-typst-label` in the `values` dictionary of `Group` objects, and it
propagates to child elements. Manim's `SVGMobject.get_mobjects_from()` already
iterates over groups and builds `id_to_vgroup_dict` keyed by the `id` attribute.
Extending this to also key by `data-typst-label` is straightforward.
## Proposed Interface
### 1. Explicit Groups via `{{ ... }}` Notation (Compile-Time)
Mirror the `MathTex` double-brace convention. Users write:
```python
eq = TypstMath("{{ a + b }} / {{ c - d }} = {{ x }}")
```
The pre-processor splits on `{{ ... }}` (reusing the same whitespace-guard
rules as `MathTex._split_double_braces`) and wraps each group in a labeled
`box` call:
```typst
$ #box[$a + b$] <_grp-0> / #box[$c - d$] <_grp-1> = #box[$x$] <_grp-2> $
```
Each group gets an auto-generated label (`_grp-0`, `_grp-1`, ...).
The `data-typst-label` attributes then appear in the SVG, and
`SVGMobject.get_mobjects_from()` can map them to `VGroup` entries in
`label_to_vgroup_dict` (or reuse `id_to_vgroup_dict`).
These groups become sub-mobjects of the `TypstMath` instance, accessible by
index:
```python
eq[0] # VGroup for "a + b"
eq[1] # VGroup for "c - d"
eq[2] # VGroup for "x"
```
(Non-group content between groups — like `/` and `=` — also becomes
its own submobject, mirroring `MathTex` behavior.)
**For `Typst` (text mode):** the same `{{ ... }}` notation applies, but the
wrapper is `#box[...]` without math delimiters.
### 2. Named Groups via Labels
Users can also assign explicit label names for retrieval by name:
```python
eq = Typst(
r"$ #box[$a + b$] <numerator> / #box[$c - d$] <denom> $"
)
eq.select("numerator").set_color(RED)
eq.select("denom").set_color(BLUE)
```
Alternatively, an even more ergonomic approach that hides the `box` boilerplate
and uses the `{{ ... : label }}` notation:
```python
eq = TypstMath("{{ a + b : numerator }} / {{ c - d : denom }}")
eq.select("numerator").set_color(RED)
```
Here the pre-processor recognizes `{{ content : label }}` and emits
`#box[$content$] <label>` in the Typst source.
### 3. The `.select()` Method
```python
def select(self, key: str | int) -> VGroup:
"""Select a labeled sub-expression.
Parameters
----------
key
Either a label name (string) matching a ``data-typst-label``
in the SVG, or an integer index into the auto-numbered
``{{ ... }}`` groups.
Returns
-------
VGroup
The sub-mobjects corresponding to the selected group.
Raises
------
KeyError
If no group with the given label/index exists.
"""
```
This returns a `VGroup` containing exactly the submobjects (paths) that
were rendered inside the corresponding `<g data-typst-label="...">` in the SVG.
## Implementation Plan
### Step 1: Extend `SVGMobject.get_mobjects_from()` to Track Labels
In `manim/mobject/svg/svg_mobject.py`, the group-walking loop already checks
for `id` attributes. Add a parallel check for `data-typst-label`:
```python
try:
group_name = str(element.values["id"])
except Exception:
# Fall back to data-typst-label if available
label = element.values.get("data-typst-label")
if label:
group_name = f"typst-label:{label}"
else:
group_name = f"numbered_group_{group_id_number}"
group_id_number += 1
```
This automatically populates `id_to_vgroup_dict` with label-keyed entries.
### Step 2: Pre-Processing `{{ ... }}` in Typst Source
Add a `_split_and_label_groups()` method that:
1. Scans the input for `{{ ... }}` or `{{ ... : label }}` patterns
(using the same whitespace-guard rules as `MathTex._split_double_braces`).
2. Replaces each group with `#box[$content$] <label>` (math mode) or
`#box[content] <label>` (text mode).
3. Records the mapping from label → original source string for later lookup.
### Step 3: `Typst.select()` / Index Access
- Store the ordered list of group labels and their source strings.
- `select(label_or_index)` looks up the corresponding `VGroup` from
`id_to_vgroup_dict` (using the `typst-label:...` key).
- `__getitem__(int)` returns the *n*-th group's `VGroup`.
### Step 4: Compatibility with `TransformMatchingTex` (future)
`TransformMatchingTex` (and its successor `TransformMatchingShapes`) works by
matching submobjects between two `MathTex` instances by their TeX string keys.
The same approach extends to `Typst` if each `{{ ... }}` group carries its
original source string as metadata. A `TransformMatchingTypst` animation could
match groups by label name or by source string equality.
## Open Design Questions
### Q1: Context-Aware Wrapping — Math vs. Text Mode
The `box` + `label` mechanism works identically in math and text mode, but the
**wrapping** of group content must match the surrounding context:
- **In text mode:** `{{ Hello : greeting }}``#box[Hello] <greeting>`
- **In math mode:** `{{ y^2 : second }}``#box[$y^2$] <second>`
Getting this wrong is not a silent error — it produces visually broken output.
Wrapping math content with `#box[y^2]` (no `$...$`) renders `y^2` as literal
text in the body font instead of as a math superscript.
This is a real problem for `Typst()`, where a single source string can mix text
and math freely:
```python
Typst("hello world, here is a formula: $x^2 + {{ y^2 : second }} = z^2$")
```
Here `{{ y^2 : second }}` is inside a `$ ... $` block, so it needs the
math-mode wrapper, but the pre-processor has no way to know this unless it
tracks `$` delimiters.
### The `#` prefix problem and math calls
A natural idea is to translate `{{ content }}` into a Typst function call like
`grp("lbl", content)`. However, this has a subtle but critical context
sensitivity: Typst has two different call conventions depending on context:
- **Math call** (no `#` prefix): `$ grp("lbl", a^2 + b) $` — arguments are
parsed **in math mode**. The content `a^2 + b` is math. ✓
- **Code call** (`#` prefix): `$ #grp("lbl", a^2 + b) $` — arguments are
parsed **in code mode**. `a^2` is a syntax error in code! ✗
So in math mode, the function MUST be called without `#` for args to stay in
math mode. In text/markup mode, the function MUST be called WITH `#` (that's
how you invoke code from markup), and content arguments need `[...]` wrapping:
```typst
// Text context: #grp("lbl", [Hello world])
// Math context: grp("lbl", a^2 + b)
```
The function definition is the same either way:
```typst
#let grp(lbl, body) = [#box(body) #label(lbl)]
```
This means the function call approach has **exactly the same context problem**
as the raw `#box` approach: the pre-processor must know whether it's in math or
text to emit the right calling convention.
### Further complication: string literals and content blocks
Even inside `TypstMath` (where everything is math), the scanner must avoid
`{{ }}` matches inside string literals or content blocks:
```python
TypstMath('x^2 + y^2 =_("Hello {{ world }}") z^2')
```
Here `{{ world }}` is inside a `"..."` string literal — it should NOT be
processed. Similarly, content blocks `[...]` inside math switch back to text
mode.
### Options
**A. `TypstMath`: math calls with simple string-aware scanning.**
For `TypstMath`, the entire body is math, so `{{ content }}` always becomes
`grp("_grp-N", content)` (no `#`, no `$...$`). The scanner just needs to
skip `"..."` string literals and `[...]` content blocks — no `$` tracking
needed. This is clean and robust.
**B. `Typst`: context-aware scanning (full parser).**
For the general `Typst` class, the scanner must additionally track `$...$`
math blocks (toggling a mode flag on unescaped `$`) to choose between
`grp(...)` (in math) and `#grp("lbl", [...])` (in text). It must also handle
string literals and content blocks inside math that switch context back. This
is doable but non-trivial — essentially a mini Typst lexer.
**C. `Typst`: no `{{ }}`, manual groups only.**
For the general `Typst` class, don't support `{{ }}` at all. Users write
`grp(...)` / `#grp(...)` themselves (with the helper injected into the
preamble). `{{ }}` is only available on `TypstMath`. This is simpler and
avoids the parsing complexity, at the cost of ergonomics for mixed-mode
documents.
**Recommendation:** Start with A (TypstMath only) and C (manual for Typst).
Upgrade to B later if demand warrants it — the function call infrastructure
is already in place, it's only the scanner that needs upgrading.
### Q2: What about "unlabeled" content between groups?
Like `MathTex`, the pieces of content *between* `{{ ... }}` groups should also
become their own submobjects (auto-labeled with sequential indices). For
example:
```python
TypstMath("{{ a }} + {{ b }} = {{ c }}")
# group-0: "a"
# group-1: "+" (auto-group for inter-group content)
# group-2: "b"
# group-3: "=" (auto-group for inter-group content)
# group-4: "c"
```
Each segment (group or inter-group) gets wrapped in its own labeled `box`.
### Q3: What happens with `box` and baseline alignment?
`box` is an inline element in Typst, and when used inside math mode it
participates in math layout. Testing confirms that fractions, superscripts, and
other constructs render correctly when their children are `box`-wrapped.
However, `box` creates a "hard frame" boundary which may subtly affect spacing
in edge cases (e.g., math operator spacing around a boxed expression). This
needs further testing; if issues arise, we could explore `block(breakable: false)`
or invisible `rect` wrappers as alternatives.
### Q4: Can we avoid the `#grp(...)` / `#box[...] <label>` verbosity?
Yes — the `{{ ... }}` double-brace notation is purely syntactic sugar that gets
pre-processed by Manim before the source reaches the Typst compiler. Users never
need to write raw `#box` or `#label()` calls unless they want finer control.
### Q5: String-based selection without explicit groups?
A future enhancement could support:
```python
eq = TypstMath(r"a + b = c")
eq.select("a") # finds submobjects corresponding to the glyph "a"
```
This is hard to do reliably because:
- Typst SVGs embed glyphs as `<use xlink:href="#gXXX">` references; there's no
text content in the SVG itself.
- A single variable in Typst may span multiple glyphs (e.g., `"alpha"` → one
glyph) or identical glyphs may appear multiple times.
A possible approach: at pre-processing time, wrap every "token" in the Typst
math source in its own labeled `box`. This would require a Typst math tokenizer
and is better suited for a v2 implementation.
## Summary: What Typst Gives Us
| Mechanism | How it works | SVG output |
|---|---|---|
| `#box(body) <label>` | Creates a hard-frame `GroupItem` with a `Label` | `<g data-typst-label="label">...</g>` |
| `#metadata(val) <label>` | Invisible; queryable via `typst query` CLI | No visual output (useful for CLI queries, not SVG) |
| Show rules on labels | `#show <label>: ...` | Transforms visual output but no automatic SVG grouping |
| `context query(<label>)` | Document introspection (positions, counters) | In-document only; not available from Python |
The `box` + `label` mechanism is the **only** one that produces identifiable
groups in the SVG output, making it the correct tool for sub-expression
selection in Manim.

View file

@ -1,49 +0,0 @@
# This file is automatically picked by pytest
# while running tests. So, that each test is
# run on difference temporary directories and avoiding
# errors.
from __future__ import annotations
try:
# https://github.com/moderngl/moderngl/issues/517
import readline # required to prevent a segfault on Python 3.10
except ModuleNotFoundError: # windows
pass
import cairo
import moderngl
# If it is running Doctest the current directory
# is changed because it also tests the config module
# itself. If it's a normal test then it uses the
# tempconfig to change directories.
import pytest
from _pytest.doctest import DoctestItem
from manim import config, tempconfig
@pytest.fixture(autouse=True)
def temp_media_dir(tmpdir, monkeypatch, request):
if isinstance(request.node, DoctestItem):
monkeypatch.chdir(tmpdir)
yield tmpdir
else:
with tempconfig({"media_dir": str(tmpdir)}):
assert config.media_dir == str(tmpdir)
yield tmpdir
def pytest_report_header(config):
ctx = moderngl.create_standalone_context()
info = ctx.info
ctx.release()
return (
f"\nCairo Version: {cairo.cairo_version()}",
"\nOpenGL information",
"------------------",
f"vendor: {info['GL_VENDOR'].strip()}",
f"renderer: {info['GL_RENDERER'].strip()}",
f"version: {info['GL_VERSION'].strip()}\n",
)

View file

@ -1,56 +1,88 @@
FROM python:3.8-slim
# ── Stage 1: builder ─────────────────────────────────────────────────────────
FROM python:3.14-slim AS builder
RUN apt-get update -qq \
&& apt-get install --no-install-recommends -y \
ffmpeg \
build-essential \
gcc \
cmake \
make \
pkg-config \
wget \
libcairo2-dev \
libffi-dev \
libpango1.0-dev \
freeglut3-dev \
pkg-config \
make \
wget \
ghostscript
libegl-dev \
&& rm -rf /var/lib/apt/lists/*
# setup a minimal texlive installation
# Setup a minimal TeX Live installation (no ctex: drops ~100 MB of CJK fonts/packages)
COPY docker/texlive-profile.txt /tmp/
ENV PATH=/usr/local/texlive/bin/armhf-linux:/usr/local/texlive/bin/aarch64-linux:/usr/local/texlive/bin/x86_64-linux:$PATH
RUN wget -O /tmp/install-tl-unx.tar.gz http://mirror.ctan.org/systems/texlive/tlnet/install-tl-unx.tar.gz && \
mkdir /tmp/install-tl && \
tar -xzf /tmp/install-tl-unx.tar.gz -C /tmp/install-tl --strip-components=1 && \
/tmp/install-tl/install-tl --profile=/tmp/texlive-profile.txt \
RUN wget -O /tmp/install-tl-unx.tar.gz http://mirror.ctan.org/systems/texlive/tlnet/install-tl-unx.tar.gz \
&& mkdir /tmp/install-tl \
&& tar -xzf /tmp/install-tl-unx.tar.gz -C /tmp/install-tl --strip-components=1 \
&& /tmp/install-tl/install-tl --profile=/tmp/texlive-profile.txt \
&& tlmgr install \
amsmath babel-english cbfonts-fd cm-super ctex doublestroke dvisvgm everysel \
amsmath babel-english cbfonts-fd cm-super count1to doublestroke dvisvgm everysel \
fontspec frcursive fundus-calligra gnu-freefont jknapltx latex-bin \
mathastext microtype ms physics preview ragged2e relsize rsfs \
setspace standalone tipa wasy wasysym xcolor xetex xkeyval
mathastext microtype multitoc physics prelim2e preview ragged2e relsize rsfs \
setspace standalone tipa wasy wasysym xcolor xetex xkeyval \
&& rm -rf /tmp/install-tl /tmp/install-tl-unx.tar.gz
# Install manim into an isolated virtualenv
ENV VIRTUAL_ENV=/opt/venv
RUN python -m venv $VIRTUAL_ENV
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
# clone and build manim
COPY . /opt/manim
WORKDIR /opt/manim
RUN pip install --no-cache .[jupyterlab]
RUN pip install --no-cache-dir .[jupyterlab]
RUN pip install -r docs/requirements.txt
# ── Stage 2: runtime ─────────────────────────────────────────────────────────
FROM python:3.14-slim
# Runtime libs only:
# - no ffmpeg: PyAV (av package) bundles its own ffmpeg libraries in av.libs/
# - OpenGL: keep EGL for headless rendering and libGL as required by moderngl/glcontext
# - fonts-noto-core instead of fonts-noto (drops CJK noto fonts)
RUN apt-get update -qq \
&& apt-get install --no-install-recommends -y \
libcairo2 \
libpango-1.0-0 \
libpangocairo-1.0-0 \
libpangoft2-1.0-0 \
libffi8 \
libegl1 \
libgl1 \
ghostscript \
fonts-noto-core \
fontconfig \
&& rm -rf /var/lib/apt/lists/*
RUN fc-cache -fv
# Copy TeX Live from builder
ENV PATH=/usr/local/texlive/bin/armhf-linux:/usr/local/texlive/bin/aarch64-linux:/usr/local/texlive/bin/x86_64-linux:$PATH
COPY --from=builder /usr/local/texlive /usr/local/texlive
# Copy the pre-built virtualenv from builder
ENV VIRTUAL_ENV=/opt/venv
COPY --from=builder /opt/venv /opt/venv
ENV PATH="$VIRTUAL_ENV/bin:$PATH"
ARG NB_USER=manimuser
ARG NB_UID=1000
ENV USER ${NB_USER}
ENV NB_UID ${NB_UID}
ENV HOME /manim
ENV USER=${NB_USER}
ENV NB_UID=${NB_UID}
ENV HOME=/manim
RUN adduser --disabled-password \
--gecos "Default user" \
--uid ${NB_UID} \
${NB_USER}
# create working directory for user to mount local directory into
WORKDIR ${HOME}
USER root
RUN chown -R ${NB_USER}:${NB_USER} ${HOME}
RUN chmod 777 ${HOME}
RUN chown -R ${NB_USER}:${NB_USER} ${HOME} && chmod 777 ${HOME}
USER ${NB_USER}
CMD [ "/bin/bash" ]
CMD ["/bin/bash"]

View file

@ -13,3 +13,11 @@ Multi-platform builds are possible by running
docker buildx build --push --platform linux/arm64/v8,linux/amd64 --tag manimcommunity/manim:TAG -f docker/Dockerfile .
```
from the root directory of the repository.
# Runtime notes
- The image is built via a multi-stage Dockerfile (build dependencies are not
carried into the runtime stage).
- The image does not include the `ffmpeg` CLI binary.
- The default TeX installation is minimal and does not include `ctex`.
- Headless OpenGL rendering relies on EGL/GL runtime libraries available in the
image.

View file

@ -202,7 +202,7 @@ msgid "This ``Scene`` illustrates the quirks of ``.animate``. When using ``.anim
msgstr ""
#: ../../source/tutorials/quickstart.rst:344
msgid "In ``DifferentRotations``, the difference between ``.animate``'s interpretation of rotation and the ``Rotate`` method is far more apparent. The starting and ending states of a ``Mobject`` rotated 360 degrees are the same, so ``.animate`` tries to interpolate two identical objects and the result is the left square. If you find that your own usage of ``.animate`` is causing similar unwanted behavior, consider using conventional animation methods like the right square, which uses ``Rotate``."
msgid "In ``DifferentRotations``, the difference between ``.animate``'s interpretation of rotation and the ``Rotate`` method is far more apparent. The starting and ending states of a ``Mobject`` rotated 180 degrees are the same, so ``.animate`` tries to interpolate two identical objects and the result is the left square. If you find that your own usage of ``.animate`` is causing similar unwanted behavior, consider using conventional animation methods like the right square, which uses ``Rotate``."
msgstr ""
#: ../../source/tutorials/quickstart.rst:353

View file

@ -1,5 +1,8 @@
furo
myst-parser
sphinx<5.1
sphinx>=7.3
sphinx-copybutton
sphinxext-opengraph
sphinx-design
sphinx-reredirects
typst>=0.14

View file

@ -1,2 +1,3 @@
jupyterlab
sphinxcontrib-programoutput
typst>=0.14

View file

@ -4,16 +4,9 @@
.. automodule:: {{ fullname }}
{% block attributes %}
{% if attributes %}
.. rubric:: Module Attributes
.. autosummary::
{% for item in attributes %}
{{ item }}
{%- endfor %}
{% endif %}
{% endblock %}
{# SEE manim.utils.docbuild.autoaliasattr_directive #}
{# FOR INFORMATION ABOUT THE CUSTOM autoaliasattr DIRECTIVE! #}
.. autoaliasattr:: {{ fullname }}
{% block classes %}
{% if classes %}

View file

@ -2,9 +2,18 @@
Changelog
#########
This page contains a list of changes made between releases.
.. toctree::
:maxdepth: 1
changelog/0.20.1-changelog
changelog/0.20.0-changelog
changelog/0.19.2-changelog
changelog/0.19.1-changelog
changelog/0.19.0-changelog
changelog/0.18.1-changelog
changelog/0.18.0.post0-changelog
changelog/0.18.0-changelog
changelog/0.17.3-changelog
changelog/0.17.2-changelog

View file

@ -0,0 +1,9 @@
*************
v0.18.0.post0
*************
:Date: April 08, 2024
This release is a post-release fixing `#3676
<https://github.com/ManimCommunity/manim/issues/3676>`_, a bug caused by a recent
change introduced to the way how SVG files of text are generated by Pango.

View file

@ -0,0 +1,160 @@
---
short-title: v0.18.1
description: Changelog for Manim v0.18.1
---
# v0.18.1
Date
: April 28, 2024
## What's Changed
### Breaking Changes and Deprecations
* Removed deprecated `manim new` command by {user}`chopan050` in {pr}`3512`
* Removed support for dynamic plugin imports by {user}`Viicos` in {pr}`3524`
* Remove meth:``.Mobject.wag`` by {user}`JasonGrace2282` in {pr}`3539`
* Remove deprecated parameters and animations by {user}`JasonGrace2282` in {pr}`3688`
### New Features
* Added `cap_style` feature to `VMobject` by {user}`MathItYT` in {pr}`3516`
* Allow hiding version splash by {user}`jeertmans` in {pr}`3329`
* Added the ability to pass lists and generators to `Scene.play()` by {user}`MrDiver` in {pr}`3365`
* Added ``--preview_command`` cli flag by {user}`JasonGrace2282` in {pr}`3615`
### Fixed Bugs and Enhancements
* Allow accessing ghost vectors in :class:`.LinearTransformationScene` by {user}`JasonGrace2282` in {pr}`3435`
* Optimized `get_unit_normal()` and replaced `np.cross()` with custom `cross()` in `manim.utils.space_ops` by {user}`chopan050` in {pr}`3494`
* Implement caching of fonts list to improve runtime performance by {user}`MrDiver` in {pr}`3316`
* Reformatting the `--save_sections` output to have the format `<Scene>_<SecNum>_<SecName><extension>` by {user}`doaamuham` in {pr}`3499`
* Account for dtype in the pixel array so the maximum value stays correct in the invert function by {user}`jeertmans` in {pr}`3493`
* Added `grid_lines` attribute to `Rectangle` to add individual styling to the grid lines by {user}`RobinPH` in {pr}`3428`
* Fixed rectangle grid properties (#3082) by {user}`pauluhlenbruck` in {pr}`3513`
* Fixed animations with zero runtime length to give a useful error instead of a broken pipe by {user}`MrDiver` in {pr}`3491`
* Fixed stroke width being ignored by `StreamLines` with a single color by {user}`yashm277` in {pr}`3436`
* Fixed formatting of ``MoveAlongPath`` docs by {user}`JasonGrace2282` in {pr}`3541`
* Added helpful hints to `VGroup.add()` error message by {user}`vvolhejn` in {pr}`3561`
* Made `earclip_triangulation` more robust by {user}`hydromelvictor` in {pr}`3574`
* Refactored `TexTemplate` by {user}`Viicos` in {pr}`3520`
* Fixed `write_subcaption_file` error when using OpenGL renderer by {user}`yuan-xy` in {pr}`3546`
* Fixed `get_arc_center()` returning reference of point by {user}`sparshg` in {pr}`3599`
* Improved handling of specified font name by {user}`staghado` in {pr}`3429`
* Fixing the behavior of `.become` to not modify target mobject via side effects fix color linking by {user}`MrDiver` in {pr}`3508`
* Fixed bug in :class:`.VMobjectFromSVGPath` by {user}`abul4fia` in {pr}`3677`
* Fix for windows cp1252 encoding failure (fix test pipeline) by {user}`JasonGrace2282` in {pr}`3687`
* Fix NameError in try... except by {user}`JasonGrace2282` in {pr}`3694`
* Fix successive calls of :meth:`.LinearTransformationScene.apply_matrix` by {user}`SirJamesClarkMaxwell` in {pr}`3675`
* Fixed `Mobject.put_start_and_end_on` with same start and end point by {user}`MontroyJosh` in {pr}`3718`
* Fixed issue where `SpiralIn` doesn't show elements by {user}`Gixtox` in {pr}`3589`
* Cleaned `Graph` layouts and increase flexibility by {user}`Nikhil-42` in {pr}`3434`
* `AnimationGroup`: optimized `interpolate()` and fixed alpha bug on `finish()` by {user}`chopan050` in {pr}`3542`
* Fixed warning about missing plugin `""` by {user}`behackl` in {pr}`3734`
### Documentation
* Typo in `indication` documentation by {user}`jcep` in {pr}`3477`
* Fixed typo: 360° to 180° in quickstart tutorial by {user}`szchixy` in {pr}`3498`
* Fixed typo in mobject docstring: `line` -> `square` by {user}`yuan-xy` in {pr}`3509`
* Explain ``.Transform`` vs ``.ReplacementTransform`` in quickstart examples by {user}`JasonGrace2282` in {pr}`3500`
* Fixed formatting in building blocks tutorial by {user}`MrDiver` in {pr}`3515`
* Fixed `Indicate` docstring typo by {user}`Lawqup` in {pr}`3461`
* Added Documentation to `.to_edge` and `to_corner` by {user}`TheMathematicFanatic` in {pr}`3408`
* Added some words about Cairo 1.18 by {user}`jeertmans` in {pr}`3530`
* Fixed typo of `get_y_axis_label` parameter documentation by {user}`yuan-xy` in {pr}`3547`
* Added note in docstring of `ManimColor` about class constructors by {user}`JasonGrace2282` in {pr}`3554`
* Improve documentation section about contributing to docs by {user}`chopan050` in {pr}`3555`
* Removed duplicated documentation for -s / --save_last_frame CLI flag by {user}`Gixtox` in {pr}`3528`
* Updated Docker instructions to use bash from the PATH by {user}`NotWearingPants` in {pr}`3582`
* Fixed typo in `value_tracker.py` by {user}`yuan-xy` in {pr}`3594`
* Added `ref_class` for `BooleanOperations` in Example Gallery by {user}`JasonGrace2282` in {pr}`3598`
* Changed `Vector3` to `Vector3D` in contributing docs by {user}`JasonGrace2282` in {pr}`3639`
* Added some examples for `Mobject`/`VMobject` methods by {user}`JasonGrace2282` in {pr}`3641`
* Fixed broken link to Poetry's installation guide in the documentation by {user}`biinnnggggg` in {pr}`3692`
* Fixed minor grammatical errors found in the index page of the documentation by {user}`biinnnggggg` in {pr}`3690`
* Fixed typo on page about translations by {user}`biinnnggggg` in {pr}`3696`
* Fixed outdated description of CLI option in Manim's Output Settings by {user}`HairlessVillager` in {pr}`3674`
* Mention pixi in installation guide by {user}`pavelzw` in {pr}`3678`
* Updated typing guidelines by {user}`JasonGrace2282` in {pr}`3704`
* Updated documentation and typings for `ParametricFunction` by {user}`danielzsh` in {pr}`3703`
* Fixed docstring markup in `Rotate` by {user}`TheCrowned` in {pr}`3721`
* Improve consistency in axis label example by {user}`amrear` in {pr}`3730`
### Maintenance and Testing
* Fixed wrong path in action building downloadable docs by {user}`behackl` in {pr}`3450`
* Add type hints to `_config` by {user}`Viicos` in {pr}`3440`
* Update dependency constraints, fix deprecation warnings by {user}`Viicos` in {pr}`3376`
* Update Docker base image to python3.12-slim (#3458) by {user}`PikaBlue107` in {pr}`3459`
* Fixed `line_join` to `joint_type` in example_scenes/basic.py by {user}`szchixy` in {pr}`3510`
* Fixed :attr:`.Mobject.animate` type-hint to allow LSP autocomplete by {user}`JasonGrace2282` in {pr}`3543`
* Finish TODO's in ``contributing/typings.rst`` by {user}`JasonGrace2282` in {pr}`3545`
* Fixed use of `Mobject`'s deprecated `get_*()` and `set_*()` methods in Cairo tests by {user}`JasonGrace2282` in {pr}`3549`
* Added support for Manim type aliases in Sphinx docs and added new TypeAliases by {user}`chopan050` in {pr}`3484`
* Fixed typing of `Animation` by {user}`dandavison` in {pr}`3568`
* Added some TODOs for future use of `ManimFrame` by {user}`chopan050` in {pr}`3553`
* Fixed typehint of :attr:`InternalPoint2D_Array` by {user}`JasonGrace2282` in {pr}`3592`
* Fixed error in Windows CI pipeline by {user}`behackl` in {pr}`3611`
* Fixed type hint of indication.py by {user}`yuan-xy` in {pr}`3613`
* Revert vector type aliases to NumPy ndarrays by {user}`chopan050` in {pr}`3595`
* Run `poetry lock --no-update` by {user}`JasonGrace2282` in {pr}`3621`
* Code Cleanup: removing unused imports and global variables by {user}`JasonGrace2282` in {pr}`3620`
* Fixed type hint of `Vector` direction parameter by {user}`JasonGrace2282` in {pr}`3640`
* Flake8 rule C901 is about McCabe code complexity by {user}`cclauss` in {pr}`3673`
* Updated year in license by {user}`JasonGrace2282` in {pr}`3689`
* Automated copyright updating for docs by {user}`JasonGrace2282` in {pr}`3708`
* Fixed some typehints in `mobject.py` by {user}`JasonGrace2282` in {pr}`3668`
* Search for type aliases if TYPE_CHECKING by {user}`JasonGrace2282` in {pr}`3671`
* Follow-up to graph layout cleanup: improvements for tests and typing by {user}`behackl` in {pr}`3728`
* GH Actions: Changed from macos-latest to macos-13 by {user}`JasonGrace2282` in {pr}`3729`
* Fixed return type inconsistency for `get_anchors()` by {user}`JinchuLi2002` in {pr}`3214`
* Prepared new release: `v0.18.1` by {user}`behackl` in {pr}`3719`
#### Dependency Version Changes
* Bump jupyter-server from 2.9.1 to 2.11.2 by {user}`dependabot` in {pr}`3497`
* Bump github/codeql-action from 2 to 3 by {user}`dependabot` in {pr}`3567`
* Bump actions/upload-artifact from 3 to 4 by {user}`dependabot` in {pr}`3566`
* Bump actions/setup-python from 4 to 5 by {user}`dependabot` in {pr}`3565`
* updated several packages (pillow, jupyterlab, notebook, jupyterlab-lsp, jinja2, gitpython) by {user}`behackl` in {pr}`3593`
* Update jupyter.rst by {user}`abul4fia` in {pr}`3630`
* Bump black from 23.12.1 to 24.3.0 by {user}`dependabot` in {pr}`3649`
* Bump cryptography from 42.0.0 to 42.0.4 by {user}`dependabot` in {pr}`3629`
* Bump actions/cache from 3 to 4 by {user}`dependabot` in {pr}`3607`
* Bump FedericoCarboni/setup-ffmpeg from 2 to 3 by {user}`dependabot` in {pr}`3608`
* Bump ssciwr/setup-mesa-dist-win from 1 to 2 by {user}`dependabot` in {pr}`3609`
* Bump idna from 3.6 to 3.7 by {user}`dependabot` in {pr}`3693`
* Bump pillow from 10.2.0 to 10.3.0 by {user}`dependabot` in {pr}`3672`
* [pre-commit.ci] pre-commit autoupdate by {user}`pre-commit-ci` in {pr}`3332`
* Updated sphinx deps by {user}`JasonGrace2282` in {pr}`3720`
## New Contributors
* {user}`Lawqup` made their first contribution in {pr}`3461`
* {user}`jcep` made their first contribution in {pr}`3477`
* {user}`szchixy` made their first contribution in {pr}`3498`
* {user}`PikaBlue107` made their first contribution in {pr}`3459`
* {user}`yuan-xy` made their first contribution in {pr}`3509`
* {user}`MathItYT` made their first contribution in {pr}`3516`
* {user}`doaamuham` made their first contribution in {pr}`3499`
* {user}`RobinPH` made their first contribution in {pr}`3428`
* {user}`pauluhlenbruck` made their first contribution in {pr}`3513`
* {user}`yashm277` made their first contribution in {pr}`3436`
* {user}`TheMathematicFanatic` made their first contribution in {pr}`3408`
* {user}`vvolhejn` made their first contribution in {pr}`3561`
* {user}`hydromelvictor` made their first contribution in {pr}`3574`
* {user}`dandavison` made their first contribution in {pr}`3568`
* {user}`Gixtox` made their first contribution in {pr}`3528`
* {user}`staghado` made their first contribution in {pr}`3429`
* {user}`biinnnggggg` made their first contribution in {pr}`3692`
* {user}`HairlessVillager` made their first contribution in {pr}`3674`
* {user}`SirJamesClarkMaxwell` made their first contribution in {pr}`3675`
* {user}`danielzsh` made their first contribution in {pr}`3703`
* {user}`TheCrowned` made their first contribution in {pr}`3721`
* {user}`MontroyJosh` made their first contribution in {pr}`3718`
* {user}`amrear` made their first contribution in {pr}`3730`
**Full Changelog**: https://github.com/ManimCommunity/manim/compare/v0.18.0.post0...v0.18.1

View file

@ -0,0 +1,587 @@
*******
v0.19.0
*******
:Date: January 20, 2025
Major Changes
=============
With the release of Manim v0.19.0, we've made lots of progress with making
Manim easier to install!
One of the biggest changes in this release is the replacement of the external
``ffmpeg`` dependency with the ``pyav`` library. This means that users no longer
have to install ``ffmpeg`` in order to use Manim - they can just ``pip install manim``
and it will work!
In light of this change, we also rewrote our :ref:`installation docs <local-installation>`
to recommend using a new tool called `uv <https://docs.astral.sh/uv/>`_ to install Manim.
.. note::
Do not worry if you installed Manim with any previous methods, like homebrew, pip,
choco, or scoop. Those methods will still work, and are not deprecated. However,
the recommended way to install Manim is now with `uv <https://docs.astral.sh/uv/>`_.
Contributors
============
A total of 54 people contributed to this
release. People with a '+' by their names authored a patch for the first
time.
* Aarush Deshpande
* Abulafia
* Achille Fouilleul +
* Benjamin Hackl
* CJ Lee +
* Cameron Burdgick +
* Chin Zhe Ning
* Christopher Hampson +
* ChungLeeCN +
* Eddie Ruiz +
* F. Muenkel +
* Francisco Manríquez Novoa
* Geoo Chi +
* Henrik Skov Midtiby +
* Hugo Chargois +
* Irvanal Haq +
* Jay Gupta +
* Laifsyn +
* Larry Skuse +
* Nemo2510 +
* Nikhil Iyer
* Nikhila Gurusinghe +
* Rehmatpal Singh +
* Romit Mohane +
* Saveliy Yusufov +
* Sir James Clark Maxwell
* Sophia Wisdom +
* Tristan Schulz
* VPC +
* Victorien
* Xiuyuan (Jack) Yuan +
* alembcke
* anagorko +
* czuzu +
* fogsong233 +
* jkjkil4 +
* modjfy +
* nitzanbueno +
* yang-tsao +
The patches included in this release have been reviewed by
the following contributors.
* Aarush Deshpande
* Achille Fouilleul
* Benjamin Hackl
* Christopher Hampson
* Eddie Ruiz
* Francisco Manríquez Novoa
* Henrik Skov Midtiby
* Hugo Chargois
* Irvanal Haq
* Jay Gupta
* Jérome Eertmans
* Nemo2510
* Nikhila Gurusinghe
* OliverStrait
* Saveliy Yusufov
* Sir James Clark Maxwell
* Tristan Schulz
* VPC
* Victorien
* Xiuyuan (Jack) Yuan
* alembcke
* github-advanced-security[bot]
Pull requests merged
====================
A total of 138 pull requests were merged for this release.
Highlights
----------
* :pr:`3501`: Replaced external ``ffmpeg`` dependency with ``pyav``
This change removes the need to have ``ffmpeg`` available as a command line tool
when using Manim. While ``pyav`` technically also uses ``ffmpeg`` internally,
the maintainers of ``pyav`` distribute it in their binary wheels.
* :pr:`3518`: Created a :class:`.HSV` color class, and added support for custom color spaces
This extends the color system of Manim and adds support to implement custom color spaces.
See the implementation of :class:`.HSV` for a practical example.
* :pr:`3930`: Completely reworked the installation instructions
As a consequence of removing the need for the external ``ffmpeg`` dependency,
we have reworked and massively simplified the installation instructions. Given
that practically, user-written scenes are effectively small self-contained Python
projects, the new instructions strongly recommend using the
`project and dependency management tool uv <https://docs.astral.sh/uv/>`__ to ensure
a consistent and reproducible environment.
* :pr:`3967`: Added support for Python 3.13
This adds support for Python 3.13, which brings the range of currently supported
Python versions to 3.9 -- 3.13.
* :pr:`3966`: :class:`.VGroup` can now be initialized with :class:`.VMobject` iterables
Groups of Mobjects can now be created by passing an iterable to the :class:`.VGroup`
constructors::
my_group = VGroup(Dot() for _ in range(10))
Breaking changes
----------------
* :pr:`3797`: Replaced ``Code.styles_list`` with :meth:`.Code.get_styles_list`
The ``styles_list`` attribute of the :class:`.Code` class has been replaced with
a class method :meth:`.Code.get_styles_list`. This method returns a list of all
available values for the ``formatter_style`` argument of :class:`.Code`.
* :pr:`3884`: Renamed parameters and variables conflicting with builtin functions
To avoid having keyword arguments named after builtin functions, the following
two changes were made to user-facing functions:
- ``ManimColor.from_hex(hex=...)`` is now ``ManimColor.from_hex(hex_str=...)``
- ``Scene.next_section(type=...)`` is now ``Scene.next_section(section_type=...)``
* :pr:`3922`: Removed ``inner_radius`` and ``outer_radius`` from :class:`.Sector` constructor
To construct a :class:`.Sector`, you now need to specify a ``radius`` (and an ``angle``).
In particular, :class:`.AnnularSector` still accepts both ``inner_radius`` and ``outer_radius``
arguments.
* :pr:`3964`: Allow :class:`.SurroundingRectangle` to accept multiple Mobjects
This changes the signature of :class:`.SurroundingRectangle` to accept
a sequence of Mobjects instead of a single Mobject. As a consequence, other
arguments that could be specified as positional ones before now need to be
specified as keyword arguments::
SurroundingRectangle(some_mobject, RED, 0.3) # raises error now
SurroundingRectangle(some_mobject, color=RED, buff=0.3) # correct usage
* :pr:`4115`: Completely rewrite the implementation of the :class:`.Code` mobject
This includes several breaking changes to the interface of the class to make it
more consistent. See the documentation of :class:`.Code` for a detailed description
of the new interface, and the description of the pull request :pr:`4115` for
an overview of changes to the old keyword arguments.
New features
------------
* :pr:`3148`: Added a ``colorscale`` argument to :meth:`.CoordinateSystem.plot`
* :pr:`3612`: Add three animations that together simulate a typing animation
* :pr:`3754`: Add ``@`` shorthand for :meth:`.Axes.coords_to_point` and :meth:`.Axes.point_to_coords`
* :pr:`3876`: Add :meth:`.Animation.set_default` class method
* :pr:`3903`: Preserve colors of LaTeX coloring commands
* :pr:`3913`: Added :mod:`.DVIPSNAMES` and :mod:`.SVGNAMES` color palettes
* :pr:`3933`: Added :class:`.ConvexHull`, :class:`.ConvexHull3D`, :class:`.Label` and :class:`.LabeledPolygram`
* :pr:`3992`: Add darker, lighter and contrasting methods to :class:`.ManimColor`
* :pr:`3997`: Add a time property to scene (:attr:`.Scene.time`)
* :pr:`4039`: Added the ``delay`` parameter to :func:`.turn_animation_into_updater`
Enhancements
------------
* :pr:`3829`: Rewrite :func:`~.bezier.get_quadratic_approximation_of_cubic` to produce smoother animated curves
* :pr:`3855`: Log execution time of sample scene in the ``manim checkhealth`` command
* :pr:`3888`: Significantly reduce rendering time with a separate thread for writing frames to stream
* :pr:`3890`: Better error messages for :class:`.DrawBorderThenFill`
* :pr:`3893`: Improve line rendering performance of :class:`.Cylinder`
* :pr:`3901`: Changed :attr:`.Square.side_length` attribute to a property
* :pr:`3965`: Added the ``scale_stroke`` boolean parameter to :meth:`.VMobject.scale`
* :pr:`3974`: Made videos embedded in Google Colab by default
* :pr:`3982`: Refactored ``run_time`` validation for :class:`.Animation` and :meth:`.Scene.wait`
* :pr:`4017`: Allow animations with ``run_time=0`` and implement convenience :class:`.Add` animation
* :pr:`4034`: Draw more accurate circular :class:`.Arc` mobjects for large angles
* :pr:`4051`: Add ``__hash__`` method to :class:`.ManimColor`
* :pr:`4108`: Remove duplicate declaration of ``__all__`` in :mod:`.vectorized_mobject`
Optimizations
-------------
* :pr:`3760`: Optimize :meth:`.VMobject.pointwise_become_partial`
* :pr:`3765`: Optimize :class:`.VMobject` methods which append to ``points``
* :pr:`3766`: Created and optimized Bézier splitting functions such as :func:`~.utils.bezier.partial_bezier_points()` in :mod:`manim.utils.bezier`
* :pr:`3767`: Optimized :func:`manim.utils.bezier.get_smooth_cubic_bezier_handle_points()`
* :pr:`3768`: Optimized :func:`manim.utils.bezier.is_closed`
* :pr:`3960`: Optimized :func:`~.bezier.interpolate` and :func:`~.bezier.bezier` in :mod:`manim.utils.bezier`
Fixed bugs
----------
* :pr:`3706`: Fixed :meth:`.Line.put_start_and_end_on` to use the actual end of an :class:`.Arrow3D`
* :pr:`3732`: Fixed infinite loop in OpenGL :meth:`.BackgroundRectangle.get_color`
* :pr:`3756`: Fix assertions and improve error messages when adding submobjects
* :pr:`3778`: Fixed :func:`.there_and_back_with_pause` rate function behaviour with different ``pause_ratio`` values
* :pr:`3786`: Fix :class:`.DiGraph` edges not fading correctly on :class:`.FadeIn` and :class:`.FadeOut`
* :pr:`3790`: Fixed the :func:`.get_nth_subpath` function expecting a numpy array
* :pr:`3832`: Convert audio files to ``.wav`` before passing to pydub
* :pr:`3680`: Fixed behavior of ``config.background_opacity < 1``
* :pr:`3839`: Fixed :attr:`.ManimConfig.format` not updating movie file extension
* :pr:`3885`: Fixed :meth:`.OpenGLMobject.invert` not reassembling family
* :pr:`3951`: Call :meth:`.Animation.finish` for animations in an :class:`.AnimationGroup`
* :pr:`4013`: Fixed scene skipping for :attr:`ManimConfig.upto_animation_number` set to 0
* :pr:`4089`: Fixed bug with opacity of :class:`.ImageMobject`
* :pr:`4091`: Fixed :meth:`.VMobject.add_points_as_corners` to safely handle empty ``points`` parameter
Documentation-related changes
-----------------------------
* :pr:`3669`: Added a :mod:`manim.typing` guide
* :pr:`3715`: Added docstrings to Brace
* :pr:`3745`: Underline tag should be ``<u></u>`` in the documentation
* :pr:`3818`: Automatically document usages of :class:`typing.TypeVar`
* :pr:`3849`: Fix incorrect ``versionadded`` version number in plugin section in docs
* :pr:`3851`: Rename ``manim.typing.Image`` type aliases to :class:`.PixelArray` to avoid conflict with ``PIL.Image``
* :pr:`3857`: Update installation instructions for MacOS (via dedicated brew formula)
* :pr:`3878`: Fixed typehint in ``types.rst`` and replaced outdated reference to ``manim.typing.Image`` with :class:`manim.typing.PixelArray`
* :pr:`3924`: Fix ``SyntaxWarning`` when building docs + use Python 3.13 for readthedocs build
* :pr:`3958`: Fix: ``.to_edge``'s example demonstration in docs
* :pr:`3972`: Refining documentations for :mod:`.moving_camera_scene` module
* :pr:`4032`: Bump version and create changelog for ``v0.19.0``
* :pr:`4044`: Added support for autodocumenting type aliases that use the ``type`` syntax
* :pr:`4065`: Polish documentation of :mod:`.utils.color.core` and remove ``interpolate_array`` function
* :pr:`4077`: Update README and documentation landing page, improve way how 3b1b is credited
* :pr:`4100`: Add wavy square example to :class:`.Homotopy`
* :pr:`4107`: Corrected a typo in the deep dive guide
* :pr:`4116`: Fix broken link to Poetry installation in contribution docs
Type Hints
----------
* :pr:`3751`: Added typehints to :mod:`manim.utils.iterables`
* :pr:`3803`: Added typings to :class:`.OpenGLMobject`
* :pr:`3902`: fixed a wrong type hint in :meth:`.Scene.restructure_mobjects`
* :pr:`3916`: fixed type hint in :meth:`.DrawBorderThenFill.interpolate_submobject`
* :pr:`3926`: Fixed some typehints of :class:`.ParametricFunction`
* :pr:`3940`: Fixed ``np.float_`` to ``np.float64`` while using numpy versions above 2.0
* :pr:`3961`: Added typehints to :mod:`manim.mobject.geometry`
* :pr:`3980`: Added new :class:`.PointND` and :class:`.PointND_Array` type aliases
* :pr:`3988`: Added type hints to :mod:`manim.cli` module
* :pr:`3999`: Add type annotations to :mod:`manim.utils`
* :pr:`4006`: Stopped ignoring :mod:`manim.plugins` errors in ``mypy.ini``
* :pr:`4007`: Added typings to :mod:`manim.__main__`
* :pr:`4027`: Rename ``InternalPoint3D`` to :class:`~.typing.Point3D`, ``Point3D`` to :class:`~.Point3DLike` and other point-related type aliases
* :pr:`4038`: Fixed type hint of :meth:`.Scene.play` to allow :attr:`.Mobject.animate`
Internal Improvements and Automation
------------------------------------
* :pr:`3737`: Fixed action for building downloadable documentation
* :pr:`3761`: Use ``--py39-plus`` in pre-commit
* :pr:`3777`: Add pyproject for ruff formatting
* :pr:`3779`: Switch pre-commit to use ``ruff`` for linting
* :pr:`3795`: Replace Pyupgrade with Ruff rule
* :pr:`3812`: Fix MacOS LaTeX CI
* :pr:`3853`: Change from tempconfig to a config fixture in tests
* :pr:`3858`: Update docker to use ENV x=y instead of ENV x y
* :pr:`3872`: Use ruff for pytest style
* :pr:`3873`: Use ruff instead of flake8-simplify
* :pr:`3877`: Fix pre-commit linting
* :pr:`3780`: Add Ruff Lint
* :pr:`3781`: Ignore Ruff format in git blame
* :pr:`3881`: Standardize docstrings with ruff pydocstyle rules
* :pr:`3882`: Change flake8-comprehensions and flake8-bugbear to ruff
* :pr:`3887`: Fix typo from HSV PR
* :pr:`3923`: Use Ruff pygrep rules
* :pr:`3925`: Use Github Markdown on README
* :pr:`3955`: Use ``subprocess`` instead of ``os.system``.
* :pr:`3956`: Set AAC codec for audio in mp4 files, add transcoding utility
* :pr:`4069`: Include Noto fonts in Docker image
* :pr:`4102`: Remove PT004 from Ruff ignore rules
Dependencies
------------
* :pr:`3739`: [pre-commit.ci] pre-commit autoupdate
* :pr:`3746`: Bump tqdm from 4.66.1 to 4.66.3
* :pr:`3750`: Bump jinja2 from 3.1.3 to 3.1.4
* :pr:`3776`: Bump requests from 2.31.0 to 2.32.0
* :pr:`3784`: [pre-commit.ci] pre-commit autoupdate
* :pr:`3794`: [pre-commit.ci] pre-commit autoupdate
* :pr:`3796`: Bump tornado from 6.4 to 6.4.1
* :pr:`3801`: [pre-commit.ci] pre-commit autoupdate
* :pr:`3809`: [pre-commit.ci] pre-commit autoupdate
* :pr:`3810`: Bump urllib3 from 2.2.1 to 2.2.2
* :pr:`3823`: [pre-commit.ci] pre-commit autoupdate
* :pr:`3827`: Fix docker build
* :pr:`3834`: [pre-commit.ci] pre-commit autoupdate
* :pr:`3835`: Bump docker/build-push-action from 5 to 6
* :pr:`3841`: Bump certifi from 2024.2.2 to 2024.7.4
* :pr:`3844`: [pre-commit.ci] pre-commit autoupdate
* :pr:`3847`: Bump zipp from 3.18.2 to 3.19.1
* :pr:`3865`: [pre-commit.ci] pre-commit autoupdate
* :pr:`3880`: [pre-commit.ci] pre-commit autoupdate
* :pr:`3889`: [pre-commit.ci] pre-commit autoupdate
* :pr:`3895`: Lock `poetry.lock`
* :pr:`3896`: [pre-commit.ci] pre-commit autoupdate
* :pr:`3904`: [pre-commit.ci] pre-commit autoupdate
* :pr:`3911`: [pre-commit.ci] pre-commit autoupdate
* :pr:`3918`: [pre-commit.ci] pre-commit autoupdate
* :pr:`3929`: [pre-commit.ci] pre-commit autoupdate
* :pr:`3931`: Bump cryptography from 43.0.0 to 43.0.1
* :pr:`3987`: [pre-commit.ci] pre-commit autoupdate
* :pr:`4023`: Bump tornado from 6.4.1 to 6.4.2
* :pr:`4035`: [pre-commit.ci] pre-commit autoupdate
* :pr:`4037`: Cap ``pyav`` version

View file

@ -0,0 +1,197 @@
---
short-title: v0.19.1
description: Changelog for Manim v0.19.1
---
# v0.19.1
Date
: December 01, 2025
## What's Changed
### New Features
* Introduce seed in `random_color` method to produce colors deterministically by {user}`ishu9bansal` in {pr}`4265`
* Add support for arithmetic operators `//`, `%`, `*`, `**` and `/` on `ValueTracker` by {user}`fmuenkel` in {pr}`4351`
* Add `TangentialArc` mobject by {user}`Brainsucker92` in {pr}`4469`
### Fixed Bugs and Enhancements
* Fix environment formatting for Tex() mobject by {user}`fmuenkel` in {pr}`4159`
* Improved consistency of rate_function implementations by {user}`BenKirkels` in {pr}`4144`
* Make new `Code` mobject compatible with OpenGL renderer by {user}`behackl` in {pr}`4164`
* Fix HSL color ordering in ManimColor by {user}`thehugwizard` in {pr}`4202`
* Fix return type of `Polygram.get_vertex_groups()` and rename variables in `.round_corners()` by {user}`chopan050` in {pr}`4063`
* Improve `Mobject.align_data` docstring by {user}`irvanalhaq9` in {pr}`4152`
* Fix :meth:`VMobject.pointwise_become_partial` failing when `vmobject` is `self` by {user}`irvanalhaq9` in {pr}`4193`
* Fix `add_points_as_corners` not connecting single point to existing path by {user}`irvanalhaq9` in {pr}`4219`
* Complete typing for logger_utils.py by {user}`fmuenkel` in {pr}`4134`
* Fix(graph): Allow any Line subclass as edge_type in Graph/DiGraph by {user}`Akshat-Mishra-py` in {pr}`4251`
* Replace exceptions, remove unused parameters, and fix type hints in `Animation`, `ShowPartial`, `Create`, `ShowPassingFlash`, and `DrawBorderThenFill` by {user}`irvanalhaq9` in {pr}`4214`
* Fix: `Axes` submobject colors are not being set properly by {user}`ishu9bansal` in {pr}`4291`
* Refactor `Rotating` and add docstrings to `Mobject.rotate()` and `Rotating` by {user}`irvanalhaq9` in {pr}`4147`
* Fix default config of `manim init project` to use correct `pixel_height` and `pixel_width` by {user}`StevenH34` in {pr}`4213`
* Handle opacity and transparent images by {user}`henrikmidtiby` in {pr}`4313`
* Gracefully fall back when version metadata is missing by {user}`mohiuddin-khan-shiam` in {pr}`4324`
* Fix for issue 4255 - Do not clear points when the number of curves is zero by {user}`henrikmidtiby` in {pr}`4320`
* Use utf-8 encoding to read generated .tex files. by {user}`OliverStrait` in {pr}`4334`
* Add zero to vmobject points to remove negative zeros in `get_mobject_key` by {user}`elshorbagyx` in {pr}`4332`
* Ensure `stroke_width` attribute of `SVGMobject` is not set to `None` by {user}`henrikmidtiby` in {pr}`4319`
* Fix `Prism` incorrectly rendering with `dimensions=[2, 2, 2]` in OpenGL by {user}`ra1u` in {pr}`4003`
* Fix `BraceLabel.change_label()` and document `BraceText` by {user}`henrikmidtiby` in {pr}`4347`
* Include `Text.gradient` in hash to properly regenerate `Text` when its gradient changes by {user}`AbhilashaTandon` in {pr}`4099`
* Fixed surface animations in OpenGL by {user}`nubDotDev` in {pr}`4286`
* Add type hints and support for arithmetic operators `+` and `-` on `ValueTracker` by {user}`fmuenkel` in {pr}`4129`
* Fix duplicate references in `Scene.mobjects` after `ReplacementTransform` with existing target mobject by {user}`irvanalhaq9` in {pr}`4242`
* Optimize `always_redraw()` by reducing `Mobject` copying in `Mobject.become()` by {user}`chopan050` in {pr}`4357`
* Enhance `manim cfg show` output and add info-level logging for config files read by {user}`xnov18` in {pr}`4375`
* Let `Cube` use Bevel type line joints by {user}`nubDotDev` in {pr}`4361`
* Properly define `init_points` methods for use in OpenGL instead of defining `init_points = generate_points` by {user}`chopan050` in {pr}`4360`
* Allow passing a tuple to `buff` in `SurroundingRectangle` to specify buffer in x and y direction independently by {user}`nubDotDev` in {pr}`4390`
* Rewrite `color_gradient` to always return a list of ManimColors by {user}`henrikmidtiby` in {pr}`4380`
* Ensure leading whitespace does not change line height for lines in CodeMobject by {user}`behackl` in {pr}`4392`
* Simplify the function `remove_invisible_chars` in `text_mobject.py` by {user}`henrikmidtiby` in {pr}`4394`
* Fix some config options specified via `--config_file` not being respected properly by {user}`behackl` in {pr}`4401`
* Fix: Correct resolution tuple order to (height, width) by {user}`Nikhil172913832` in {pr}`4440`
* Ensure that start and end points are stored as float values in Line3D by {user}`SirJamesClarkMaxwell` in {pr}`4080`
* OpenGL: Fix iterated nesting in `DecimalNumber.set_value` by {user}`henrikmidtiby` in {pr}`4373`
* Update default resolution in CLI to match Manims 1920x1080 default settings by {user}`SASHAKT1290` in {pr}`4452`
* Better parsing of color styles in CodeMobject by {user}`SirJamesClarkMaxwell` in {pr}`4454`
* Allow selection of all scenes to render using '*' by {user}`NightyStudios` in {pr}`4470`
* Prevent mutation of `about_point` in `apply_points_function_about_point` by {user}`Morkunas` in {pr}`4478`
* Fix behavior of `Mobject.suspend_updating`: when only suspending parent mobject, let children continue updating by {user}`behackl` in {pr}`4402`
* Allow passing a `buff` to `LabeledDot` by {user}`nubDotDev` in {pr}`4403`
* Pass ndarrays to `mapbox_earcut.triangulate_float32()` to fix `TypeError` in `mapbox_earcut==2.0.0` by {user}`GuiCT` in {pr}`4479`
* Fix duplicated arrow tips in DashedVMobject (issue #3220) by {user}`jakekinchen` in {pr}`4484`
### Documentation
* Add docstring to :meth:`.Mobject.get_family` by {user}`irvanalhaq9` in {pr}`4127`
* Fix link formatting and clarify the distinction between Manim versions in index.rst by {user}`irvanalhaq9` in {pr}`4131`
* Add instructions for installing system utilities `cairo` and `pkg-config` via Homebrew on MacOS by {user}`behackl` in {pr}`4146`
* Add missing line break in Code of Conduct's conflict of interest policy by {user}`Hasan-Mesbaul-Ali-Taher` in {pr}`4185`
* Fix links to Pango website by {user}`ragibson` in {pr}`4217`
* Replace poetry with uv in the README by {user}`xinoehp512` in {pr}`4226`
* Improve docstring for `interpolate` method in `Mobject` class by {user}`irvanalhaq9` in {pr}`4149`
* Add docstrings to `Line` and remove `None` handling for `path_arc` parameter by {user}`irvanalhaq9` in {pr}`4223`
* Add docstring to :meth:`Mobject.family_members_with_points` by {user}`irvanalhaq9` in {pr}`4128`
* Update incorrect docstring for :attr:`ManimConfig.gui_location` property by {user}`SAYAN02-DEV` in {pr}`4254`
* Fix formatting of color space documentation by {user}`behackl` in {pr}`4274`
* Enhance and Paraphrase Description of ManimCE in README.md by {user}`irvanalhaq9` in {pr}`4141`
* docs: add explanation about the rate_func in the custom animation by {user}`pedropxoto` in {pr}`4278`
* Fixed artifact in docstring of Animation by {user}`barollet` in {pr}`4283`
* Rename update function `dot_position` to `update_label` in `.add_updater` example by {user}`irvanalhaq9` in {pr}`4196`
* Fix Microsoft typo in `TexFontTemplateLibrary` scene in `example_scenes/advanced_tex_fonts.py` by {user}`alterdim` in {pr}`4305`
* Improved readability, grammar, as well as added docstrings for consistency by {user}`NASAnerd05` in {pr}`4267`
* Add docstrings for `ChangingDecimal` and `ChangeDecimalToValue` by {user}`haveheartt` in {pr}`4346`
* Fix Sphinx exceptions when trying to build documentation via latex / as pdf by {user}`behackl` in {pr}`4370`
* Added license information to documentation landing page by {user}`Nikil-D-Gr8` in {pr}`3986`
* Set the default Python version to 3.13 in the uv installation guide by {user}`henrikmidtiby` in {pr}`4480`
### Maintenance and Testing
* Change project management tool from poetry to uv by {user}`behackl` in {pr}`4138`
* Re-add ffmpeg as dependency within Docker image by {user}`behackl` in {pr}`4150`
* Add tests for Matrix, DecimalMatrix, IntegerMatrix by {user}`pdrzan` in {pr}`4279`
* Add tests for polylabel utility by {user}`giolucasd` in {pr}`4269`
* Add support for `pycodestyle W` rule in Ruff by {user}`KaiqueDultra` in {pr}`4276`
* Fix files with few MyPy typing errors by {user}`henrikmidtiby` in {pr}`4263`
* Explicitly mention all files that mypy should ignore in the `mypy.ini` configuration file by {user}`henrikmidtiby` in {pr}`4306`
* Remove dead code from `scene.py` and `vector_space_scene.py` by {user}`henrikmidtiby` in {pr}`4310`
* Add type annotations to `scene.py` and `vector_space_scene.py` by {user}`henrikmidtiby` in {pr}`4260`
* Replace setup-texlive-action in CI workflow by {user}`behackl` in {pr}`4326`
* Adding type annotations to polyhedra.py and matrix.py by {user}`henrikmidtiby` in {pr}`4322`
* Handling typing errors in text/numbers.py by {user}`henrikmidtiby` in {pr}`4317`
* Move `configure_pygui` into a `Scene` method and remove `manim.gui` by {user}`chopan050` in {pr}`4314`
* Add typing annotations to svg_mobject.py by {user}`henrikmidtiby` in {pr}`4318`
* Add type annotations to `mobject/svg/brace.py` and default to `label_constructor=Text` in `BraceText` by {user}`henrikmidtiby` in {pr}`4309`
* Add classes `MethodWithArgs`, `SceneInteractContinue` and `SceneInteractRerun` inside new module `manim.data_structures` by {user}`chopan050` in {pr}`4315`
* Fix typo in import of OpenGLCamera in `utils/hashing.py` by {user}`fmuenkel` in {pr}`4352`
* Add type annotations to `manim/renderer/shader.py` by {user}`henrikmidtiby` in {pr}`4350`
* Add type annotations to `tex_mobject.py` by {user}`henrikmidtiby` in {pr}`4355`
* Add type annotations to `three_d_camera.py` by {user}`henrikmidtiby` in {pr}`4356`
* Revert change of default value for tex_environment by {user}`henrikmidtiby` in {pr}`4358`
* Add type hints to `scene_file_writer.py`, `section.py`, and `zoomed_scene.py` by {user}`fmuenkel` in {pr}`4133`
* Add type annotations for most of `camera` and `mobject.graphing` by {user}`henrikmidtiby` in {pr}`4125`
* Add `VectorNDLike` type aliases by {user}`chopan050` in {pr}`4068`
* Add type annotations to `dot_cloud.py`, `vectorized_mobject_rendering.py` and `opengl_three_dimensions.py` by {user}`henrikmidtiby` in {pr}`4359`
* Add type annotations to `indication.py` by {user}`henrikmidtiby` in {pr}`4367`
* Add type annotations to `composition.py` by {user}`henrikmidtiby` in {pr}`4366`
* Add type annotations to `growing.py` by {user}`henrikmidtiby` in {pr}`4368`
* Add type annotations to `movement.py` by {user}`henrikmidtiby` in {pr}`4371`
* Exclude check for cyclic imports by CodeQL by {user}`behackl` in {pr}`4384`
* Refactor imports from `collections.abc`, `typing` and `typing_extensions` for Python 3.9 by {user}`chopan050` in {pr}`4353`
* Add type annotations to `opengl_renderer_window.py` by {user}`fmuenkel` in {pr}`4363`
* Rename `SceneFileWriter.save_final_image()` to `save_image()` by {user}`fmuenkel` in {pr}`4378`
* Add type annotations to `text_mobject.py` by {user}`henrikmidtiby` in {pr}`4381`
* Rename types like `RGBA_Array_Float` to `FloatRGBA` and add types like `FloatRGBA_Array` by {user}`chopan050` in {pr}`4386`
* Add type annotations to `opengl_geometry.py` by {user}`henrikmidtiby` in {pr}`4396`
* Add type annotations to `moving_camera.py` by {user}`henrikmidtiby` in {pr}`4397`
* Add type annotations to `opengl_mobject.py` by {user}`RBerga06` in {pr}`4398`
* Fix failing pre-commit tests by {user}`cclauss` in {pr}`4434`
* Add type annotations to `cairo_renderer.py` by {user}`fmuenkel` in {pr}`4393`
* Fix type errors and add typings for `Mobject.apply_function()`, its derivatives, and other utility functions by {user}`godalming123` in {pr}`4228`
* Bump macOS image from deprecated macos-13 to macos-15-intel by {user}`chopan050` in {pr}`4481`
* Prepare new release `v0.19.1` and bump minimum required Python version to 3.10 by {user}`behackl` in {pr}`4490`
### Dependency Version Changes
* Bump typing extensions minimum version by {user}`JasonGrace2282` in {pr}`4121`
* [pre-commit.ci] pre-commit autoupdate by {user}`pre-commit-ci`[bot] in {pr}`4122`
* [pre-commit.ci] pre-commit autoupdate by {user}`pre-commit-ci`[bot] in {pr}`4140`
* [pre-commit.ci] pre-commit autoupdate by {user}`pre-commit-ci`[bot] in {pr}`4148`
* [pre-commit.ci] pre-commit autoupdate by {user}`pre-commit-ci`[bot] in {pr}`4181`
* Bump astral-sh/setup-uv from 5 to 6 by {user}`dependabot`[bot] in {pr}`4234`
* [pre-commit.ci] pre-commit autoupdate by {user}`pre-commit-ci`[bot] in {pr}`4204`
* [pre-commit.ci] pre-commit autoupdate by {user}`pre-commit-ci`[bot] in {pr}`4391`
* [pre-commit.ci] pre-commit autoupdate by {user}`pre-commit-ci`[bot] in {pr}`4405`
* Bump actions/setup-python from 5 to 6 by {user}`dependabot`[bot] in {pr}`4433`
* Bump actions/checkout from 4 to 5 by {user}`dependabot`[bot] in {pr}`4418`
* [pre-commit.ci] pre-commit autoupdate by {user}`pre-commit-ci`[bot] in {pr}`4409`
* [pre-commit.ci] pre-commit autoupdate by {user}`pre-commit-ci`[bot] in {pr}`4460`
* [pre-commit.ci] pre-commit autoupdate by {user}`pre-commit-ci`[bot] in {pr}`4467`
* Bump github/codeql-action from 3 to 4 by {user}`dependabot`[bot] in {pr}`4466`
* Bump astral-sh/setup-uv from 6 to 7 by {user}`dependabot`[bot] in {pr}`4465`
* Bump actions/upload-artifact from 4 to 5 by {user}`dependabot`[bot] in {pr}`4464`
## New Contributors
* {user}`BenKirkels` made their first contribution in {pr}`4144`
* {user}`Hasan-Mesbaul-Ali-Taher` made their first contribution in {pr}`4185`
* {user}`ragibson` made their first contribution in {pr}`4217`
* {user}`thehugwizard` made their first contribution in {pr}`4202`
* {user}`xinoehp512` made their first contribution in {pr}`4226`
* {user}`SAYAN02-DEV` made their first contribution in {pr}`4254`
* {user}`Akshat-Mishra-py` made their first contribution in {pr}`4251`
* {user}`pdrzan` made their first contribution in {pr}`4279`
* {user}`pedropxoto` made their first contribution in {pr}`4278`
* {user}`giolucasd` made their first contribution in {pr}`4269`
* {user}`KaiqueDultra` made their first contribution in {pr}`4276`
* {user}`ishu9bansal` made their first contribution in {pr}`4291`
* {user}`StevenH34` made their first contribution in {pr}`4213`
* {user}`alterdim` made their first contribution in {pr}`4305`
* {user}`mohiuddin-khan-shiam` made their first contribution in {pr}`4324`
* {user}`elshorbagyx` made their first contribution in {pr}`4332`
* {user}`NASAnerd05` made their first contribution in {pr}`4267`
* {user}`ra1u` made their first contribution in {pr}`4003`
* {user}`AbhilashaTandon` made their first contribution in {pr}`4099`
* {user}`nubDotDev` made their first contribution in {pr}`4286`
* {user}`haveheartt` made their first contribution in {pr}`4346`
* {user}`xnov18` made their first contribution in {pr}`4375`
* {user}`Nikil-D-Gr8` made their first contribution in {pr}`3986`
* {user}`RBerga06` made their first contribution in {pr}`4398`
* {user}`Nikhil172913832` made their first contribution in {pr}`4440`
* {user}`SASHAKT1290` made their first contribution in {pr}`4452`
* {user}`Brainsucker92` made their first contribution in {pr}`4469`
* {user}`NightyStudios` made their first contribution in {pr}`4470`
* {user}`Morkunas` made their first contribution in {pr}`4478`
* {user}`GuiCT` made their first contribution in {pr}`4479`
* {user}`godalming123` made their first contribution in {pr}`4228`
* {user}`jakekinchen` made their first contribution in {pr}`4484`
**Full Changelog**: https://github.com/ManimCommunity/manim/compare/v0.19.0...v0.19.1

View file

@ -0,0 +1,41 @@
---
short-title: v0.19.2
description: Changelog for Manim v0.19.2
---
# v0.19.2
Date
: January 17, 2026
## What's Changed
### Highlights 🌟
* Add support for Python 3.14, bump minimum Python to 3.11 and av to 14.0.1 by {user}`behackl` in {pr}`4385`
### Bug Fixes 🐛
* Fix argument passed to `get_hash_from_play_call` in hashing by {user}`judenimo` in {pr}`4524`
* Fix incorrect `Circle.point_at_angle` calculation by {user}`Swarnlataaa` in {pr}`4438`
### Testing 🧪
* Test on Apple Silicon ARM64 by {user}`cclauss` in {pr}`4496`
### Code Quality & Refactoring 🧹
* Add ruff rules PERF for performance by {user}`cclauss` in {pr}`4492`
* Remove deprecation warning from pytest "np.trapz" -> "np.trapezoid" by {user}`henrikmidtiby` in {pr}`4513`
* Bump Python target versions of both mypy and ruff by {user}`behackl` in {pr}`4520`
* Replace legacy numpy usage -- ruff rule NPY002 by {user}`cclauss` in {pr}`4516`
* Add `.github/release.yml` for improved classifications in automatically generated changelogs by {user}`behackl` in {pr}`4526`
* Check and bump lower version requirements for dependencies by {user}`henrikmidtiby` in {pr}`4529`
### Type Hints 📝
* Add type annotations to `three_dimensions.py` by {user}`henrikmidtiby` in {pr}`4497`
### Other Changes
* Prepare new release `v0.19.2` by {user}`behackl` in {pr}`4528`
## New Contributors
* {user}`judenimo` made their first contribution in {pr}`4524`
* {user}`Swarnlataaa` made their first contribution in {pr}`4438`
**Full Changelog**: https://github.com/ManimCommunity/manim/compare/v0.19.1...v0.19.2

View file

@ -0,0 +1,86 @@
---
short-title: v0.20.0
description: Changelog for v0.20.0
---
# v0.20.0
Date
: February 20, 2026
## What's Changed
### Breaking Changes 🚨
* Fix `ImageMobject` 3D rotation/flipping and remove resampling algorithms `lanczos` (`antialias`), `box` and `hamming` by {user}`chopan050` in {pr}`4266`
* Fix `YELLOW_C` and add `PURE_CYAN`, `PURE_MAGENTA` and `PURE_YELLOW` by {user}`chopan050` in {pr}`4562`
### Highlights 🌟
* Rewrite MathTex to make it more robust regarding splitting by {user}`henrikmidtiby` in {pr}`4515`
The MathTex implementation has been updated to make it more robust and fix a number of issues.
A beneficial side effect is that named groups in svg files can now be accessed through SVGMobject.
* Add new Animation Builder `Mobject.always` by {user}`JasonGrace2282` in {pr}`4594`
This new feature is a convenience wrapper around `add_updater` that allows adding
updaters to a mobject in an intuitive and easy-to-read way. Example usage in a scene:
```python
d = Dot()
s = Square()
d.always.next_to(s, UP)
self.add(s, d)
self.play(s.animate.to_edge(LEFT))
```
### New Features ✨
* Add a `seed` config option + `--seed` CLI option for reproducible randomness in rendered scenes by {user}`arnaud-ma` in {pr}`4532`
### Enhancements 🚀
* Enable `strict=True` for `zip()` where safe by {user}`Oll-iver` in {pr}`4547`
### Bug Fixes 🐛
* using `color` instead of `fill_color` with MathTeX for node labels by {user}`Schefflera-Arboricola` in {pr}`4501`
* fix: infinite recursion caused by accessing color of a highlighted Ta… by {user}`BHearron` in {pr}`4435`
* Prevent potential `UnboundLocalError` in `PolarPlane` by {user}`RinZ27` in {pr}`4557`
* Fixed division by 0 in `turn_animation_into_updater` by {user}`SoldierSacha` in {pr}`4567`
* Fix TOCTOU Race Conditions when creating directories by {user}`SoldierSacha` in {pr}`4587`
* Resolve more race conditions potentially happening during directory creation by {user}`SoldierSacha` in {pr}`4589`
* Fix `c2p`/`coords_to_point` method call with single flat list or 1D array input by {user}`danielalanbates` in {pr}`4596`
### Documentation 📚
* Enable rendered documentation of `RandomColorGenerator` by {user}`arnaud-ma` in {pr}`4533`
* Remove pin to Python 3.13 in installation docs by {user}`chopan050` in {pr}`4534`
* Fix broken aquabeam OpenGL link using Wayback Machine by {user}`behackl` in {pr}`4545`
* Add type annotations and docstrings in `opengl_renderer.py` by {user}`arnaud-ma` in {pr}`4537`
* docs: improve `TransformFromCopy` docstring by {user}`GoThrones` in {pr}`4597`
### Infrastructure & Build 🔨
* Install missing dependencies in release pipeline by {user}`behackl` in {pr}`4531`
### Code Quality & Refactoring 🧹
* Rework and consolidate release changelog script, add previously skipped changelog entries by {user}`behackl` in {pr}`4568`
* Remove `__future__.annotations` from required imports by {user}`JasonGrace2282` in {pr}`4571`
* Cleaned up `mypy.ini` by {user}`henrikmidtiby` in {pr}`4584`
* Add `py.typed` to declare manim as having type hints by {user}`Timmmm` in {pr}`4553`
* Fix assertion in `ImageMobjectFromCamera.interpolate_color()` by {user}`chopan050` in {pr}`4593`
* Reduce dependency on scipy - replace `scipy.special.comb` with `math.comb` by {user}`fmuenkel` in {pr}`4598`
### Type Hints 📝
* Add type annotations to `rotation.py` by {user}`fmuenkel` in {pr}`4535`
* Add type annotations to `opengl_compatibility.py` by {user}`fmuenkel` in {pr}`4585`
* Add type annotations to `image_mobject.py` by {user}`henrikmidtiby` in {pr}`4458`
* Add type annotations to `opengl_image_mobject.py` by {user}`fmuenkel` in {pr}`4536`
* Add type annotations to `point_cloud_mobject.py` by {user}`fmuenkel` in {pr}`4586`
## New Contributors
* {user}`arnaud-ma` made their first contribution in {pr}`4533`
* {user}`Schefflera-Arboricola` made their first contribution in {pr}`4501`
* {user}`BHearron` made their first contribution in {pr}`4435`
* {user}`RinZ27` made their first contribution in {pr}`4557`
* {user}`SoldierSacha` made their first contribution in {pr}`4567`
* {user}`Oll-iver` made their first contribution in {pr}`4547`
* {user}`GoThrones` made their first contribution in {pr}`4597`
* {user}`danielalanbates` made their first contribution in {pr}`4596`
**Full Changelog**: [Compare view](https://github.com/ManimCommunity/manim/compare/v0.19.2...v0.20.0)

View file

@ -0,0 +1,41 @@
---
short-title: v0.20.1
description: Changelog for v0.20.1
---
# v0.20.1
Date
: February 27, 2026
## What's Changed
### Enhancements 🚀
* Cleanup `TipableVMobject`: avoid mutable default and fix `assign_tip_attr` typo by {user}`josiest` in {pr}`4503`
* enhancement: optimize Docker image build and runtime footprint by {user}`behackl` in {pr}`4604`
### Bug Fixes 🐛
* fix: MathTex double-brace splitting no longer fires on natural LaTeX `}}` by {user}`behackl` in {pr}`4602`
* Fix creation or animation of a zero-length `DashedLine` by {user}`SORVER` in {pr}`4606`
* Fix moving-object detection for nested AnimationGroups with z-indexed mobjects by {user}`Merzlikin-Matvey` in {pr}`4389`
* Fix unintended propagation of `kwargs` in `LaggedStartMap` by {user}`irvanalhaq9` in {pr}`4613`
### Documentation 📚
* Documentation: manual installation of manim as a local package by {user}`u7920349` in {pr}`4456`
* Add alt text to all images in `README.md` by {user}`VerisimilitudeX` in {pr}`4064`
### Code Quality & Refactoring 🧹
* Fix publish release workflow by {user}`behackl` in {pr}`4600`
* Silence pydub ffmpeg/avconv import warning when ffmpeg CLI is absent by {user}`behackl` in {pr}`4603`
### Type Hints 📝
* Add type annotations to `manim/_config/utils.py` by {user}`henrikmidtiby` in {pr}`4230`
## New Contributors
* {user}`SORVER` made their first contribution in {pr}`4606`
* {user}`josiest` made their first contribution in {pr}`4503`
* {user}`u7920349` made their first contribution in {pr}`4456`
* {user}`Merzlikin-Matvey` made their first contribution in {pr}`4389`
* {user}`VerisimilitudeX` made their first contribution in {pr}`4064`
**Full Changelog**: [Compare view](https://github.com/ManimCommunity/manim/compare/v0.20.0...v0.20.1)

View file

@ -8,9 +8,11 @@ from __future__ import annotations
import os
import sys
from datetime import datetime
from pathlib import Path
import manim
from manim.utils.docbuild.module_parsing import parse_module_attributes
# -- Path setup --------------------------------------------------------------
# If extensions (or modules to document with autodoc) are in another directory,
@ -24,7 +26,7 @@ sys.path.insert(0, os.path.abspath("."))
# -- Project information -----------------------------------------------------
project = "Manim"
copyright = "2020-2022, The Manim Community Dev Team"
copyright = f"2020-{datetime.now().year}, The Manim Community Dev Team" # noqa: A001
author = "The Manim Community Dev Team"
@ -44,17 +46,36 @@ extensions = [
"sphinxext.opengraph",
"manim.utils.docbuild.manim_directive",
"manim.utils.docbuild.autocolor_directive",
"manim.utils.docbuild.autoaliasattr_directive",
"sphinx.ext.graphviz",
"sphinx.ext.inheritance_diagram",
"sphinxcontrib.programoutput",
"myst_parser",
"sphinx_design",
"sphinx_reredirects",
]
# Automatically generate stub pages when using the .. autosummary directive
autosummary_generate = True
myst_enable_extensions = ["colon_fence", "amsmath", "deflist"]
# redirects (for moved / deleted pages)
redirects = {
"installation/linux": "uv.html",
"installation/macos": "uv.html",
"installation/windows": "uv.html",
}
# generate documentation from type hints
ALIAS_DOCS_DICT = parse_module_attributes()[0]
autodoc_typehints = "description"
autodoc_type_aliases = {
alias_name: f"~manim.{module}.{alias_name}"
for module, module_dict in ALIAS_DOCS_DICT.items()
for category_dict in module_dict.values()
for alias_name in category_dict
}
autoclass_content = "both"
# controls whether functions documented by the autofunction directive
@ -103,7 +124,6 @@ html_theme_options = {
"source_repository": "https://github.com/ManimCommunity/manim/",
"source_branch": "main",
"source_directory": "docs/source/",
"top_of_page_button": None,
"light_logo": "manim-logo-sidebar.svg",
"dark_logo": "manim-logo-sidebar-dark.svg",
"light_css_variables": {
@ -136,11 +156,13 @@ html_title = f"Manim Community v{manim.__version__}"
# This specifies any additional css files that will override the theme's
html_css_files = ["custom.css"]
latex_engine = "lualatex"
# external links
extlinks = {
"issue": ("https://github.com/ManimCommunity/manim/issues/%s", "#%s"),
"pr": ("https://github.com/ManimCommunity/manim/pull/%s", "#%s"),
"pr": ("https://github.com/ManimCommunity/manim/pull/%s", "PR #%s"),
"user": ("https://github.com/%s", "@%s"),
}
# opengraph settings

View file

@ -38,14 +38,10 @@ To get an overview of what our community is currently working on, check out
Contributing can be confusing, so here are a few guides:
.. toctree::
:maxdepth: 2
:maxdepth: 3
contributing/development
contributing/docstrings
contributing/references
contributing/examples
contributing/typings
contributing/admonitions
contributing/docs
contributing/testing
contributing/performance
contributing/internationalization

View file

@ -0,0 +1,249 @@
# Manim Development Process
## For first-time contributors
1. Install git:
For instructions see <https://git-scm.com/>.
2. Fork the project:
Go to <https://github.com/ManimCommunity/manim> and click the "fork" button
to create a copy of the project for you to work on. You will need a
GitHub account. This will allow you to make a "Pull Request" (PR)
to the ManimCommunity repo later on.
3. Clone your fork to your local computer:
```shell
git clone https://github.com/<your-username>/manim.git
```
GitHub will provide both a SSH (`git@github.com:<your-username>/manim.git`) and
HTTPS (`https://github.com/<your-username>/manim.git`) URL for cloning.
You can use SSH if you have SSH keys setup.
:::{WARNING}
Do not clone the ManimCommunity repository. You must clone your own
fork.
:::
4. Change the directory to enter the project folder:
```shell
cd manim
```
5. Add the upstream repository, ManimCommunity:
```shell
git remote add upstream https://github.com/ManimCommunity/manim.git
```
6. Now, `git remote -v` should show two remote repositories named:
- `origin`, your forked repository
- `upstream` the ManimCommunity repository
7. Install the Python project management tool `uv`, as recommended
in our {doc}`installation guide for users </installation/uv>`.
8. Let `uv` create a virtual environment for your development
installation by running
```shell
uv sync
```
In case you need (or want) to install some of the optional dependency
groups defined in our [`pyproject.toml`](https://github.com/ManimCommunity/manim/blob/main/pyproject.toml),
run `uv sync --all-extras`, or pass the `--extra` flag with the
name of a group, for example `uv sync --extra jupyterhub`.
9. Install Pre-Commit:
```shell
uv run pre-commit install
```
This will ensure during development that each of your commits is properly
formatted against our linter and formatters.
You are now ready to work on Manim!
## Develop your contribution
1. Checkout your local repository's main branch and pull the latest
changes from ManimCommunity, `upstream`, into your local repository:
```shell
git switch main
git pull --rebase upstream main
```
2. Create a branch for the changes you want to work on rather than working
off of your local main branch:
```shell
git switch -c <new branch name> upstream/main
```
This ensures you can easily update your local repository's main with the
first step and switch branches to work on multiple features.
3. Write some awesome code!
You're ready to make changes in your local repository's branch.
You can add local files you've changed within the current directory with
`git add .`, or add specific files with
```shell
git add <file/directory>
```
and commit these changes to your local history with `git commit`. If you
have installed pre-commit, your commit will succeed only if none of the
hooks fail.
:::{tip}
When crafting commit messages, it is highly recommended that
you adhere to [these guidelines](https://www.conventionalcommits.org/en/v1.0.0/).
:::
4. Add new or update existing tests.
Depending on your changes, you may need to update or add new tests. For new
features, it is required that you include tests with your PR. Details of
our testing system are explained in the {doc}`testing guide <testing>`.
5. Update docstrings and documentation:
Update the docstrings (the text in triple quotation marks) of any functions
or classes you change and include them with any new functions you add.
See the {doc}`documentation guide <docs/docstrings>` for more information about how we
prefer our code to be documented. The content of the docstrings will be
rendered in the {doc}`reference manual <../reference>`.
:::{tip}
Use the {mod}`manim directive for Sphinx <manim.utils.docbuild.manim_directive>` to add examples
to the documentation!
:::
As far as development on your local machine goes, these are the main steps you
should follow.
(polishing-changes-and-submitting-a-pull-request)=
## Polishing Changes and Submitting a Pull Request
As soon as you are ready to share your local changes with the community
so that they can be discussed, go through the following steps to open a
pull request. A pull request signifies to the ManimCommunity organization,
"Here are some changes I wrote; I think it's worthwhile for you to maintain
them."
:::{note}
You do not need to have everything (code/documentation/tests) complete
to open a pull request (PR). If the PR is still under development, please
mark it as a draft. Community developers will still be able to review the
changes, discuss yet-to-be-implemented changes, and offer advice; however,
the more complete your PR, the quicker it will be merged.
:::
1. Update your fork on GitHub to reflect your local changes:
```shell
git push -u origin <branch name>
```
Doing so creates a new branch on your remote fork, `origin`, with the
contents of your local repository on GitHub. In subsequent pushes, this
local branch will track the branch `origin` and `git push` is enough.
2. Make a pull request (PR) on GitHub.
In order to make the ManimCommunity development team aware of your changes,
you can make a PR to the ManimCommunity repository from your fork.
:::{WARNING}
Make sure to select `ManimCommunity/manim` instead of `3b1b/manim`
as the base repository!
:::
Choose the branch from your fork as the head repository - see the
screenshot below.
```{image} /_static/pull-requests.png
:align: center
```
Please make sure you follow the template (this is the default
text you are shown when first opening the 'New Pull Request' page).
Your changes are eligible to be merged if:
1. there are no merge conflicts
2. the tests in our pipeline pass
3. at least one (two for more complex changes) Community Developer approves the changes
You can check for merge conflicts between the current upstream/main and
your branch by executing `git pull upstream main` locally. If this
generates any merge conflicts, you need to resolve them and push an
updated version of the branch to your fork of the repository.
Our pipeline consists of a series of different tests that ensure
that Manim still works as intended and that the code you added
sticks to our coding conventions.
- **Code style**: We use the code style imposed
by [Black](https://black.readthedocs.io/en/stable/), [isort](https://pycqa.github.io/isort/)
and [flake8](https://flake8.pycqa.org/en/latest/). The GitHub pipeline
makes sure that the (Python) files changed in your pull request
also adhere to this code style. If this step of the pipeline fails,
fix your code formatting automatically by running `black <file or directory>` and `isort <file or directory>`.
To fix code style problems, run `flake8 <file or directory>` for a style report, and then fix the problems
manually that were detected by `flake8`.
- **Tests**: The pipeline runs Manim's test suite on different operating systems
(the latest versions of Ubuntu, macOS, and Windows) for different versions of Python.
The test suite consists of two different kinds of tests: integration tests
and doctests. You can run them locally by executing `uv run pytest`
and `uv run pytest --doctest-modules manim`, respectively, from the
root directory of your cloned fork.
- **Documentation**: We also build a version of the documentation corresponding
to your pull request. Make sure not to introduce any Sphinx errors, and have
a look at the built HTML files to see whether the formatting of the documentation
you added looks as you intended. You can build the documentation locally
by running `make html` from the `docs` directory. Make sure you have [Graphviz](https://graphviz.org/)
installed locally in order to build the inheritance diagrams. See {doc}`docs` for
more information.
Finally, if the pipeline passes and you are satisfied with your changes: wait for
feedback and iterate over any requested changes. You will likely be asked to
edit or modify your PR in one way or another during this process. This is not
an indictment of your work, but rather a strong signal that the community
wants to merge your changes! Once approved, your changes may be merged!
### Further useful guidelines
1. When submitting a PR, please mention explicitly if it includes breaking changes.
2. When submitting a PR, make sure that your proposed changes are as general as
possible, and ready to be taken advantage of by all of Manim's users. In
particular, leave out any machine-specific configurations, or any personal
information it may contain.
3. If you are a maintainer, please label issues and PRs appropriately and
frequently.
4. When opening a new issue, if there are old issues that are related, add a link
to them in your new issue (even if the old ones are closed).
5. When submitting a code review, it is highly recommended that you adhere to
[these general guidelines](https://conventionalcomments.org/).
6. If you find stale or inactive issues that seem to be irrelevant, please post
a comment saying 'This issue should be closed', and a community developer
will take a look.
7. Please do as much as possible to keep issues, PRs, and development in
general as tidy as possible.
You can find examples for the `docs` in several places:
the {doc}`Example Gallery <../examples>`, {doc}`Tutorials <../tutorials/index>`,
and {doc}`Reference Classes <../reference>`.
**Thank you for contributing!**

View file

@ -1,285 +0,0 @@
=========================
Manim Development Process
=========================
For first-time contributors
---------------------------
#. Install git:
For instructions see https://git-scm.com/.
#. Fork the project:
Go to https://github.com/ManimCommunity/manim and click the "fork" button
to create a copy of the project for you to work on. You will need a
GitHub account. This will allow you to make a "Pull Request" (PR)
to the ManimCommunity repo later on.
#. Clone your fork to your local computer:
.. code-block:: shell
git clone https://github.com/<your-username>/manim.git
GitHub will provide both a SSH (``git@github.com:<your-username>/manim.git``) and
HTTPS (``https://github.com/<your-username>/manim.git``) URL for cloning.
You can use SSH if you have SSH keys setup.
.. WARNING::
Do not clone the ManimCommunity repository. You must clone your own
fork.
#. Change the directory to enter the project folder:
.. code-block:: shell
cd manim
#. Add the upstream repository, ManimCommunity:
.. code-block:: shell
git remote add upstream https://github.com/ManimCommunity/manim.git
#. Now, ``git remote -v`` should show two remote repositories named:
- ``origin``, your forked repository
- ``upstream`` the ManimCommunity repository
#. Install Manim:
- Follow the steps in our :doc:`installation instructions
<../installation>` to install **Manim's dependencies**,
primarily ``ffmpeg`` and ``LaTeX``.
- We recommend using `Poetry <https://python-poetry.org>`__ to manage your
developer installation of Manim. Poetry is a tool for dependency
management and packaging in Python. It allows you to declare the libraries
your project depends on, and it will manage (install / update) them
for you. In addition, Poetry provides a simple interface for
managing virtual environments.
If you choose to use Poetry as well, follow `Poetry's installation
guidelines <https://python-poetry.org/docs/master/#installation>`__
to install it on your system, then run ``poetry install`` from
your cloned repository. Poetry will then install Manim, as well
as create and enter a virtual environment. You can always re-enter
that environment by running ``poetry shell``.
- In case you want to install extra dependencies that are defined in
the ``[tool.poetry.extras]`` section of ``pyproject.toml``, this can be done by passing
the ``-E`` flag, for example ``poetry install -E jupyterlab -E gui``.
- In case you decided against Poetry, you can install Manim via pip
by running ``python3 -m pip install .``. Note that due to our
development infrastructure being based on Poetry, we currently
do not support editable installs via ``pip``, so you will have
to re-run this command every time you make changes to the source
code.
.. note::
The following steps assume that you chose to install and work with
Poetry.
#. Install Pre-Commit:
.. code-block:: shell
poetry run pre-commit install
This will ensure during development that each of your commits is properly
formatted against our linter and formatters, ``black``, ``flake8``,
``isort`` and ``codespell``.
You are now ready to work on Manim!
Develop your contribution
-------------------------
#. Checkout your local repository's main branch and pull the latest
changes from ManimCommunity, ``upstream``, into your local repository:
.. code-block:: shell
git checkout main
git pull --rebase upstream main
#. Create a branch for the changes you want to work on rather than working
off of your local main branch:
.. code-block:: shell
git checkout -b <new branch name> upstream/main
This ensures you can easily update your local repository's main with the
first step and switch branches to work on multiple features.
#. Write some awesome code!
You're ready to make changes in your local repository's branch.
You can add local files you've changed within the current directory with
``git add .``, or add specific files with
.. code-block:: shell
git add <file/directory>
and commit these changes to your local history with ``git commit``. If you
have installed pre-commit, your commit will succeed only if none of the
hooks fail.
.. tip::
When crafting commit messages, it is highly recommended that
you adhere to `these guidelines <https://www.conventionalcommits.org/en/v1.0.0/>`_.
#. Add new or update existing tests.
Depending on your changes, you may need to update or add new tests. For new
features, it is required that you include tests with your PR. Details of
our testing system are explained in the :doc:`testing guide <testing>`.
#. Update docstrings and documentation:
Update the docstrings (the text in triple quotation marks) of any functions
or classes you change and include them with any new functions you add.
See the :doc:`documentation guide <docstrings>` for more information about how we
prefer our code to be documented. The content of the docstrings will be
rendered in the :doc:`reference manual <../reference>`.
.. tip::
Use the :mod:`manim directive for Sphinx <manim.utils.docbuild.manim_directive>` to add examples
to the documentation!
As far as development on your local machine goes, these are the main steps you
should follow.
Polishing Changes and Submitting a Pull Request
-----------------------------------------------
As soon as you are ready to share your local changes with the community
so that they can be discussed, go through the following steps to open a
pull request. A pull request signifies to the ManimCommunity organization,
"Here are some changes I wrote; I think it's worthwhile for you to maintain
them."
.. note::
You do not need to have everything (code/documentation/tests) complete
to open a pull request (PR). If the PR is still under development, please
mark it as a draft. Community developers will still be able to review the
changes, discuss yet-to-be-implemented changes, and offer advice; however,
the more complete your PR, the quicker it will be merged.
#. Update your fork on GitHub to reflect your local changes:
.. code-block:: shell
git push -u origin <branch name>
Doing so creates a new branch on your remote fork, ``origin``, with the
contents of your local repository on GitHub. In subsequent pushes, this
local branch will track the branch ``origin`` and ``git push`` is enough.
#. Make a pull request (PR) on GitHub.
In order to make the ManimCommunity development team aware of your changes,
you can make a PR to the ManimCommunity repository from your fork.
.. WARNING::
Make sure to select ``ManimCommunity/manim`` instead of ``3b1b/manim``
as the base repository!
Choose the branch from your fork as the head repository - see the
screenshot below.
.. image:: /_static/pull-requests.png
:align: center
Please make sure you follow the template (this is the default
text you are shown when first opening the 'New Pull Request' page).
Your changes are eligible to be merged if:
#. there are no merge conflicts
#. the tests in our pipeline pass
#. at least one (two for more complex changes) Community Developer approves the changes
You can check for merge conflicts between the current upstream/main and
your branch by executing ``git pull upstream main`` locally. If this
generates any merge conflicts, you need to resolve them and push an
updated version of the branch to your fork of the repository.
Our pipeline consists of a series of different tests that ensure
that Manim still works as intended and that the code you added
sticks to our coding conventions.
- **Code style**: We use the code style imposed
by `Black <https://black.readthedocs.io/en/stable/>`_, `isort <https://pycqa.github.io/isort/>`_
and `flake8 <https://flake8.pycqa.org/en/latest/>`_. The GitHub pipeline
makes sure that the (Python) files changed in your pull request
also adhere to this code style. If this step of the pipeline fails,
fix your code formatting automatically by running ``black <file or directory>`` and ``isort <file or directory>``.
To fix code style problems, run ``flake8 <file or directory>`` for a style report, and then fix the problems
manually that were detected by ``flake8``.
- **Tests**: The pipeline runs Manim's test suite on different operating systems
(the latest versions of Ubuntu, macOS, and Windows) for different versions of Python.
The test suite consists of two different kinds of tests: integration tests
and doctests. You can run them locally by executing ``poetry run pytest``
and ``poetry run pytest --doctest-modules manim``, respectively, from the
root directory of your cloned fork.
- **Documentation**: We also build a version of the documentation corresponding
to your pull request. Make sure not to introduce any Sphinx errors, and have
a look at the built HTML files to see whether the formatting of the documentation
you added looks as you intended. You can build the documentation locally
by running ``make html`` from the ``docs`` directory. Make sure you have `Graphviz <https://graphviz.org/>`_
installed locally in order to build the inheritance diagrams.
Finally, if the pipeline passes and you are satisfied with your changes: wait for
feedback and iterate over any requested changes. You will likely be asked to
edit or modify your PR in one way or another during this process. This is not
an indictment of your work, but rather a strong signal that the community
wants to merge your changes! Once approved, your changes may be merged!
Further useful guidelines
=========================
#. When submitting a PR, please mention explicitly if it includes breaking changes.
#. When submitting a PR, make sure that your proposed changes are as general as
possible, and ready to be taken advantage of by all of Manim's users. In
particular, leave out any machine-specific configurations, or any personal
information it may contain.
#. If you are a maintainer, please label issues and PRs appropriately and
frequently.
#. When opening a new issue, if there are old issues that are related, add a link
to them in your new issue (even if the old ones are closed).
#. When submitting a code review, it is highly recommended that you adhere to
`these general guidelines <https://conventionalcomments.org/>`_.
#. If you find stale or inactive issues that seem to be irrelevant, please post
a comment saying 'This issue should be closed', and a community developer
will take a look.
#. Please do as much as possible to keep issues, PRs, and development in
general as tidy as possible.
You can find examples for the ``docs`` in several places:
the :doc:`Example Gallery <../examples>`, :doc:`Tutorials <../tutorials/index>`,
and :doc:`Reference Classes <../reference>`.
**Thank you for contributing!**

View file

@ -0,0 +1,84 @@
====================
Adding Documentation
====================
Building the documentation
--------------------------
When you clone the Manim repository from GitHub, you can access the
``docs/`` folder which contains the necessary files to build the
documentation.
To build the docs locally, open a CLI, enter the ``docs/`` folder with the
``cd`` command and execute the following depending on your OS:
- Windows: ``./make.bat html``
- macOS and Linux: ``make html``
The first time you build the docs, the process will take several
minutes because it needs to generate all the ``.rst`` (reST:
reStructured Text) files from scratch by reading and parsing all the
Manim content. The process becomes much shorter the next time, as it
rebuilds only the parts which have changed.
Sphinx library and extensions
-----------------------------
Manim uses `Sphinx <https://www.sphinx-doc.org>`_ for building the
docs. It also makes use of Sphinx extensions such as:
- `Autodoc: <https://www.sphinx-doc.org/en/master/usage/extensions/autodoc.html>`_
imports Manim's Python source code, extracts its docstrings and
generates documentation from them.
- `Autosummary: <https://www.sphinx-doc.org/en/master/usage/extensions/autosummary.html>`_
a complement to Autodoc which adds a special directive ``autosummary``,
used in Manim to automatically document classes, methods,
attributes, functions, module-level variables and exceptions.
Autosummary makes use of `Jinja templates <https://jinja.palletsprojects.com/templates/>`_,
which Manim defines for autosummarizing classes and modules
inside ``docs/source/_templates/``.
- `Graphviz extension for Sphinx: <https://www.sphinx-doc.org/en/master/usage/extensions/graphviz.html>`_
embeds graphs generated by the `Graphviz <https://graphviz.org/>`_
module, which must be installed in order to render the
inheritance diagrams in the :doc:`/reference`.
- `Napoleon: <https://www.sphinx-doc.org/en/master/usage/extensions/napoleon.html>`_
enables Sphinx to read Google style docstrings and, in
particular for Manim, `NumPy style docstrings <https://numpydoc.readthedocs.io/en/latest/format.html>`_
- see :doc:`docs/docstrings` for more information.
Sphinx theme
------------
The theme used for this website is `Furo <https://sphinx-themes.org/sample-sites/furo/>`_.
Custom Sphinx directives
------------------------
Manim implements **custom directives** for use with Autodoc and Autosummary, which
are defined in :mod:`~.docbuild`:
.. currentmodule:: manim.utils.docbuild
.. autosummary::
:toctree: ../reference
autoaliasattr_directive
autocolor_directive
manim_directive
Index
-----
.. toctree::
:maxdepth: 2
docs/admonitions
docs/docstrings
docs/examples
docs/references
docs/typings
docs/types

View file

@ -77,8 +77,7 @@ Example:
The mobject linked to this instance.
"""
def __init__(name: str, id: int, singleton: MyClass, mobj: Mobject = None):
...
def __init__(name: str, id: int, singleton: MyClass, mobj: Mobject = None): ...
2. The usage of ``Parameters`` on functions to specify how
every parameter works and what it does. This should be excluded if

View file

@ -0,0 +1,147 @@
===================
Choosing Type Hints
===================
In order to provide the best user experience,
it's important that type hints are chosen correctly.
With the large variety of types provided by Manim, choosing
which one to use can be difficult. This guide aims to
aid you in the process of choosing the right type for the scenario.
The first step is figuring out which category your type hint fits into.
Coordinates
-----------
Coordinates encompass two main categories: points, and vectors.
Points
~~~~~~
The purpose of points is pretty straightforward: they represent a point
in space. For example:
.. code-block:: python
def print_point2D(coord: Point2DLike) -> None:
x, y = coord
print(f"Point at {x=},{y=}")
def print_point3D(coord: Point3DLike) -> None:
x, y, z = coord
print(f"Point at {x=},{y=},{z=}")
def print_point_array(coords: Point2DLike_Array | Point3DLike_Array) -> None:
for coord in coords:
if len(coord) == 2:
# it's a Point2DLike
print_point2D(coord)
else:
# it's a Point3DLike
print_point3D(coord)
def shift_point_up(coord: Point3DLike) -> Point3D:
result = np.asarray(coord)
result += UP
print(f"New point: {result}")
return result
Notice that the last function, ``shift_point_up()``, accepts a
:class:`~.Point3DLike` as a parameter and returns a :class:`~.Point3D`. A
:class:`~.Point3D` always represents a NumPy array consisting of 3 floats,
whereas a :class:`~.Point3DLike` can represent anything resembling a 3D point:
either a NumPy array or a tuple/list of 3 floats, hence the ``Like`` word. The
same happens with :class:`~.Point2D`, :class:`~.Point2D_Array` and
:class:`~.Point3D_Array`, and their ``Like`` counterparts
:class:`~.Point2DLike`, :class:`~.Point2DLike_Array` and
:class:`~.Point3DLike_Array`.
The rule for typing functions is: **make parameter types as broad as possible,
and return types as specific as possible.** Therefore, for functions which are
intended to be called by users, **we should always, if possible, accept**
``Like`` **types as parameters and return NumPy, non-** ``Like`` **types.** The
main reason is to be more flexible with users who might want to pass tuples or
lists as arguments rather than NumPy arrays, because it's more convenient. The
last function, ``shift_point_up()``, is an example of it.
Internal functions which are *not* meant to be called by users may accept
non-``Like`` parameters if necessary.
Vectors
~~~~~~~
Vectors share many similarities to points. However, they have a different
connotation. Vectors should be used to represent direction. For example,
consider this slightly contrived function:
.. code-block:: python
M = TypeVar("M", bound=Mobject) # allow any mobject
def shift_mobject(mob: M, direction: Vector3D, scale_factor: float = 1) -> M:
return mob.shift(direction * scale_factor)
Here we see an important example of the difference. ``direction`` should not be
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` or
:class:`~.VectorNDLike`.
Colors
------
The interface Manim provides for working with colors is :class:`.ManimColor`.
The main color types Manim supports are RGB, RGBA, and HSV. You will want
to add type hints to a function depending on which type it uses. If any color will work,
you will need something like:
.. code-block:: python
if TYPE_CHECKING:
from manim.utils.color import ParsableManimColor
# type hint stuff with ParsableManimColor
Béziers
-------
Manim internally represents a :class:`.Mobject` by a collection of points. In the case of :class:`.VMobject`,
the most commonly used subclass of :class:`.Mobject`, these points represent Bézier curves,
which are a way of representing a curve using a sequence of points.
.. note::
To learn more about Béziers, take a look at https://pomax.github.io/bezierinfo/
Manim supports two different renderers, which each have different representations of
Béziers: Cairo uses cubic Bézier curves, while OpenGL uses quadratic Bézier curves.
Type hints like :class:`~.typing.BezierPoints` represent a single bezier curve, and :class:`~.typing.BezierPath`
represents multiple Bézier curves. A :class:`~.typing.Spline` is when the Bézier curves in a :class:`~.typing.BezierPath`
forms a single connected curve. Manim also provides more specific type aliases when working with
quadratic or cubic curves, and they are prefixed with their respective type (e.g. :class:`~.typing.CubicBezierPoints`,
is a :class:`~.typing.BezierPoints` consisting of exactly 4 points representing a cubic Bézier curve).
Functions
---------
Throughout the codebase, many different types of functions are used. The most obvious example
is a rate function, which takes in a float and outputs a float (``Callable[[float], float]``).
Another example is for overriding animations. One will often need to map a :class:`.Mobject`
to an overridden :class:`.Animation`, and for that we have the :class:`~.typing.FunctionOverride` type hint.
:class:`~.typing.PathFuncType` and :class:`~.typing.MappingFunction` are more niche, but are related to moving objects
along a path, or applying functions. If you need to use it, you'll know.
Images
------
There are several representations of images in Manim. The most common is
the representation as a NumPy array of floats representing the pixels of an image.
This is especially common when it comes to the OpenGL renderer.
This is the use case of the :class:`~.typing.PixelArray` type hint. Sometimes, Manim may use ``PIL.Image.Image``,
which is not the same as :class:`~.typing.PixelArray`. In this case, use the ``PIL.Image.Image`` typehint.
Of course, if a more specific type of image is needed, it can be annotated as such.

View file

@ -0,0 +1,148 @@
==================
Typing Conventions
==================
.. warning::
This section is still a work in progress.
Adding type hints to functions and parameters
---------------------------------------------
Manim is currently in the process of adding type hints into the library. In this
section, you will find information about the standards used and some general
guidelines.
If you've never used type hints before, this is a good place to get started:
https://realpython.com/python-type-checking/#hello-types.
Typing standards
~~~~~~~~~~~~~~~~
Manim uses `mypy`_ to type check its codebase. You will find a list of configuration values in the ``mypy.ini`` configuration file.
To be able to use the newest typing features not available in the lowest
supported Python version, make use of `typing_extensions`_.
To be able to use the new Union syntax (``|``) and builtins subscripting, use
the ``from __future__ import annotations`` import.
.. _mypy: https://mypy-lang.org/
.. _typing_extensions: https://pypi.org/project/typing-extensions/
Typing guidelines
~~~~~~~~~~~~~~~~~
* Manim has a dedicated :mod:`~.typing` module where type aliases are provided.
Most of them may seem redundant, in particular the ones related to ``numpy``.
This is in anticipation of the support for shape type hinting
(`related issue <https://github.com/numpy/numpy/issues/16544>`_). Besides the
pending shape support, using the correct type aliases will help users understand
which shape should be used.
* For typings of generic collections, check out `this <https://docs.python.org/3/library/collections.abc.html#collections-abstract-base-classes>`_
link.
* Always use a type hint of ``None`` for functions that does not return
a value (this also applies to ``__init__``), e.g.:
.. code:: py
def height(self, value) -> None:
self.scale_to_fit_height(value)
* For variables representing paths, use the ``StrPath`` or ``StrOrBytesPath``
type alias defined in the :mod:`~.typing` module.
* ``*args`` and ``**kwargs`` shouldn't be left untyped (in most cases you can
use ``Any``).
* Following `PEP 484 <https://peps.python.org/pep-0484/#the-numeric-tower>`_,
use ``float`` instead of ``int | float``.
* Use ``x | y`` instead of ``Union[x, y]``
* Mobjects have the typehint ``Mobject``, e.g.:
.. code:: py
def match_color(self, mobject: "Mobject"):
"""Match the color with the color of another :class:`~.Mobject`."""
return self.set_color(mobject.get_color())
* Always parametrize generics (``list[int]`` instead of ``list``,
``type[Any]`` instead of ``type``, etc.). This also applies to callables.
.. code:: py
rate_func: Callable[[float], float] = lambda t: smooth(1 - t)
* Use ``TypeVar`` when you want to "link" type hints as being the same type.
Consider ``Mobject.copy``, which returns a new instance of the same class.
It would be type-hinted as:
.. code:: py
T = TypeVar("T")
def copy(self: T) -> T: ...
* Use ``typing.Iterable`` whenever the function works with *any* iterable, not a specific type.
* Prefer ``numpy.typing.NDArray`` over ``numpy.ndarray``
.. code:: py
import numpy as np
if TYPE_CHECKING:
import numpy.typing as npt
def foo() -> npt.NDArray[float]:
return np.array([1, 0, 1])
* If a method returns ``self``, use ``typing_extensions.Self``.
.. code:: py
if TYPE_CHECKING:
from typing_extensions import Self
class CustomMobject:
def set_color(self, color: ManimColor) -> Self:
...
return self
* If the function returns a container of a specific length each time, consider using ``tuple`` instead of ``list``.
.. code:: py
def foo() -> tuple[float, float, float]:
return (0, 0, 0)
* If a function works with a parameter as long as said parameter has a ``__getitem__``, ``__iter___`` and ``__len__`` method,
the typehint of the parameter should be ``collections.abc.Mapping``. If it also supports ``__setitem__`` and/or ``__delitem__``, it
should be marked as ``collections.abc.MutableMapping``.
* Typehinting something as ``object`` means that only attributes available on every Python object should be accessed,
like ``__str__`` and so on. On the other hand, literally any attribute can be accessed on a variable with the ``Any`` typehint -
it's more freeing than the ``object`` typehint, and makes mypy stop typechecking the variable. Note that whenever possible,
try to keep typehints as specific as possible.
* If objects are imported purely for type hint purposes, keep it under an ``if typing.TYPE_CHECKING`` guard, to prevent them from
being imported at runtime (helps library performance). Do not forget to use the ``from __future__ import annotations`` import to avoid having runtime ``NameError`` exceptions.
.. code:: py
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from manim.typing import Vector3D
# type stuff with Vector3D
Missing Sections for typehints are:
-----------------------------------
* Mypy and numpy import errors: https://realpython.com/python-type-checking/#running-mypy
* Explain ``mypy.ini`` (see above link)

View file

@ -28,7 +28,7 @@ Contributing
That being said, improving the documentation and making it more accessible is still highly encouraged.
And even if your work gets outdated and requires change, you or someone else can simply adjust the translation.
Your efforts are not in vail!
Your efforts are not in vain!
Voting

View file

@ -5,6 +5,24 @@ If you are adding new features to manim, you should add appropriate tests for th
manim from breaking at each change by checking that no other
feature has been broken and/or been unintentionally modified.
.. warning::
The full tests suite requires Cairo 1.18 in order to run all tests.
However, Cairo 1.18 may not be available from your package manager,
like ``apt``, and it is very likely that you have an older version installed,
e.g., 1.16. If you run tests with a version prior to 1.18,
many tests will be skipped. Those tests are not skipped in the online CI.
If you want to run all tests locally, you need to install Cairo 1.18 or above.
You can do so by compiling Cairo from source:
1. download ``cairo-1.18.0.tar.xz`` from
`here <https://www.cairographics.org/releases/>`_.
and uncompress it;
2. open the INSTALL file and follow the instructions (you might need to install
``meson`` and ``ninja``);
3. run the tests suite and verify that the Cairo version is correct.
How Manim tests
---------------

View file

@ -1,81 +0,0 @@
==============
Adding Typings
==============
.. warning::
This section is still a work in progress.
Adding type hints to functions and parameters
---------------------------------------------
Manim is currently in the process of adding type hints into the library. In this
section, you will find information about the standards used and some general
guidelines.
If you've never used type hints before, this is a good place to get started:
https://realpython.com/python-type-checking/#hello-types.
Typing standards
~~~~~~~~~~~~~~~~
Manim uses `mypy`_ to type check its codebase. You will find a list of
configuration values in the ``mypy.ini`` configuration file.
To be able to use the newest typing features not available in the lowest
supported Python version, make use of `typing_extensions`_.
To be able to use the new Union syntax (``|``) and builtins subscripting, use
the ``from __future__ import annotations`` import.
.. _mypy: https://mypy-lang.org/
.. _typing_extensions: https://pypi.org/project/typing-extensions/
Typing guidelines
~~~~~~~~~~~~~~~~~
* Manim has a dedicated :mod:`~.typing` module where type aliases are provided.
Most of them may seem redundant, in particular the ones related to ``numpy``.
This is in anticipation of the support for shape type hinting
(`related issue <https://github.com/numpy/numpy/issues/16544>`_). Besides the
pending shape support, using the correct type aliases will help users understand
which shape should be used.
* Always use a type hint of ``None`` for functions that does not return
a value (this also applies to ``__init__``), e.g.:
.. code:: py
def height(self, value) -> None:
self.scale_to_fit_height(value)
* For variables representing paths, use the ``StrPath`` or ``StrOrBytesPath``
type alias defined in the :mod:`~.typing` module.
* ``*args`` and ``**kwargs`` shouldn't be left untyped (in most cases you can
use ``Any``).
* Following `PEP 484 <https://peps.python.org/pep-0484/#the-numeric-tower>`_,
use ``float`` instead of ``int | float``.
* Mobjects have the typehint ``Mobject``, e.g.:
.. code:: py
def match_color(self, mobject: "Mobject"):
"""Match the color with the color of another :class:`~.Mobject`."""
return self.set_color(mobject.get_color())
* Always parametrize generics (``list[int]`` instead of ``list``,
``type[Any]`` instead of ``type``, etc.). This also applies to callables:
.. code:: py
rate_func: Callable[[float], float] = lambda t: smooth(1 - t)
Missing Sections for typehints are:
-----------------------------------
* Mypy and numpy import errors: https://realpython.com/python-type-checking/#running-mypy
* When to use ``object`` vs ``Any``
* The use of a TypeVar on the type hints for ``copy()``.
* The definition and use of Protocols (like ``Sized``, ``Sequence``, ``Iterable``...)

View file

@ -90,11 +90,11 @@ Basic Concepts
[[i * 256 / n for i in range(0, n)] for _ in range(0, n)]
)
image = ImageMobject(imageArray).scale(2)
image.background_rectangle = SurroundingRectangle(image, GREEN)
image.background_rectangle = SurroundingRectangle(image, color=GREEN)
self.add(image, image.background_rectangle)
.. manim:: BooleanOperations
:ref_classes: Union Intersection Exclusion
:ref_classes: Union Intersection Exclusion Difference
class BooleanOperations(Scene):
def construct(self):
@ -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))
@ -341,7 +341,7 @@ Plotting with Manim
axes.i2gp(TAU, cos_graph), color=YELLOW, line_func=Line
)
line_label = axes.get_graph_label(
cos_graph, "x=2\pi", x_val=TAU, direction=UR, color=WHITE
cos_graph, r"x=2\pi", x_val=TAU, direction=UR, color=WHITE
)
plot = VGroup(axes, sin_graph, cos_graph, vert_line)
@ -482,7 +482,7 @@ Plotting with Manim
tips=False,
)
labels = ax.get_axis_labels(
x_label=Tex("$\Delta Q$"), y_label=Tex("T[$^\circ C$]")
x_label=Tex(r"$\Delta Q$"), y_label=Tex(r"T[$^\circ C$]")
)
x_vals = [0, 8, 38, 39]
@ -785,8 +785,8 @@ Advanced Projects
def add_x_labels(self):
x_labels = [
MathTex("\pi"), MathTex("2 \pi"),
MathTex("3 \pi"), MathTex("4 \pi"),
MathTex(r"\pi"), MathTex(r"2 \pi"),
MathTex(r"3 \pi"), MathTex(r"4 \pi"),
]
for i in range(len(x_labels)):

View file

@ -120,19 +120,24 @@ of [ManimPango's README](https://github.com/ManimCommunity/ManimPango).
---
(not-on-path)=
## I am using Windows and get the error `X is not recognized as an internal or external command, operable program or batch file`
Regardless of whether `X` says `python` or `manim`, this means that the executable you
are trying to run is not located in one of the directories your system is looking
for them (specified by the `PATH` variable). Take a look at the instructions
{doc}`in the installation guide for Windows </installation/windows>`, or
[this StackExchange answer](https://superuser.com/questions/143119/how-do-i-add-python-to-the-windows-path/143121#143121)
to get help with editing the `PATH` variable manually.
If you have followed {doc}`our local installation instructions </installation/uv>` and
have not activated the corresponding virtual environment, make sure to use `uv run manim ...`
instead of just `manim` (or activate the virtual environment by following the instructions
printed when running `uv venv`).
If `python` is recognized but not `manim` or `pip`, you can try running
Otherwise there is a problem with the directories where your system is looking for
executables (the `PATH` variable).
If `python` is recognized, you can try running
commands by prepending `python -m`. That is, `manim` becomes `python -m manim`,
and `pip` becomes `python -m pip`.
Otherwise see
[this StackExchange answer](https://superuser.com/questions/143119/how-do-i-add-python-to-the-windows-path/143121#143121)
to get help with editing the `PATH` variable manually.
---
## I have tried using Chocolatey (`choco install manimce`) to install Manim, but it failed!

View file

@ -8,7 +8,7 @@ or specific OpenGL classes like `OpenGLSurface`, but documentation for some of
them is available in form of docstrings
[in the source code](https://github.com/ManimCommunity/manim/tree/main/manim/mobject/opengl).
Furthermore, [this user guide by *aquabeam*](https://www.aquabeam.me/manim/opengl_guide/)
Furthermore, [this user guide by *aquabeam*](https://web.archive.org/web/20250708135737/https://www.aquabeam.me/manim/opengl_guide/)
can be helpful to get started using the OpenGL renderer.
---

View file

@ -38,6 +38,7 @@ and then record it during rendering:
from manim_voiceover import VoiceoverScene
from manim_voiceover.services.recorder import RecorderService
# Simply inherit from VoiceoverScene instead of Scene to get all the
# voiceover functionality.
class RecorderExample(VoiceoverScene):

View file

@ -266,7 +266,7 @@ The scene then asks its renderer to initialize the scene by calling
Inspecting both the default Cairo renderer and the OpenGL renderer shows that the ``init_scene``
method effectively makes the renderer instantiate a :class:`.SceneFileWriter` object, which
basically is Manim's interface to ``ffmpeg`` and actually writes the movie file. The Cairo
basically is Manim's interface to ``libav`` (FFMPEG) and actually writes the movie file. The Cairo
renderer (see the implementation `here <https://github.com/ManimCommunity/manim/blob/main/manim/renderer/cairo_renderer.py>`__) does not require any further initialization. The OpenGL renderer
does some additional setup to enable the realtime rendering preview window, which we do not go
into detail further here.
@ -310,8 +310,8 @@ the order they are called, these customizable methods are:
After these three methods are run, the animations have been fully rendered,
and Manim calls :meth:`.CairoRenderer.scene_finished` to gracefully
complete the rendering process. This checks whether any animations have been
played -- and if so, it tells the :class:`.SceneFileWriter` to close the pipe
to ``ffmpeg``. If not, Manim assumes that a static image should be output
played -- and if so, it tells the :class:`.SceneFileWriter` to close the output
file. If not, Manim assumes that a static image should be output
which it then renders using the same strategy by calling the render loop
(see below) once.
@ -577,7 +577,7 @@ sound odd at first. Practically, this ensures that mobjects are not
added twice, as mentioned above: if they were present in the scene
``Scene.mobjects`` list before (even if they were contained as a
child of some other mobject), they are first removed from the list.
The way :meth:`.Scene.restrucutre_mobjects` works is rather aggressive:
The way :meth:`.Scene.restructure_mobjects` works is rather aggressive:
It always operates on a given list of mobjects; in the ``add`` method
two different lists occur: the default one, ``Scene.mobjects`` (no extra
keyword argument is passed), and ``Scene.moving_mobjects`` (which we will
@ -762,10 +762,10 @@ to learn more, the :func:`.get_hash_from_play_call` function in the
mechanism.
In the event that the animation has to be rendered, the renderer asks
its :class:`.SceneFileWriter` to start a writing process. The process
is started by a call to ``ffmpeg`` and opens a pipe to which rendered
raw frames can be written. As long as the pipe is open, the process
can be accessed via the ``writing_process`` attribute of the file writer.
its :class:`.SceneFileWriter` to open an output container. The process
is started by a call to ``libav`` and opens a container to which rendered
raw frames can be written. As long as the output is open, the container
can be accessed via the ``output_container`` attribute of the file writer.
With the writing process in place, the renderer then asks the scene
to "begin" the animations.
@ -815,7 +815,7 @@ time is extracted (3 seconds long) and stored in
skip (it should not), then whether the animation is already
cached (it is not). The corresponding animation hash value is
determined and passed to the file writer, which then also calls
``ffmpeg`` to start the writing process which waits for rendered
``libav`` to start the writing process which waits for rendered
frames from the library.
The scene then ``begin``\ s the animation: for the
@ -1001,7 +1001,7 @@ and :meth:`.Animation.clean_up_from_scene` methods are called.
In the end, the time progression is closed (which completes the displayed progress bar)
in the terminal. With the closing of the time progression, the
:meth:`.Scene.play_internal` call is completed, and we return to the renderer,
which now orders the :class:`.SceneFileWriter` to close the movie pipe that has
which now orders the :class:`.SceneFileWriter` to close the output container that has
been opened for this animation: a partial movie file is written.
This pretty much concludes the walkthrough of a :class:`.Scene.play` call,

View file

@ -2,17 +2,24 @@
Rendering Text and Formulas
###########################
There are two different ways by which you can render **Text** in videos:
There are three different ways by which you can render **Text** in videos:
1. Using Pango (:mod:`~.text_mobject`)
2. Using LaTeX (:mod:`~.tex_mobject`)
3. Using Typst (:mod:`~.typst_mobject`)
If you want to render simple text, you should use either :class:`~.Text` or
:class:`~.MarkupText`, or one of its derivatives like :class:`~.Paragraph`.
Manim's Pango-based text classes include :class:`~.Text`,
:class:`~.MarkupText`, and derivatives such as :class:`~.Paragraph`.
See :ref:`using-text-objects` for more information.
LaTeX should be used when you need mathematical typesetting. See
:ref:`rendering-with-latex` for more information.
LaTeX rendering is available via :class:`~.Tex` and
:class:`~.MathTex`. See :ref:`rendering-with-latex` for more
information.
Typst support is available via :class:`~.Typst` and
:class:`~.TypstMath`. It offers both general markup and mathematical
typesetting through the Typst compiler without requiring a TeX
distribution. See :ref:`typst-mobjects` for more information.
.. _using-text-objects:
@ -50,7 +57,7 @@ For example:
)
self.add(text)
.. _Pango library: https://pango.gnome.org
.. _Pango library: https://pango.org
Working with :class:`~.Text`
============================
@ -291,6 +298,54 @@ and further references about PangoMarkup.
)
self.add(text)
.. _rendering-with-typst:
Text With Typst
***************
Manim also supports rendering text and formulas with Typst via
:class:`~.Typst` and :class:`~.TypstMath`.
.. important::
Typst support requires the optional ``typst`` dependency. Install it with
``pip install manim[typst]``.
Typst mobjects compile Typst markup directly to SVG and import the result as
vector graphics. This works both for general markup and for mathematical
expressions.
.. manim:: HelloTypst
:save_last_frame:
:ref_classes: Typst
class HelloTypst(Scene):
def construct(self):
text = Typst(r"*Hello* from _Typst!_", font_size=96)
self.add(text)
For mathematical expressions, use :class:`~.TypstMath`:
.. manim:: HelloTypstMath
:save_last_frame:
:ref_classes: TypstMath
class HelloTypstMath(Scene):
def construct(self):
equation = TypstMath(r"sum_(k=1)^n k = (n(n + 1)) / 2", font_size=72)
self.add(equation)
Typst also supports selecting subexpressions via labels in the Typst source,
or via Manim's ``{{ ... }}`` shorthand in :class:`~.TypstMath`:
.. code-block:: python
eq = TypstMath("{{ a + b : lhs }} = {{ c }}")
eq.select("lhs").set_color(BLUE)
eq.select(0).set_color(YELLOW)
See :ref:`typst-mobjects` for more details and additional examples.
.. _rendering-with-latex:
Text With LaTeX
@ -389,8 +444,9 @@ Substrings and parts
The TeX mobject can accept multiple strings as arguments. Afterwards you can
refer to the individual parts either by their index (like ``tex[1]``), or by
selecting parts of the tex code. In this example, we set the color
of the ``\bigstar`` using :func:`~.set_color_by_tex`:
using :func:`~.set_color_by_tex`, which matches the argument exactly against
the strings passed to the constructor. In this example, we color the
``\bigstar`` part:
.. manim:: LaTeXSubstrings
:save_last_frame:
@ -398,25 +454,13 @@ of the ``\bigstar`` using :func:`~.set_color_by_tex`:
class LaTeXSubstrings(Scene):
def construct(self):
tex = Tex('Hello', r'$\bigstar$', r'\LaTeX', font_size=144)
tex.set_color_by_tex('igsta', RED)
tex.set_color_by_tex(r'$\bigstar$', RED)
self.add(tex)
Note that :func:`~.set_color_by_tex` colors the entire substring containing
the Tex, not just the specific symbol or Tex expression. Consider the following example:
.. manim:: IncorrectLaTeXSubstringColoring
:save_last_frame:
class IncorrectLaTeXSubstringColoring(Scene):
def construct(self):
equation = MathTex(
r"e^x = x^0 + x^1 + \frac{1}{2} x^2 + \frac{1}{6} x^3 + \cdots + \frac{1}{n!} x^n + \cdots"
)
equation.set_color_by_tex("x", YELLOW)
self.add(equation)
As you can see, this colors the entire equation yellow, contrary to what
may be expected. To color only ``x`` yellow, we have to do the following:
Because :func:`~.set_color_by_tex` requires an exact match, it cannot directly
target a token inside a string that was passed as a single argument. To color
every ``x`` in a formula, use ``substrings_to_isolate`` to split the string at
each occurrence first:
.. manim:: CorrectLaTeXSubstringColoring
:save_last_frame:
@ -424,25 +468,33 @@ may be expected. To color only ``x`` yellow, we have to do the following:
class CorrectLaTeXSubstringColoring(Scene):
def construct(self):
equation = MathTex(
r"e^x = x^0 + x^1 + \frac{1}{2} x^2 + \frac{1}{6} x^3 + \cdots + \frac{1}{n!} x^n + \cdots",
r"e^{x} = x^0 + x^1 + \frac{1}{2} x^2 + \frac{1}{6} x^3 + \cdots + \frac{1}{n!} x^n + \cdots",
substrings_to_isolate="x"
)
equation.set_color_by_tex("x", YELLOW)
self.add(equation)
By setting ``substrings_to_isolate`` to ``x``, we split up the
:class:`~.MathTex` into substrings automatically and isolate the ``x`` components
into individual substrings. Only then can :meth:`~.set_color_by_tex` be used
to achieve the desired result.
Each isolated occurrence of ``x`` becomes its own sub-mobject that
:meth:`~.set_color_by_tex` can match exactly.
If one of the ``substrings_to_isolate`` is in a sub or superscript, it needs
to be enclosed by curly brackets.
Note that Manim also supports a custom syntax that allows splitting
a TeX string into substrings easily: simply enclose parts of your formula
that you want to isolate with double braces. In the string
``MathTex(r"{{ a^2 }} + {{ b^2 }} = {{ c^2 }}")``, the rendered mobject
``MathTex(r"{{ a^2 }} + {{ b^2 }} = {{ c^2 }}")``, the rendered mobject
will consist of the substrings ``a^2``, ``+``, ``b^2``, ``=``, and ``c^2``.
This makes transformations between similar text fragments easy
to write using :class:`~.TransformMatchingTex`.
For Manim to recognise a ``{{`` as a group opener, it must appear either
at the very start of the string or be immediately preceded by a whitespace
character. This means that ``{{`` embedded directly after non-whitespace
LaTeX — such as ``\frac{{{n}}}{k}`` or ``a^{{2}}`` — is left untouched,
which prevents accidental splitting of ordinary nested-brace expressions.
To stop a leading ``{{`` from being treated as a group opener, insert a
space between the two braces: ``{{ ... }}````{ { ... } }``.
Using ``index_labels`` to work with complicated strings
=======================================================

View file

@ -21,8 +21,11 @@ in the right place!
.. note::
Please be aware that there are different, incompatible versions
of Manim available. Check our :ref:`installation FAQ <different-versions>`
Please be aware that there are different, incompatible versions of Manim available.
This version, the Community Edition of Manim (`ManimCE <https://github.com/ManimCommunity/manim>`_),
is a separate project maintained by the community, but it was forked from `3b1b/manim <https://github.com/3b1b/manim>`_,
the original Manim created and open-sourced by Grant Sanderson, creator of `3Blue1Brown <https://www.youtube.com/channel/UCYO_jab_esuFRV4b17AJtAw>`_ educational math videos.
Check our :ref:`installation FAQ <different-versions>`
to learn more!
- The :doc:`Installation <installation>` section has the latest and
@ -30,7 +33,7 @@ in the right place!
You can also find information on Manim's docker images and (online)
notebook environments there.
- Want to try the library before installing it? Take a look at our
interactive online playground at https://try.manim.community in form
interactive online playground at https://try.manim.community in the form
of a Jupyter notebook.
- In our :doc:`Tutorials <tutorials/index>` section you will find a
collection of resources that will teach you how to use Manim. In particular,
@ -71,7 +74,7 @@ Here are some short summaries for all of the sections in this documentation:
can be found in the :doc:`FAQ </faq/index>` section.
- The :doc:`Reference Manual </reference>` contains a comprehensive list of all of Manim's
(documented) modules, classes, and functions. If you are somewhat familiar with Manim's
module structure feel free to browse the manual directly. If you are searching for
module structure, feel free to browse the manual directly. If you are searching for
something specific, feel free to use the documentation's search feature in the sidebar.
Many classes and methods come with their own illustrated examples too!
- The :doc:`Plugins </plugins>` page documents how to install, write, and distribute
@ -91,6 +94,21 @@ or `Discord <https://www.manim.community/discord/>`_. If you're using Manim in a
context, instructions on how to cite a particular release can be found
`in our README <https://github.com/ManimCommunity/manim/blob/main/README.md>`_.
License Information
-------------------
Manim is an open-source library licensed under the **MIT License**, which applies to both the
original and the community editions of the software. This means you are free to use, modify,
and distribute the code in accordance with the MIT License terms. However, there are some
additional points to be aware of:
- **Copyrighted Assets:** Specific assets, such as the "Pi creatures" in Grant Sanderson's
(3Blue1Brown) videos, are copyrighted and protected. Please avoid using these characters in
any derivative works.
- **Content Creation and Sharing:** Videos and animations created with Manim can be freely
shared, and no attribution to Manim is required—although it is much appreciated! You are
encouraged to showcase your work online and share it with the Manim community.
Index
-----

View file

@ -8,8 +8,8 @@ require no local installation. Head over to
https://try.manim.community to give our interactive tutorial a try.
Otherwise, if you intend to use Manim to work on an animation project,
we recommend installing the library locally (either to a conda environment,
your system's Python, or via Docker).
we recommend installing the library locally (preferably to some isolated
virtual Python environment, or a conda-like environment, or via Docker).
.. warning::
@ -19,26 +19,52 @@ your system's Python, or via Docker).
versions <different-versions>` if you are unsure which
version you should install.
#. :ref:`(Recommended) Installing Manim via Python's package manager pip
<local-installation>`
#. :ref:`Installing Manim to a conda environment <conda-installation>`
#. :ref:`Installing Manim to your system's Python <local-installation>`
#. :ref:`Using Manim via Docker <docker-installation>`
#. :ref:`Interactive Jupyter notebooks via Binder / Google Colab
<interactive-online>`
.. _local-installation:
Installing Manim locally via pip
********************************
The recommended way of installing Manim is by using Python's package manager
pip. If you already have a Python environment set up, you can simply run
``pip install manim`` to install the library.
Our :doc:`local installation guide <installation/uv>` provides more detailed
instructions, including best practices for setting up a suitable local environment.
.. toctree::
:hidden:
installation/uv
.. _conda-installation:
Installing Manim in conda
*************************
Installing Manim via Conda and related environment managers
***********************************************************
Conda is a package manager for Python that allows creating environments
where all your dependencies are stored. Like this, you don't clutter up your PC with
unwanted libraries and you can just delete the environment when you don't need it anymore.
It is a good way to install manim since all dependencies like
``ffmpeg``, ``pycairo``, etc. come with it.
It is a good way to install manim since all dependencies like ``pycairo``, etc. come with it.
Also, the installation steps are the same, no matter if you are
on Windows, Linux, Intel Macs or on Apple Silicon.
.. NOTE::
There are various popular alternatives to Conda like
`mamba <https://mamba.readthedocs.io/en/latest/>`__ /
`micromamba <https://mamba.readthedocs.io/en/latest/user_guide/micromamba.html>`__,
or `pixi <https://pixi.sh>`__.
They all can be used to setup a suitable, isolated environment
for your Manim projects.
The following pages show how to install Manim in a conda environment:
.. toctree::
@ -47,47 +73,6 @@ The following pages show how to install Manim in a conda environment:
installation/conda
.. _local-installation:
Installing Manim locally
************************
Manim is a Python library, and it can be
`installed via pip <https://pypi.org/project/manim/>`__. However,
in order for Manim to work properly, some additional system
dependencies need to be installed first. The following pages have
operating system specific instructions for you to follow.
Manim requires Python version ``3.8`` or above to run.
.. hint::
Depending on your particular setup, the installation process
might be slightly different. Make sure that you have tried to
follow the steps on the following pages carefully, but in case
you hit a wall we are happy to help: either `join our Discord
<https://www.manim.community/discord/>`__, or start a new
Discussion `directly on GitHub
<https://github.com/ManimCommunity/manim/discussions>`__.
.. toctree::
:maxdepth: 2
installation/windows
installation/macos
installation/linux
Once Manim is installed locally, you can proceed to our
:doc:`quickstart guide <tutorials/quickstart>` which walks you
through rendering a first simple scene.
As mentioned above, do not worry if there are errors or other
problems: consult our :doc:`FAQ section </faq/index>` for help
(including instructions for how to ask Manim's community for help).
.. _docker-installation:
Using Manim via Docker
@ -131,6 +116,11 @@ If you're using Visual Studio Code you can install an extension called
of the animation inside the editor. The extension can be installed through the
`marketplace of VS Code <https://marketplace.visualstudio.com/items?itemName=Rickaym.manim-sideview>`__.
.. caution::
This extension is not officially maintained by the Manim Community.
If you run into issues, please report them to the extension's author.
Installation for developers
***************************

View file

@ -4,18 +4,31 @@ Conda
Required Dependencies
---------------------
To create a conda environment, you must first install
`conda <https://docs.conda.io/projects/conda/en/latest/user-guide/install/download.html>`__
or `mamba <https://mamba.readthedocs.io/en/latest/installation.html>`__,
the two most popular conda clients.
There are several package managers that work with conda packages,
namely `conda <https://docs.conda.io/projects/conda/en/latest/user-guide/install/download.html>`__,
`mamba <https://mamba.readthedocs.io>`__ and `pixi <https://pixi.sh>`__.
After installing conda, you can create a new environment and install ``manim`` inside by running
After installing your package manager, you can create a new environment and install ``manim`` inside by running
.. code-block:: bash
conda create -n my-manim-environment
conda activate my-manim-environment
conda install -c conda-forge manim
.. tab-set::
.. tab-item:: conda / mamba
.. code-block:: bash
# if you want to use mamba, just replace conda below with mamba
conda create -n my-manim-environment
conda activate my-manim-environment
conda install -c conda-forge manim
.. tab-item:: pixi
.. code-block:: bash
pixi init
pixi add manim
Since all dependencies (except LaTeX) are handled by conda, you don't need to worry
about needing to install additional dependencies.
@ -29,11 +42,8 @@ In order to make use of Manim's interface to LaTeX to, for example, render
equations, LaTeX has to be installed as well. Note that this is an optional
dependency: if you don't intend to use LaTeX, you don't have to install it.
You can install LaTeX by following the optional dependencies steps
for :ref:`Windows <win-optional-dependencies>`,
:ref:`Linux <linux-optional-dependencies>` or
:ref:`macOS <macos-optional-dependencies>`.
Recommendations on how to install LaTeX on different operating systems
can be found :doc:`in our local installation guide </installation/uv>`.
Working with Manim

View file

@ -18,6 +18,13 @@ For our image ``manimcommunity/manim``, there are the following tags:
``-p`` (preview file) and ``-f`` (show output file in the file browser)
are not supported.
.. note::
The Docker image ships with a minimal TeX Live installation. In particular,
``ctex`` is not installed by default. If your scenes rely on
``TexTemplateLibrary.ctex``, install it in the container via
``tlmgr install ctex``.
Basic usage of the Docker container
-----------------------------------
@ -45,7 +52,7 @@ modify to your liking. First, run
.. code-block:: sh
docker run -it --name my-manim-container -v "/full/path/to/your/directory:/manim" manimcommunity/manim /bin/bash
docker run -it --name my-manim-container -v "/full/path/to/your/directory:/manim" manimcommunity/manim bash
to obtain an interactive shell inside your container allowing you

View file

@ -66,12 +66,12 @@ then execute it.
.. code-block::
!sudo apt update
!sudo apt install libcairo2-dev ffmpeg \
!sudo apt install libcairo2-dev \
texlive texlive-latex-extra texlive-fonts-extra \
texlive-latex-recommended texlive-science \
tipa libpango1.0-dev
!pip install manim
!pip install IPython --upgrade
!pip install IPython==8.21.0
You should start to see Colab installing all the dependencies specified
in these commands. After the execution has completed, you will be prompted

View file

@ -1,171 +0,0 @@
Linux
=====
The installation instructions depend on your particular operating
system and package manager. If you happen to know exactly what you are doing,
you can also simply ensure that your system has:
- a reasonably recent version of Python 3 (3.8 or above),
- with working Cairo bindings in the form of
`pycairo <https://cairographics.org/pycairo/>`__,
- FFmpeg accessible from the command line as ``ffmpeg``,
- and `Pango <https://pango.gnome.org>`__ headers.
Then, installing Manim is just a matter of running:
.. code-block:: bash
pip3 install manim
.. note::
In light of the current efforts of migrating to rendering via OpenGL,
this list might be incomplete. Please `let us know
<https://github.com/ManimCommunity/manim/issues/new/choose>` if you
ran into missing dependencies while installing.
In any case, we have also compiled instructions for several common
combinations of operating systems and package managers below.
Required Dependencies
---------------------
apt Ubuntu / Mint / Debian
****************************
To first update your sources, and then install Cairo, Pango, and FFmpeg
simply run:
.. code-block:: bash
sudo apt update
sudo apt install build-essential python3-dev libcairo2-dev libpango1.0-dev ffmpeg
If you don't have python3-pip installed, install it via:
.. code-block:: bash
sudo apt install python3-pip
Then, to install Manim, run:
.. code-block:: bash
pip3 install manim
Continue by reading the :ref:`optional dependencies <linux-optional-dependencies>`
section.
dnf  Fedora / CentOS / RHEL
****************************
To install Cairo and Pango:
.. code-block:: bash
sudo dnf install cairo-devel pango-devel
In order to successfully build the ``pycairo`` wheel, you will also
need the Python development headers:
.. code-block:: bash
sudo dnf install python3-devel
FFmpeg is only available via the RPMfusion repository which you have to
configure first please consult https://rpmfusion.org/Configuration/ for
instructions. Then, install FFmpeg:
.. code-block:: bash
sudo dnf install ffmpeg
At this point you have all required dependencies and can install
Manim by running:
.. code-block:: bash
pip3 install manim
Continue by reading the :ref:`optional dependencies <linux-optional-dependencies>`
section.
pacman  Arch / Manjaro
***********************
.. tip::
Thanks to *groctel*, there is a `dedicated Manim package
on the AUR! <https://aur.archlinux.org/packages/manim/>`
If you don't want to use the packaged version from AUR, here is what
you need to do manually: Update your package sources, then install
Cairo, Pango, and FFmpeg:
.. code-block:: bash
sudo pacman -Syu
sudo pacman -S cairo pango ffmpeg
If you don't have ``python-pip`` installed, get it by running:
.. code-block:: bash
sudo pacman -S python-pip
then simply install Manim via:
.. code-block:: bash
pip3 install manim
Continue by reading the :ref:`optional dependencies <linux-optional-dependencies>`
section.
.. _linux-optional-dependencies:
Optional Dependencies
---------------------
In order to make use of Manim's interface to LaTeX for, e.g., rendering
equations, LaTeX has to be installed as well. Note that this is an optional
dependency: if you don't intend to use LaTeX, you don't have to install it.
You can use whichever LaTeX distribution you like or whichever is easiest
to install with your package manager. Usually,
`TeX Live <https://www.tug.org/texlive/>`__ is a good candidate if you don't
care too much about disk space.
For Debian-based systems (like Ubuntu), sufficient LaTeX dependencies can be
installed by running:
.. code-block:: bash
sudo apt install texlive texlive-latex-extra
For Fedora (see `docs <https://docs.fedoraproject.org/en-US/neurofedora/latex/>`__):
.. code-block:: bash
sudo dnf install texlive-scheme-full
Should you choose to work with some smaller TeX distribution like
`TinyTeX <https://yihui.org/tinytex/>`__ , the full list
of LaTeX packages which Manim interacts with in some way (a subset might
be sufficient for your particular application) is::
collection-basic amsmath babel-english cbfonts-fd cm-super ctex doublestroke
dvisvgm everysel fontspec frcursive fundus-calligra gnu-freefont jknapltx
latex-bin mathastext microtype ms physics preview ragged2e relsize rsfs
setspace standalone tipa wasy wasysym xcolor xetex xkeyval
Working with Manim
------------------
At this point, you should have a working installation of Manim, head
over to our :doc:`Quickstart Tutorial <../tutorials/quickstart>` to learn
how to make your own *Manimations*!

View file

@ -1,101 +0,0 @@
macOS
=====
For the sake of simplicity, the following instructions assume that you have
the popular `package manager Homebrew <https://brew.sh>`__ installed. While
you can certainly also install all dependencies without it, using Homebrew
makes the process much easier.
If you want to use Homebrew but do not have it installed yet, please
follow `Homebrew's installation instructions <https://docs.brew.sh/Installation>`__.
.. note::
For a while after Apple released its new ARM-based processors (the Apple Silicon chips like the *"M1 chip"*),
the recommended way of installing Manim relied on *Rosetta*, Apple's compatibility
layer between Intel and ARM architectures. This is no longer necessary, Manim can
(and is recommended to) be installed natively.
Required Dependencies
---------------------
To install all required dependencies for installing Manim (namely: ffmpeg, Python,
and some required Python packages), run:
.. code-block:: bash
brew install py3cairo ffmpeg
On *Apple Silicon* based machines (i.e., devices with the M1 chip or similar; if
you are unsure which processor you have check by opening the Apple menu, select
*About This Mac* and check the entry next to *Chip*), some additional dependencies
are required, namely:
.. code-block:: bash
brew install pango pkg-config scipy
After all required dependencies are installed, simply run:
.. code-block:: bash
pip3 install manim
to install Manim.
.. note::
A frequent source for installation problems is if ``pip3``
does not point to the correct Python installation on your system.
To check this, run ``pip3 -V``: for macOS Intel, the path should
start with ``/usr/local``, and for Apple Silicon with
``/opt/homebrew``. If this is not the case, you either forgot
to modify your shell profile (``.zprofile``) during the installation
of Homebrew, or did not reload your shell (e.g., by opening a new
terminal) after doing so. It is also possible that some other
software (like Pycharm) changed the ``PATH`` variable to fix this,
make sure that the Homebrew-related lines in your ``.zprofile`` are
at the very end of the file.
.. _macos-optional-dependencies:
Optional Dependencies
---------------------
In order to make use of Manim's interface to LaTeX for, e.g., rendering
equations, LaTeX has to be installed as well. Note that this is an optional
dependency: if you don't intend to use LaTeX, you don't have to install it.
For macOS, the recommended LaTeX distribution is
`MacTeX <http://www.tug.org/mactex/>`__. You can install it by following
the instructions from the link, or alternatively also via Homebrew by
running:
.. code-block:: bash
brew install --cask mactex-no-gui
.. warning::
MacTeX is a *full* LaTeX distribution and will require more than 4GB of
disk space. If this is an issue for you, consider installing a smaller
distribution like
`BasicTeX <http://www.tug.org/mactex/morepackages.html>`__.
Should you choose to work with some partial TeX distribution, the full list
of LaTeX packages which Manim interacts with in some way (a subset might
be sufficient for your particular application) is::
amsmath babel-english cbfonts-fd cm-super ctex doublestroke dvisvgm everysel
fontspec frcursive fundus-calligra gnu-freefont jknapltx latex-bin
mathastext microtype ms physics preview ragged2e relsize rsfs
setspace standalone tipa wasy wasysym xcolor xetex xkeyval
Working with Manim
------------------
At this point, you should have a working installation of Manim. Head
over to our :doc:`Quickstart Tutorial <../tutorials/quickstart>` to learn
how to make your own *Manimations*!

View file

@ -0,0 +1,341 @@
# Installing Manim locally
The standard way of installing Manim is by using
Python's package manager `pip` to install the latest
release from [PyPI](https://pypi.org/project/manim/).
To make it easier for you to follow best practices when it
comes to setting up a Python project for your Manim animations,
we strongly recommend using a tool for managing Python environments
and dependencies. In particular,
[we strongly recommend using `uv`](https://docs.astral.sh/uv/#getting-started).
For the two main ways of installing Manim described below, we assume
that `uv` is available; we think it is particularly helpful if you are
new to Python or programming in general. It is not a hard requirement
whatsoever; if you know what you are doing you can just use `pip` to
install Manim directly.
:::::{admonition} Installing the Python management tool `uv`
:class: seealso
One way to install `uv` is via the dedicated console installer supporting
all large operating systems. Simply paste the following snippet into
your terminal / PowerShell -- or
[consult `uv`'s documentation](https://docs.astral.sh/uv/#getting-started)
for alternative ways to install the tool.
::::{tab-set}
:::{tab-item} MacOS and Linux
```bash
curl -LsSf https://astral.sh/uv/install.sh | sh
```
:::
:::{tab-item} Windows
```powershell
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
```
:::
::::
:::::
Of course, if you know what you are doing and prefer to setup a virtual
environment yourself, feel free to do so!
:::{important}
If you run into issues when following our instructions below, do
not worry: check our [installation FAQs](<project:/faq/installation.md>) to
see whether the problem is already addressed there -- and otherwise go and
check [how to contact our community](<project:/faq/help.md>) to get help.
:::
## Installation
### Step 1: Installing Python
We first need to check that an appropriate version of Python is available
on your machine. Open a terminal to run
```bash
uv python install
```
to install the latest version of Python. If this is successful, continue
to the next step.
(installation-optional-latex)=
### Step 2 (optional): Installing LaTeX
[LaTeX](https://en.wikibooks.org/wiki/LaTeX/Mathematics) is a very well-known
and widely used typesetting system allowing you to write formulas like
\begin{equation*}
\frac{1}{2\pi i} \oint_{\gamma} \frac{f(z)}{(z - z_0)^{n+1}}~dz
= \frac{f^{(n)}(z_0)}{n!}.
\end{equation*}
If rendering plain text is sufficient for your needs and you don't want
to render any typeset formulas, you can technically skip this step. Otherwise
select your operating system from the tab list below and follow the instructions.
:::::{tab-set}
::::{tab-item} Windows
For Windows we recommend installing LaTeX via the
[MiKTeX distribution](https://miktex.org). Simply grab
the Windows installer available from their download page,
<https://miktex.org/download> and run it.
::::
::::{tab-item} MacOS
If you are running MacOS, we recommend installing the
[MacTeX distribution](https://www.tug.org/mactex/). The latest
available PKG file can be downloaded from
<https://www.tug.org/mactex/mactex-download.html>.
Get it and follow the standard installation procedure.
::::
::::{tab-item} Linux
Given the large number of Linux distributions with different ways
of installing packages, we cannot give detailed instructions for
all package managers.
In general we recommend to install a *TeX Live* distribution
(<https://www.tug.org/texlive/>). For most Linux distributions,
TeX Live has already been packaged such that it can be installed
easily with your system package manager. Search the internet and
your usual OS resources for detailed instructions.
For example, on Debian-based systems with the package manager `apt`,
a full TeX Live distribution can be installed by running
```bash
sudo apt install texlive-full
```
For Fedora (managed via `dnf`), the corresponding command is
```bash
sudo dnf install texlive-scheme-full
```
As soon as LaTeX is installed, continue with actually installing Manim
itself.
::::
:::::
:::{dropdown} I know what I am doing and I would like to setup a minimal LaTeX installation
You are welcome to use a smaller, more customizable LaTeX distribution like
[TinyTeX](https://yihui.org/tinytex/). Manim overall requires the following
LaTeX packages to be installed in your distribution:
```text
amsmath babel-english cbfonts-fd cm-super count1to ctex doublestroke dvisvgm everysel
fontspec frcursive fundus-calligra gnu-freefont jknapltx latex-bin
mathastext microtype multitoc physics preview prelim2e ragged2e relsize rsfs
setspace standalone tipa wasy wasysym xcolor xetex xkeyval
```
:::
### Step 3: Installing Manim
These steps again differ slightly between different operating systems. Make
sure you select the correct one from the tab list below, then follow
the instructions below.
::::::{tab-set}
:::::{tab-item} Windows
The following commands will
- create a new directory for a Python project,
- and add Manim as a dependency, which installs it into the corresponding
local Python environment.
The name for the Python project is *manimations*, which you can change
to anything you like.
```bash
uv init manimations
cd manimations
uv add manim
```
Manim is now installed in your local project environment!
:::::
:::::{tab-item} MacOS
Before we can install Manim, we need to make sure that the system utilities
`cairo` and `pkg-config` are present. They are needed for the [`pycairo` Python
package](https://pycairo.readthedocs.io/en/latest/), a dependency of Manim.
The easiest way of installing these utilities is by using [Homebrew](https://brew.sh/),
a fairly popular 3rd party package manager for MacOS. Check whether Homebrew is
already installed by running
```bash
brew --version
```
which will report something along the lines of `Homebrew 4.4.15-54-...`
if it is installed, and a message `command not found: brew` otherwise. In this
case, use the shell installer [as instructed on Homebrew's website](https://brew.sh/),
or get a `.pkg`-installer from
[their GitHub release page](https://github.com/Homebrew/brew/releases). Make sure to
follow the instructions of the installer carefully, especially when prompted to
modify your `.zprofile` to add Homebrew to your system's PATH.
With Homebrew available, the required utilities can be installed by running
```bash
brew install cairo pkg-config
```
With all of this preparation out of the way, now it is time to actually install
Manim itself! The following commands will
- create a new directory for a Python project,
- and add Manim as a dependency, which installs it into the corresponding
local Python environment.
The name for the Python project is *manimations*, which you can change
to anything you like.
```bash
uv init manimations
cd manimations
uv add manim
```
Manim is now installed in your local project environment!
:::::
:::::{tab-item} Linux
Practically, the instructions given in the *Windows* tab
also apply for Linux -- however, some additional dependencies are
required as Linux users need to build
[ManimPango](https://github.com/ManimCommunity/ManimPango)
(and potentially [pycairo](https://pycairo.readthedocs.io/en/latest/))
from source. More specifically, this includes:
- A C compiler,
- Python's development headers,
- the `pkg-config` tool,
- Pango and its development headers,
- and Cairo and its development headers.
Instructions for popular systems / package managers are given below.
::::{tab-set}
:::{tab-item} Debian-based / apt
```bash
sudo apt update
sudo apt install build-essential python3-dev libcairo2-dev libpango1.0-dev
```
:::
:::{tab-item} Fedora / dnf
```bash
sudo dnf install python3-devel pkg-config cairo-devel pango-devel
```
:::
:::{tab-item} Arch Linux / pacman
```bash
sudo pacman -Syu base-devel cairo pango
```
:::
::::
As soon as the required dependencies are installed, you can create
a Python project (feel free to change the name *manimations* used below
to some other name) with a local environment containing Manim by running
```bash
uv init manimations
cd manimations
uv add manim
```
:::::
::::::
To verify that your local Python project is setup correctly
and that Manim is available, simply run
```bash
uv run manim checkhealth
```
At this point, you can also open your project folder with the
IDE of your choice. All modern Python IDEs (for example VS Code
with the Python extension, or PyCharm) should automatically detect
the local environment created by `uv` such that if you put
```py
import manim
```
into a new file `my-first-animation.py`, the import is resolved
correctly and autocompletion is available.
*Happy Manimating!*
:::{dropdown} Alternative: Installing Manim as a global `uv`-managed tool
If you have Manim projects in many different directories and you do not
want to setup a local project environment for each of them, you could
also install Manim as a `uv`-managed tool.
See [`uv`'s documentation for more information](https://docs.astral.sh/uv/concepts/tools/)
on their tool mechanism.
To install Manim as a global `uv` tool, simply run
```bash
uv tool install manim
```
after which the `manim` executable will be available on your
global system path, without the need to activate any virtual
environment or prefixing your commands with `uv run`.
Note that when using this approach, setting up your code editor
to properly resolve `import manim` requires additional work, as
the global tool environment is not automatically detected: the
base path of all tool environments can be determined by running
```
uv tool dir
```
which should now contain a directory `manim` in which the appropriate
virtual environment is located. Set the Python interpreter of your IDE
to this environment to make imports properly resolve themselves.
:::
:::{dropdown} Installing Manim for a different version of Python
In case you would like to use a different version of Python
(for example, due to compatibility issues with other packages),
then `uv` allows you to do so in a fairly straightforward way.
When initializing the local Python project, simply pass the Python
version you want to use as an argument to the `init` command:
```
uv init --python 3.12 manimations
cd manimations
uv add manim
```
To change the version for an existing package, you will need to
edit the `pyproject.toml` file. If you are downgrading the python version, the
`requires-python` entry needs to be updated such that your chosen
version satisfies the requirement. Change the line to, for example
`requires-python = ">=3.12"`. After that, run `uv python pin 3.12`
to pin the python version to `3.12`. Finally, run `uv sync`, and your
environment is updated!
:::
:::{dropdown} Installing the latest development version
If you want to install the latest (potentially unstable!)
development version of Manim from our source repository
[on GitHub](https://github.com/ManimCommunity/manim), then
simply run
```bash
uv add git+https://github.com/ManimCommunity/manim.git@main
```
:::

View file

@ -1,172 +0,0 @@
Windows
=======
The easiest way of installing Manim and its dependencies is by using a
package manager like `Chocolatey <https://chocolatey.org/>`__
or `Scoop <https://scoop.sh>`__. If you are not afraid of editing
your System's ``PATH``, a manual installation is also possible.
In fact, if you already have an existing Python
installation (3.8 or above), it might be the easiest way to get
everything up and running.
If you choose to use one of the package managers, please follow
their installation instructions
(`for Chocolatey <https://chocolatey.org/install#install-step2>`__,
`for Scoop <https://scoop-docs.now.sh/docs/getting-started/Quick-Start.html>`__)
to make one of them available on your system.
Required Dependencies
---------------------
Manim requires a recent version of Python (3.8 or above) and ``ffmpeg``
in order to work.
Chocolatey
**********
Manim can be installed via Chocolatey simply by running:
.. code-block:: powershell
choco install manimce
That's it, no further steps required. You can continue with installing
the :ref:`optional dependencies <win-optional-dependencies>` below.
Scoop
*****
While there is no recipe for installing Manim with Scoop directly,
you can install all requirements by running:
.. code-block:: powershell
scoop install python ffmpeg
and then Manim can be installed by running:
.. code-block:: powershell
python -m pip install manim
Manim should now be installed on your system. Continue reading
the :ref:`optional dependencies <win-optional-dependencies>` section
below.
Winget
******
While there is no recipe for installing Manim with Winget directly,
you can install all requirements by running:
.. code-block:: powershell
winget install python
winget install ffmpeg
and then Manim can be installed by running:
.. code-block:: powershell
python -m pip install manim
Manim should now be installed on your system. Continue reading
the :ref:`optional dependencies <win-optional-dependencies>` section
below.
Manual Installation
*******************
As mentioned above, Manim needs a reasonably recent version of
Python 3 (3.8 or above) and FFmpeg.
**Python:** Head over to https://www.python.org, download an installer
for a recent version of Python, and follow its instructions to get Python
installed on your system.
.. note::
We have received reports of problems caused by using the version of
Python that can be installed from the Windows Store. At this point,
we recommend staying away from the Windows Store version. Instead,
install Python directly from the
`official website <https://www.python.org>`__.
**FFmpeg:** In order to install FFmpeg, you can get a
pre-compiled and ready-to-use version from one of the resources
linked at https://ffmpeg.org/download.html#build-windows, such as
`the version available here
<https://www.gyan.dev/ffmpeg/builds/ffmpeg-release-essentials.7z>`__
(recommended), or if you know exactly what you are doing
you can alternatively get the source code
from https://ffmpeg.org/download.html and compile it yourself.
After downloading the pre-compiled archive,
`unzip it <https://www.7-zip.org>`__ and, if you like, move the
extracted directory to some more permanent place (e.g.,
``C:\Program Files\``). Next, edit the ``PATH`` environment variable:
first, visit ``Control Panel`` > ``System`` > ``System settings`` >
``Environment Variables``, then add the full path to the ``bin``
directory inside of the (moved) ffmpeg directory to the
``PATH`` variable. Finally, save your changes and exit.
If you now open a new command line prompt (or PowerShell) and
run ``ffmpeg``, the command should be recognized.
At this point, you have all the required dependencies and can now
install Manim via
.. code-block:: powershell
python -m pip install manim
.. _win-optional-dependencies:
Optional Dependencies
---------------------
In order to make use of Manim's interface to LaTeX to, for example, render
equations, LaTeX has to be installed as well. Note that this is an optional
dependency: if you don't intend to use LaTeX, you don't have to install it.
For Windows, the recommended LaTeX distribution is
`MiKTeX <https://miktex.org/download>`__. You can install it by using the
installer from the linked MiKTeX site, or by using the package manager
of your choice (Chocolatey: ``choco install miktex.install``,
Scoop: ``scoop install latex``, Winget: ``winget install MiKTeX.MiKTeX``).
If you are concerned about disk space, there are some alternative,
smaller distributions of LaTeX.
**Using Chocolatey:** If you used Chocolatey to install manim or are already
a chocolatey user, then you can simply run ``choco install manim-latex``. It
is a dedicated package for Manim based on TinyTeX which contains all the
required packages that Manim interacts with.
**Manual Installation:**
You can also use `TinyTeX <https://yihui.org/tinytex/>`__ (Chocolatey: ``choco install tinytex``,
Scoop: first ``scoop bucket add r-bucket https://github.com/cderv/r-bucket.git``,
then ``scoop install tinytex``) alternative installation instructions can be found at their website.
Keep in mind that you will have to manage the LaTeX packages installed on your system yourself via ``tlmgr``.
Therefore we only recommend this option if you know what you are doing.
The full list of LaTeX packages which Manim interacts with in some way
(a subset might be sufficient for your particular application) are::
amsmath babel-english cbfonts-fd cm-super ctex doublestroke dvisvgm everysel
fontspec frcursive fundus-calligra gnu-freefont jknapltx latex-bin
mathastext microtype ms physics preview ragged2e relsize rsfs
setspace standalone tipa wasy wasysym xcolor xetex xkeyval
Working with Manim
------------------
At this point, you should have a working installation of Manim, head
over to our :doc:`Quickstart Tutorial <../tutorials/quickstart>` to learn
how to make your own *Manimations*!

View file

@ -96,43 +96,22 @@ The only requirement of manim plugins is that they specify an entry point
with the group, ``"manim.plugins"``. This allows Manim to discover plugins
available in the user's environment. Everything regarding the plugin's
directory structure, build system, and naming are completely up to your
discretion as an author. The aforementioned template plugin is only a model
using Poetry since this is the build system Manim uses. The plugin's `entry
point <https://packaging.python.org/specifications/entry-points/>`_ can be
specified in poetry as:
discretion as an author.
The standard way to specify an entry point (see
`the Python packaging guide <https://packaging.python.org/specifications/entry-points/>`__
for details) is to include the following in your ``pyproject.toml``:
.. code-block:: toml
[tool.poetry.plugins."manim.plugins"]
[project.entry-points."manim.plugins"]
"name" = "object_reference"
Here ``name`` is the name of the module of the plugin.
.. versionremoved:: 0.18.1
Here ``object_reference`` can point to either a function in a module or a module
itself. For example,
.. code-block:: toml
[tool.poetry.plugins."manim.plugins"]
"manim_plugintemplate" = "manim_plugintemplate"
Here a module is used as ``object_reference``, and when this plugin is enabled,
Manim will look for ``__all__`` keyword defined in ``manim_plugintemplate`` and
everything as a global variable one by one.
If ``object_reference`` is a function, Manim calls the function and expects the
function to return a list of modules or functions that need to be defined globally.
For example,
.. code-block:: toml
[tool.poetry.plugins."manim.plugins"]
"manim_plugintemplate" = "manim_awesomeplugin.imports:setup_things"
Here, Manim will call the function ``setup_things`` defined in
``manim_awesomeplugin.imports`` and calls that. It returns a list of function or
modules which will be imported globally.
Plugins should be imported explicitly to be usable in user code. The plugin
system will probably be refactored in the future to provide a more structured
interface.
A note on Renderer Compatibility
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

View file

@ -9,23 +9,27 @@ Module Index
.. autosummary::
:toctree: ../reference
constants
~utils.bezier
cli
~utils.color
~utils.commands
~utils.config_ops
~utils.deprecation
constants
data_structures
~utils.debug
~utils.deprecation
~utils.docbuild
~utils.hashing
~utils.ipython_magic
~utils.images
~utils.ipython_magic
~utils.iterables
~utils.paths
~utils.rate_functions
~utils.simple_functions
~utils.sounds
~utils.space_ops
~utils.testing
~utils.tex
~utils.tex_templates
~utils.tex_file_writing
~utils.tex_templates
typing

View file

@ -327,6 +327,13 @@ Generally, you start with the starting number and add only some part of the valu
So, the logic of calculating the number to display at each step will be ``50 + alpha * (100 - 50)``.
Once you set the calculated value for the :class:`~.DecimalNumber`, you are done.
.. note::
If you're creating a custom animation and want to use a ``rate_func``, you must explicitly apply
``self.rate_func(alpha)`` to the parameter you're animating. For example, try switching the rate
function to ``rate_functions.there_and_back`` to observe how it affects the counting behavior.
Once you have defined your ``Count`` animation, you can play it in your :class:`~.Scene` for any duration you want for any :class:`~.DecimalNumber` with any rate function.
.. manim:: CountingScene
@ -343,7 +350,7 @@ Once you have defined your ``Count`` animation, you can play it in your :class:`
def interpolate_mobject(self, alpha: float) -> None:
# Set value of DecimalNumber according to alpha
value = self.start + (alpha * (self.end - self.start))
value = self.start + (self.rate_func(alpha) * (self.end - self.start))
self.mobject.set_value(value)
@ -376,13 +383,13 @@ and :meth:`~.Mobject.get_start`. Here is an example of some important coordinate
class MobjectExample(Scene):
def construct(self):
p1= [-1,-1,0]
p2= [1,-1,0]
p3= [1,1,0]
p4= [-1,1,0]
a = Line(p1,p2).append_points(Line(p2,p3).points).append_points(Line(p3,p4).points)
point_start= a.get_start()
point_end = a.get_end()
p1 = [-1,-1, 0]
p2 = [ 1,-1, 0]
p3 = [ 1, 1, 0]
p4 = [-1, 1, 0]
a = Line(p1,p2).append_points(Line(p2,p3).points).append_points(Line(p3,p4).points)
point_start = a.get_start()
point_end = a.get_end()
point_center = a.get_center()
self.add(Text(f"a.get_start() = {np.round(point_start,2).tolist()}", font_size=24).to_edge(UR).set_color(YELLOW))
self.add(Text(f"a.get_end() = {np.round(point_end,2).tolist()}", font_size=24).next_to(self.mobjects[-1],DOWN).set_color(RED))
@ -425,8 +432,8 @@ function of numpy:
self.camera.background_color = WHITE
m1a = Square().set_color(RED).shift(LEFT)
m1b = Circle().set_color(RED).shift(LEFT)
m2a= Square().set_color(BLUE).shift(RIGHT)
m2b= Circle().set_color(BLUE).shift(RIGHT)
m2a = Square().set_color(BLUE).shift(RIGHT)
m2b = Circle().set_color(BLUE).shift(RIGHT)
points = m2a.points
points = np.roll(points, int(len(points)/4), axis=0)

View file

@ -276,25 +276,28 @@ When executing the command
manim -pql scene.py SquareToCircle
it was necessary to specify which ``Scene`` class to render. This is because a
single file can contain more than one ``Scene`` class. If your file contains
multiple ``Scene`` classes, and you want to render them all, you can use the
``-a`` flag.
it specifies the scene to render. This is not necessary now. When a single
file contains only one ``Scene`` class, it will just render the ``Scene``
class. When a single file contains more than one ``Scene`` class, manim will
let you choose a ``Scene`` class. If your file contains multiple ``Scene``
classes, and you want to render them all, you can use the ``-a`` flag.
As discussed previously, the ``-ql`` specifies low render quality. This does
not look very good, but is very useful for rapid prototyping and testing. The
other options that specify render quality are ``-qm``, ``-qh``, and ``-qk`` for
medium, high, and 4k quality, respectively.
As discussed previously, the ``-ql`` specifies low render quality (854x480
15FPS). This does not look very good, but is very useful for rapid
prototyping and testing. The other options that specify render quality are
``-qm``, ``-qh``, ``-qp`` and ``-qk`` for medium (1280x720 30FPS), high
(1920x1080 60FPS), 2k (2560x1440 60FPS) and 4k quality (3840x2160 60FPS),
respectively.
The ``-p`` flag plays the animation once it is rendered. If you want to open
the file browser at the location of the animation instead of playing it, you
can use the ``-f`` flag. You can also omit these two flags.
Finally, by default manim will output .mp4 files. If you want your animations
in .gif format instead, use the ``-i`` flag. The output files will be in the
same folder as the .mp4 files, and with the same name, but a different file
extension.
in .gif format instead, use the ``--format gif`` flag. The output files will
be in the same folder as the .mp4 files, and with the same name, but a
different file extension.
This was a quick review of some of the most frequent command-line flags. For a
thorough review of all flags available, see the
:doc:`thematic guide on Manim's configuration system </guides/configuration>`.
This was a quick review of some of the most frequent command-line flags.
For a thorough review of all flags available, see the :doc:`thematic guide on
Manim's configuration system </guides/configuration>`.

View file

@ -3,12 +3,22 @@ Quickstart
==========
.. note::
Before proceeding, install Manim and make sure it's running properly by
following the steps in :doc:`../installation`. For
information on using Manim with Jupyterlab or Jupyter notebook, go to the
documentation for the
:meth:`IPython magic command <manim.utils.ipython_magic.ManimMagic.manim>`,
``%%manim``.
Before proceeding, install Manim and make sure it is running properly by
following the steps in :doc:`../installation`. For
information on using Manim with Jupyterlab or Jupyter notebook, go to the
documentation for the
:meth:`IPython magic command <manim.utils.ipython_magic.ManimMagic.manim>`,
``%%manim``.
.. important::
If you installed Manim in the recommended way, using the
Python management tool ``uv``, then you either need to make sure the corresponding
virtual environment is activated (follow the instructions printed on running ``uv venv``),
or you need to remember to prefix the ``manim`` command in the console with ``uv run``;
that is, ``uv run manim ...``.
Overview
********
@ -28,45 +38,38 @@ use to modify ``Mobject``\s.
Starting a new project
**********************
Start by creating a new folder. For the purposes of this guide, name the folder ``project``:
Start by creating a new folder::
.. code-block:: bash
manim init project my-project --default
project/
This folder is the root folder for your project. It contains all the files that Manim needs to function,
The ``my-project`` folder is the root folder for your project. It contains all the files that Manim needs to function,
as well as any output that your project produces.
Animating a circle
******************
1. Open a text editor, such as Notepad. Copy the following code snippet into the window:
1. Open a text editor, such as Notepad. Open the file ``main.py`` in the ``my-project`` folder.
It should look something like this:
.. code-block:: python
.. code-block:: python
from manim import *
from manim import *
class CreateCircle(Scene):
def construct(self):
circle = Circle() # create a circle
circle.set_fill(PINK, opacity=0.5) # set the color and transparency
self.play(Create(circle)) # show the circle on screen
class CreateCircle(Scene):
def construct(self):
circle = Circle() # create a circle
circle.set_fill(PINK, opacity=0.5) # set the color and transparency
self.play(Create(circle)) # show the circle on screen
2. Save the code snippet into your project folder with the name ``scene.py``.
.. code-block:: bash
2. Open the command line, navigate to your project folder, and execute
the following command:
project/
└─scene.py
.. code-block:: bash
3. Open the command line, navigate to your project folder, and execute
the following command:
.. code-block:: bash
manim -pql scene.py CreateCircle
manim -pql main.py CreateCircle
Manim will output rendering information, then create an MP4 file.
Your default movie player will play the MP4 file, displaying the following animation.
@ -113,7 +116,7 @@ Now let's look at the next two lines:
class CreateCircle(Scene):
def construct(self):
...
[...]
Most of the time, the code for scripting an animation is entirely contained within
the :meth:`~.Scene.construct` method of a :class:`.Scene` class.
@ -192,7 +195,7 @@ Positioning ``Mobject``\s
Next, let's go over some basic techniques for positioning ``Mobject``\s.
1. Open ``scene.py``, and add the following code snippet below the ``SquareToCircle`` method:
1. Open ``scene.py``, and add the following code snippet below the ``SquareToCircle`` class:
.. code-block:: python
@ -268,11 +271,9 @@ and animating those method calls with ``.animate``.
self.play(Create(square)) # show the square on screen
self.play(square.animate.rotate(PI / 4)) # rotate the square
self.play(Transform(square, circle)) # transform the square into a circle
self.play(
ReplacementTransform(square, circle)
) # transform the square into a circle
self.play(
circle.animate.set_fill(PINK, opacity=0.5)
square.animate.set_fill(PINK, opacity=0.5)
) # color the circle on screen
2. Render ``AnimatedSquareToCircle`` by running the following command in the command line:
@ -293,8 +294,8 @@ The following animation will render:
self.play(Create(square)) # show the square on screen
self.play(square.animate.rotate(PI / 4)) # rotate the square
self.play(ReplacementTransform(square, circle)) # transform the square into a circle
self.play(circle.animate.set_fill(PINK, opacity=0.5)) # color the circle on screen
self.play(Transform(square, circle)) # transform the square into a circle
self.play(square.animate.set_fill(PINK, opacity=0.5)) # color the circle on screen
The first ``self.play`` creates the square. The second animates rotating it 45 degrees.
The third transforms the square into a circle, and the last colors the circle pink.
@ -342,12 +343,61 @@ the corners of the square appear to contract slightly as they move into the posi
for the first square to transform into the second one.
In ``DifferentRotations``, the difference between ``.animate``'s interpretation of rotation and the
``Rotate`` method is far more apparent. The starting and ending states of a ``Mobject`` rotated 360 degrees
``Rotate`` method is far more apparent. The starting and ending states of a ``Mobject`` rotated 180 degrees
are the same, so ``.animate`` tries to interpolate two identical objects and the result is the left square.
If you find that your own usage of ``.animate`` is causing similar unwanted behavior, consider
using conventional animation methods like the right square, which uses ``Rotate``.
``Transform`` vs ``ReplacementTransform``
*****************************************
The difference between ``Transform`` and ``ReplacementTransform`` is that ``Transform(mob1, mob2)`` transforms the points
(as well as other attributes like color) of ``mob1`` into the points/attributes of ``mob2``.
``ReplacementTransform(mob1, mob2)`` on the other hand literally replaces ``mob1`` on the scene with ``mob2``.
The use of ``ReplacementTransform`` or ``Transform`` is mostly up to personal preference. They can be used to accomplish the same effect, as shown below.
.. code-block:: python
class TwoTransforms(Scene):
def transform(self):
a = Circle()
b = Square()
c = Triangle()
self.play(Transform(a, b))
self.play(Transform(a, c))
self.play(FadeOut(a))
def replacement_transform(self):
a = Circle()
b = Square()
c = Triangle()
self.play(ReplacementTransform(a, b))
self.play(ReplacementTransform(b, c))
self.play(FadeOut(c))
def construct(self):
self.transform()
self.wait(0.5) # wait for 0.5 seconds
self.replacement_transform()
However, in some cases it is more beneficial to use ``Transform``, like when you are transforming several mobjects one after the other.
The code below avoids having to keep a reference to the last mobject that was transformed.
.. manim:: TransformCycle
class TransformCycle(Scene):
def construct(self):
a = Circle()
t1 = Square()
t2 = Triangle()
self.add(a)
self.wait()
for t in [t1,t2]:
self.play(Transform(a,t))
************
You're done!
************

View file

@ -23,7 +23,8 @@ def FrenchCursive(*tex_strings, **kwargs):
class TexFontTemplateManual(Scene):
"""An example scene that uses a manually defined TexTemplate() object to create
LaTeX output in French Cursive font"""
LaTeX output in French Cursive font
"""
def construct(self):
self.add(Tex("Tex Font Example").to_edge(UL))
@ -51,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,

View file

@ -153,7 +153,7 @@ class SpiralInExample(Scene):
],
color=PURPLE_B,
fill_opacity=1,
stroke_width=0
stroke_width=0,
).shift(UP + 2 * RIGHT)
shapes = VGroup(triangle, square, circle, pentagon, pi)
self.play(SpiralIn(shapes, fade_in_fraction=0.9))
@ -167,8 +167,8 @@ Triangle.set_default(stroke_width=20)
class LineJoints(Scene):
def construct(self):
t1 = Triangle()
t2 = Triangle(line_join=LineJointType.ROUND)
t3 = Triangle(line_join=LineJointType.BEVEL)
t2 = Triangle(joint_type=LineJointType.ROUND)
t3 = Triangle(joint_type=LineJointType.BEVEL)
grp = VGroup(t1, t2, t3).arrange(RIGHT)
grp.set(width=config.frame_width - 1)

View file

@ -2,7 +2,7 @@ from pathlib import Path
import manim.utils.opengl as opengl
from manim import *
from manim.opengl import * # type: ignore
from manim.opengl import *
# Copied from https://3b1b.github.io/manim/getting_started/example_scenes.html#surfaceexample.
# Lines that do not yet work with the Community Version are commented.
@ -406,7 +406,7 @@ class InteractiveDevelopment(Scene):
self.play(Create(square))
self.wait()
# This opens an iPython termnial where you can keep writing
# This opens an iPython terminal where you can keep writing
# lines as if they were part of this construct method.
# In particular, 'square', 'circle' and 'self' will all be
# part of the local namespace in that terminal.

View file

@ -1,15 +1,18 @@
#!/usr/bin/env python
from __future__ import annotations
import pkg_resources
from importlib.metadata import PackageNotFoundError, version
__version__: str = pkg_resources.get_distribution(__name__).version
# 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"
import sys
# isort: off
# Importing the config module should be the first thing we do, since other
@ -20,6 +23,7 @@ from ._config import *
from .utils.commands import *
# isort: on
import numpy as np
from .animation.animation import *
from .animation.changing import *
@ -69,6 +73,7 @@ from .mobject.text.code_mobject import *
from .mobject.text.numbers import *
from .mobject.text.tex_mobject import *
from .mobject.text.text_mobject import *
from .mobject.text.typst_mobject import *
from .mobject.three_d.polyhedra import *
from .mobject.three_d.three_d_utils import *
from .mobject.three_d.three_dimensions import *

View file

@ -1,27 +1,54 @@
from __future__ import annotations
import sys
import click
import cloup
from . import __version__, cli_ctx_settings, console
from .cli.cfg.group import cfg
from .cli.checkhealth.commands import checkhealth
from .cli.default_group import DefaultGroup
from .cli.init.commands import init
from .cli.new.group import new
from .cli.plugins.commands import plugins
from .cli.render.commands import render
from .constants import EPILOG
from manim import __version__
from manim._config import cli_ctx_settings, console
from manim.cli.cfg.group import cfg
from manim.cli.checkhealth.commands import checkhealth
from manim.cli.default_group import DefaultGroup
from manim.cli.init.commands import init
from manim.cli.plugins.commands import plugins
from manim.cli.render.commands import render
from manim.constants import EPILOG
def exit_early(ctx, param, value):
def show_splash(ctx: click.Context, param: click.Option, value: str | None) -> None:
"""When giving a value by console, show an initial message with the Manim
version before executing any other command: ``Manim Community vA.B.C``.
Parameters
----------
ctx
The Click context.
param
A Click option.
value
A string value given by console, or None.
"""
if value:
sys.exit()
console.print(f"Manim Community [green]v{__version__}[/green]\n")
console.print(f"Manim Community [green]v{__version__}[/green]\n")
def print_version_and_exit(
ctx: click.Context, param: click.Option, value: str | None
) -> None:
"""Same as :func:`show_splash`, but also exit when giving a value by
console.
Parameters
----------
ctx
The Click context.
param
A Click option.
value
A string value given by console, or None.
"""
show_splash(ctx, param, value)
if value:
ctx.exit()
@cloup.group(
@ -35,17 +62,32 @@ console.print(f"Manim Community [green]v{__version__}[/green]\n")
"is specified. Run 'manim render --help' if you would like to know what the "
f"'-ql' or '-p' flags do, for example.\n\n{EPILOG}",
)
@click.option(
@cloup.option(
"--version",
is_flag=True,
help="Show version and exit.",
callback=exit_early,
callback=print_version_and_exit,
is_eager=True,
expose_value=False,
)
@click.pass_context
def main(ctx):
"""The entry point for manim."""
@click.option(
"--show-splash/--hide-splash",
is_flag=True,
default=True,
help="Print splash message with version information.",
callback=show_splash,
is_eager=True,
expose_value=False,
)
@cloup.pass_context
def main(ctx: click.Context) -> None:
"""The entry point for Manim.
Parameters
----------
ctx
The Click context.
"""
pass
@ -53,7 +95,6 @@ main.add_command(checkhealth)
main.add_command(cfg)
main.add_command(plugins)
main.add_command(init)
main.add_command(new)
main.add_command(render)
if __name__ == "__main__":

View file

@ -3,7 +3,9 @@
from __future__ import annotations
import logging
from contextlib import _GeneratorContextManager, contextmanager
from collections.abc import Generator
from contextlib import contextmanager
from typing import Any
from .cli_colors import parse_cli_ctx
from .logger_utils import make_logger
@ -21,10 +23,9 @@ __all__ = [
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"],
@ -35,13 +36,15 @@ logging.getLogger("PIL").setLevel(logging.INFO)
logging.getLogger("matplotlib").setLevel(logging.INFO)
config = ManimConfig().digest_parser(parser)
# TODO: to be used in the future - see PR #620
# https://github.com/ManimCommunity/manim/pull/620
frame = ManimFrame(config)
# This has to go here because it needs access to this module's config
@contextmanager
def tempconfig(temp: ManimConfig | dict) -> _GeneratorContextManager:
"""Context manager that temporarily modifies the global ``config`` object.
def tempconfig(temp: ManimConfig | dict[str, Any]) -> Generator[None, None, None]:
"""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.
@ -64,7 +67,6 @@ def tempconfig(temp: ManimConfig | dict) -> _GeneratorContextManager:
8.0
>>> with tempconfig({"frame_height": 100.0}):
... print(config["frame_height"])
...
100.0
>>> config["frame_height"]
8.0

View file

@ -1,10 +1,21 @@
"""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
from typing import Any
from cloup import Context, HelpFormatter, HelpTheme, Style
__all__ = ["parse_cli_ctx"]
def parse_cli_ctx(parser: configparser.ConfigParser) -> Context:
formatter_settings = {
def parse_cli_ctx(parser: configparser.SectionProxy) -> dict[str, Any]:
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"]),
@ -23,6 +34,7 @@ def parse_cli_ctx(parser: configparser.ConfigParser) -> Context:
"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)})
@ -30,21 +42,26 @@ def parse_cli_ctx(parser: configparser.ConfigParser) -> Context:
formatter = {}
theme = parser["theme"] if parser["theme"] else None
if theme is None:
formatter = HelpFormatter().settings(
theme=HelpTheme(**theme_settings), **formatter_settings
formatter = HelpFormatter.settings(
theme=HelpTheme(**theme_settings),
**formatter_settings,
)
elif theme.lower() == "dark":
formatter = HelpFormatter().settings(
theme=HelpTheme.dark().with_(**theme_settings), **formatter_settings
formatter = HelpFormatter.settings(
theme=HelpTheme.dark().with_(**theme_settings),
**formatter_settings,
)
elif theme.lower() == "light":
formatter = HelpFormatter().settings(
theme=HelpTheme.light().with_(**theme_settings), **formatter_settings
formatter = HelpFormatter.settings(
theme=HelpTheme.light().with_(**theme_settings),
**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

View file

@ -221,9 +221,7 @@ repr_number = green
# Uncomment the following line to manually set the loglevel for ffmpeg. See
# ffmpeg manpage for accepted values
loglevel = ERROR
# defaults to the one present in path
ffmpeg_executable = ffmpeg
[jupyter]
media_embed =
media_embed = False
media_width = 60%%

View file

@ -9,14 +9,14 @@ Both ``logger`` and ``console`` use the ``rich`` library to produce rich text
format.
"""
from __future__ import annotations
import configparser
import copy
import json
import logging
import sys
from typing import TYPE_CHECKING
from typing import TYPE_CHECKING, Any
from rich import color, errors
from rich import print as printf
@ -27,6 +27,8 @@ from rich.theme import Theme
if TYPE_CHECKING:
from pathlib import Path
__all__ = ["make_logger", "parse_theme", "set_file_logger", "JSONFormatter"]
HIGHLIGHTED_KEYWORDS = [ # these keywords are highlighted specially
"Played",
"animations",
@ -50,9 +52,9 @@ Loading the default color configuration.[/logging.level.error]
def make_logger(
parser: configparser.ConfigParser,
parser: configparser.SectionProxy,
verbosity: str,
) -> tuple[logging.Logger, Console]:
) -> tuple[logging.Logger, Console, Console]:
"""Make the manim logger and console.
Parameters
@ -84,25 +86,29 @@ def make_logger(
theme = parse_theme(parser)
console = Console(theme=theme)
# With rich 9.5.0+ we could pass stderr=True instead
error_console = Console(theme=theme, file=sys.stderr)
error_console = Console(theme=theme, stderr=True)
# set the rich handler
RichHandler.KEYWORDS = HIGHLIGHTED_KEYWORDS
rich_handler = RichHandler(
console=console,
show_time=parser.getboolean("log_timestamps"),
show_time=parser.getboolean("log_timestamps", fallback=False),
keywords=HIGHLIGHTED_KEYWORDS,
)
# finally, the logger
logger = logging.getLogger("manim")
logger.addHandler(rich_handler)
logger.setLevel(verbosity)
logger.propagate = False
if not (libav_logger := logging.getLogger()).hasHandlers():
libav_logger.addHandler(rich_handler)
libav_logger.setLevel(verbosity)
return logger, console, error_console
def parse_theme(parser: configparser.ConfigParser) -> Theme:
def parse_theme(parser: configparser.SectionProxy) -> Theme | None:
"""Configure the rich style of logger and console output.
Parameters
@ -120,7 +126,7 @@ def parse_theme(parser: configparser.ConfigParser) -> Theme:
:func:`make_logger`.
"""
theme = {key.replace("_", "."): parser[key] for key in parser}
theme: dict[str, Any] = {key.replace("_", "."): parser[key] for key in parser}
theme["log.width"] = None if theme["log.width"] == "-1" else int(theme["log.width"])
theme["log.height"] = (
@ -178,12 +184,15 @@ class JSONFormatter(logging.Formatter):
"""
def format(self, record: dict) -> str:
def format(self, record: logging.LogRecord) -> str:
"""Format the record in a custom JSON format."""
record_c = copy.deepcopy(record)
if record_c.args:
for arg in record_c.args:
record_c.args[arg] = "<>"
if isinstance(record_c.args, dict):
for arg in record_c.args:
record_c.args[arg] = "<>"
else:
record_c.args = ("<>",) * len(record_c.args)
return json.dumps(
{
"levelname": record_c.levelname,

File diff suppressed because it is too large Load diff

View file

@ -1,6 +1,5 @@
"""Animate mobjects."""
from __future__ import annotations
from manim.mobject.opengl.opengl_mobject import OpenGLMobject
@ -8,15 +7,17 @@ from manim.mobject.opengl.opengl_mobject import OpenGLMobject
from .. import config, logger
from ..constants import RendererType
from ..mobject import mobject
from ..mobject.mobject import Mobject
from ..mobject.mobject import Group, Mobject
from ..mobject.opengl import opengl_mobject
from ..utils.rate_functions import linear, smooth
__all__ = ["Animation", "Wait", "override_animation"]
__all__ = ["Animation", "Wait", "Add", "override_animation"]
from collections.abc import Callable, Iterable, Sequence
from copy import deepcopy
from typing import TYPE_CHECKING, Callable, Iterable, Sequence
from functools import partialmethod
from typing import TYPE_CHECKING, Any, Self
if TYPE_CHECKING:
from manim.scene.scene import Scene
@ -51,7 +52,6 @@ class Animation:
For example ``rate_func(0.5)`` is the proportion of the animation that is done
after half of the animations run time.
reverse_rate_function
Reverses the rate function of the animation. Setting ``reverse_rate_function``
does not have any effect on ``remover`` or ``introducer``. These need to be
@ -112,13 +112,13 @@ class Animation:
*args,
use_override=True,
**kwargs,
):
) -> Self:
if isinstance(mobject, Mobject) and use_override:
func = mobject.animation_override_for(cls)
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.",
)
@ -127,7 +127,7 @@ class Animation:
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,
@ -137,8 +137,8 @@ class Animation:
suspend_mobject_updating: bool = True,
introducer: bool = False,
*,
_on_finish: Callable[[], None] = lambda _: None,
**kwargs,
_on_finish: Callable[[Scene], None] = lambda _: None,
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
@ -158,8 +158,6 @@ class Animation:
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(
@ -169,6 +167,19 @@ class Animation:
),
)
@property
def run_time(self) -> float:
return self._run_time
@run_time.setter
def run_time(self, value: float) -> None:
if value < 0:
raise ValueError(
f"The run_time of {self.__class__.__name__} cannot be "
f"negative. The given value was {value}."
)
self._run_time = value
def _typecheck_input(self, mobject: Mobject | None) -> None:
if mobject is None:
logger.debug("Animation with empty mobject")
@ -249,11 +260,11 @@ class Animation:
):
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
@ -267,9 +278,12 @@ class Animation:
def get_all_families_zipped(self) -> Iterable[tuple]:
if config["renderer"] == RendererType.OPENGL:
return zip(*(mob.get_family() for mob in self.get_all_mobjects()))
return zip(
*(mob.get_family() for mob in self.get_all_mobjects()), strict=False
)
return zip(
*(mob.family_members_with_points() for mob in self.get_all_mobjects())
*(mob.family_members_with_points() for mob in self.get_all_mobjects()),
strict=False,
)
def update_mobjects(self, dt: float) -> None:
@ -398,6 +412,7 @@ class Animation:
self.run_time = run_time
return self
# TODO: is this getter even necessary?
def get_run_time(self) -> float:
"""Get the run time of the animation.
@ -476,9 +491,57 @@ class Animation:
"""
return self.introducer
@classmethod
def __init_subclass__(cls, **kwargs) -> None:
super().__init_subclass__(**kwargs)
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.
If this method is called without any additional keyword
arguments, the original default values of the initialization
method of this class are restored.
Parameters
----------
kwargs
Passing any keyword argument will update the default
values of the keyword arguments of the initialization
function of this class.
Examples
--------
.. manim:: ChangeDefaultAnimation
class ChangeDefaultAnimation(Scene):
def construct(self):
Rotate.set_default(run_time=2, rate_func=rate_functions.linear)
Indicate.set_default(color=None)
S = Square(color=BLUE, fill_color=BLUE, fill_opacity=0.25)
self.add(S)
self.play(Rotate(S, PI))
self.play(Indicate(S))
Rotate.set_default()
Indicate.set_default()
"""
if kwargs:
cls.__init__ = partialmethod(cls.__init__, **kwargs)
else:
cls.__init__ = cls._original__init__
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.
@ -575,6 +638,90 @@ class Wait(Animation):
pass
class Add(Animation):
"""Add Mobjects to a scene, without animating them in any other way. This
is similar to the :meth:`.Scene.add` method, but :class:`Add` is an
animation which can be grouped into other animations.
Parameters
----------
mobjects
One :class:`~.Mobject` or more to add to a scene.
run_time
The duration of the animation after adding the ``mobjects``. Defaults
to 0, which means this is an instant animation without extra wait time
after adding them.
**kwargs
Additional arguments to pass to the parent :class:`Animation` class.
Examples
--------
.. manim:: DefaultAddScene
class DefaultAddScene(Scene):
def construct(self):
text_1 = Text("I was added with Add!")
text_2 = Text("Me too!")
text_3 = Text("And me!")
texts = VGroup(text_1, text_2, text_3).arrange(DOWN)
rect = SurroundingRectangle(texts, buff=0.5)
self.play(
Create(rect, run_time=3.0),
Succession(
Wait(1.0),
# You can Add a Mobject in the middle of an animation...
Add(text_1),
Wait(1.0),
# ...or multiple Mobjects at once!
Add(text_2, text_3),
),
)
self.wait()
.. manim:: AddWithRunTimeScene
class AddWithRunTimeScene(Scene):
def construct(self):
# A 5x5 grid of circles
circles = VGroup(
*[Circle(radius=0.5) for _ in range(25)]
).arrange_in_grid(5, 5)
self.play(
Succession(
# Add a run_time of 0.2 to wait for 0.2 seconds after
# adding the circle, instead of using Wait(0.2) after Add!
*[Add(circle, run_time=0.2) for circle in circles],
rate_func=smooth,
)
)
self.wait()
"""
def __init__(
self, *mobjects: Mobject, run_time: float = 0.0, **kwargs: Any
) -> None:
mobject = mobjects[0] if len(mobjects) == 1 else Group(*mobjects)
super().__init__(mobject, run_time=run_time, introducer=True, **kwargs)
def begin(self) -> None:
pass
def finish(self) -> None:
pass
def clean_up_from_scene(self, scene: Scene) -> None:
pass
def update_mobjects(self, dt: float) -> None:
pass
def interpolate(self, alpha: float) -> None:
pass
def override_animation(
animation_class: type[Animation],
) -> Callable[[Callable], Callable]:

View file

@ -4,8 +4,10 @@ from __future__ import annotations
__all__ = ["AnimatedBoundary", "TracedPath"]
from typing import Callable
from collections.abc import Callable, Sequence
from typing import Any, Self
from manim.mobject.mobject import Mobject
from manim.mobject.opengl.opengl_compatibility import ConvertToOpenGL
from manim.mobject.types.vectorized_mobject import VGroup, VMobject
from manim.utils.color import (
@ -16,7 +18,7 @@ from manim.utils.color import (
WHITE,
ParsableManimColor,
)
from manim.utils.rate_functions import smooth
from manim.utils.rate_functions import RateFunction, smooth
class AnimatedBoundary(VGroup):
@ -38,14 +40,14 @@ class AnimatedBoundary(VGroup):
def __init__(
self,
vmobject,
colors=[BLUE_D, BLUE_B, BLUE_E, GREY_BROWN],
max_stroke_width=3,
cycle_rate=0.5,
back_and_forth=True,
draw_rate_func=smooth,
fade_rate_func=smooth,
**kwargs,
vmobject: VMobject,
colors: Sequence[ParsableManimColor] = [BLUE_D, BLUE_B, BLUE_E, GREY_BROWN],
max_stroke_width: float = 3,
cycle_rate: float = 0.5,
back_and_forth: bool = True,
draw_rate_func: RateFunction = smooth,
fade_rate_func: RateFunction = smooth,
**kwargs: Any,
):
super().__init__(**kwargs)
self.colors = colors
@ -59,10 +61,10 @@ class AnimatedBoundary(VGroup):
vmobject.copy().set_style(stroke_width=0, fill_opacity=0) for x in range(2)
]
self.add(*self.boundary_copies)
self.total_time = 0
self.total_time = 0.0
self.add_updater(lambda m, dt: self.update_boundary_copies(dt))
def update_boundary_copies(self, dt):
def update_boundary_copies(self, dt: float) -> None:
# Not actual time, but something which passes at
# an altered rate to make the implementation below
# cleaner
@ -78,9 +80,9 @@ class AnimatedBoundary(VGroup):
fade_alpha = self.fade_rate_func(alpha)
if self.back_and_forth and int(time) % 2 == 1:
bounds = (1 - draw_alpha, 1)
bounds = (1.0 - draw_alpha, 1.0)
else:
bounds = (0, draw_alpha)
bounds = (0.0, draw_alpha)
self.full_family_become_partial(growing, vmobject, *bounds)
growing.set_stroke(colors[index], width=msw)
@ -90,10 +92,12 @@ class AnimatedBoundary(VGroup):
self.total_time += dt
def full_family_become_partial(self, mob1, mob2, a, b):
def full_family_become_partial(
self, mob1: VMobject, mob2: VMobject, a: float, b: float
) -> Self:
family1 = mob1.family_members_with_points()
family2 = mob2.family_members_with_points()
for sm1, sm2 in zip(family1, family2):
for sm1, sm2 in zip(family1, family2, strict=False):
sm1.pointwise_become_partial(sm2, a, b)
return self
@ -146,20 +150,21 @@ class TracedPath(VMobject, metaclass=ConvertToOpenGL):
stroke_width: float = 2,
stroke_color: ParsableManimColor | None = WHITE,
dissipating_time: float | None = None,
**kwargs,
):
**kwargs: Any,
) -> None:
super().__init__(stroke_color=stroke_color, stroke_width=stroke_width, **kwargs)
self.traced_point_func = traced_point_func
self.dissipating_time = dissipating_time
self.time = 1 if self.dissipating_time else None
self.time = 1.0 if self.dissipating_time else None
self.add_updater(self.update_path)
def update_path(self, mob, dt):
def update_path(self, mob: Mobject, dt: float) -> None:
new_point = self.traced_point_func()
if not self.has_points():
self.start_new_path(new_point)
self.add_line_to(new_point)
if self.dissipating_time:
assert self.time is not None
self.time += dt
if self.time - 1 > self.dissipating_time:
nppcc = self.n_points_per_curve

View file

@ -1,26 +1,25 @@
"""Tools for displaying multiple animations at once."""
from __future__ import annotations
from typing import TYPE_CHECKING, Callable, Sequence
from collections.abc import Callable, Iterable, Sequence
from typing import TYPE_CHECKING, Any
import numpy as np
from manim.mobject.opengl.opengl_mobject import OpenGLGroup
from .._config import config
from ..animation.animation import Animation, prepare_animation
from ..constants import RendererType
from ..mobject.mobject import Group, Mobject
from ..scene.scene import Scene
from ..utils.iterables import remove_list_redundancies
from ..utils.rate_functions import linear
from manim._config import config
from manim.animation.animation import Animation, prepare_animation
from manim.constants import RendererType
from manim.mobject.mobject import Group, Mobject
from manim.mobject.opengl.opengl_mobject import OpenGLGroup, OpenGLMobject
from manim.scene.scene import Scene
from manim.utils.iterables import remove_list_redundancies
from manim.utils.parameter_parsing import flatten_iterable_parameters
from manim.utils.rate_functions import linear
if TYPE_CHECKING:
from manim.mobject.opengl.opengl_vectorized_mobject import OpenGLVGroup
from ..mobject.types.vectorized_mobject import VGroup
from manim.mobject.types.vectorized_mobject import VGroup
__all__ = ["AnimationGroup", "Succession", "LaggedStart", "LaggedStartMap"]
@ -54,45 +53,57 @@ class AnimationGroup(Animation):
def __init__(
self,
*animations: Animation,
group: Group | VGroup | OpenGLGroup | OpenGLVGroup = None,
*animations: Animation | Iterable[Animation],
group: Group | VGroup | OpenGLGroup | OpenGLVGroup | None = None,
run_time: float | None = None,
rate_func: Callable[[float], float] = linear,
lag_ratio: float = 0,
**kwargs,
) -> None:
self.animations = [prepare_animation(anim) for anim in animations]
**kwargs: Any,
):
arg_anim = flatten_iterable_parameters(animations)
self.animations = [prepare_animation(anim) for anim in arg_anim]
self.rate_func = rate_func
self.group = group
if self.group is None:
if group is None:
mobjects = remove_list_redundancies(
[anim.mobject for anim in self.animations if not anim.is_introducer()],
)
if config["renderer"] == RendererType.OPENGL:
self.group = OpenGLGroup(*mobjects)
self.group: Group | VGroup | OpenGLGroup | OpenGLVGroup = OpenGLGroup(
*mobjects
)
else:
self.group = Group(*mobjects)
else:
self.group = group
super().__init__(
self.group, rate_func=self.rate_func, lag_ratio=lag_ratio, **kwargs
)
self.run_time: float = self.init_run_time(run_time)
def get_all_mobjects(self) -> Sequence[Mobject]:
def get_all_mobjects(self) -> Sequence[Mobject | OpenGLMobject]:
return list(self.group)
def begin(self) -> None:
if not self.animations:
raise ValueError(
f"Trying to play {self} without animations, this is not supported. "
"Please add at least one subanimation."
)
self.anim_group_time = 0.0
if self.suspend_mobject_updating:
self.group.suspend_updating()
for anim in self.animations:
anim.begin()
def _setup_scene(self, scene) -> None:
def _setup_scene(self, scene: Scene) -> None:
for anim in self.animations:
anim._setup_scene(scene)
def finish(self) -> None:
for anim in self.animations:
anim.finish()
self.anims_begun[:] = True
self.anims_finished[:] = True
if self.suspend_mobject_updating:
self.group.resume_updating()
@ -104,10 +115,12 @@ class AnimationGroup(Animation):
anim.clean_up_from_scene(scene)
def update_mobjects(self, dt: float) -> None:
for anim in self.animations:
for anim in self.anims_with_timings["anim"][
self.anims_begun & ~self.anims_finished
]:
anim.update_mobjects(dt)
def init_run_time(self, run_time) -> float:
def init_run_time(self, run_time: float | None) -> float:
"""Calculates the run time of the animation, if different from ``run_time``.
Parameters
@ -121,22 +134,30 @@ class AnimationGroup(Animation):
The duration of the animation in seconds.
"""
self.build_animations_with_timings()
if self.anims_with_timings:
self.max_end_time = np.max([awt[2] for awt in self.anims_with_timings])
else:
self.max_end_time = 0
# Note: if lag_ratio < 1, then not necessarily the final animation's
# end time will be the max end time! Therefore we must calculate the
# maximum over all the end times, and not just take the last one.
# Example: if you want to play 2 animations of 10s and 1s with a
# lag_ratio of 0.1, the 1st one will end at t=10 and the 2nd one will
# end at t=2, so the AnimationGroup will end at t=10.
self.max_end_time = max(self.anims_with_timings["end"], default=0)
return self.max_end_time if run_time is None else run_time
def build_animations_with_timings(self) -> None:
"""Creates a list of triplets of the form (anim, start_time, end_time)."""
self.anims_with_timings = []
curr_time: float = 0
for anim in self.animations:
start_time: float = curr_time
end_time: float = start_time + anim.get_run_time()
self.anims_with_timings.append((anim, start_time, end_time))
# Start time of next animation is based on the lag_ratio
curr_time = (1 - self.lag_ratio) * start_time + self.lag_ratio * end_time
run_times = np.array([anim.run_time for anim in self.animations])
num_animations = run_times.shape[0]
dtype = [("anim", "O"), ("start", "f8"), ("end", "f8")]
self.anims_with_timings: np.ndarray = np.zeros(num_animations, dtype=dtype)
self.anims_begun: np.ndarray = np.zeros(num_animations, dtype=bool)
self.anims_finished: np.ndarray = np.zeros(num_animations, dtype=bool)
if num_animations == 0:
return
lags = run_times[:-1] * self.lag_ratio
self.anims_with_timings["anim"] = self.animations
self.anims_with_timings["start"][1:] = np.add.accumulate(lags)
self.anims_with_timings["end"] = self.anims_with_timings["start"] + run_times
def interpolate(self, alpha: float) -> None:
# Note, if the run_time of AnimationGroup has been
@ -144,14 +165,34 @@ class AnimationGroup(Animation):
# times might not correspond to actual times,
# e.g. of the surrounding scene. Instead they'd
# be a rescaled version. But that's okay!
time = self.rate_func(alpha) * self.max_end_time
for anim, start_time, end_time in self.anims_with_timings:
anim_time = end_time - start_time
if anim_time == 0:
sub_alpha = 0
else:
sub_alpha = np.clip((time - start_time) / anim_time, 0, 1)
anim.interpolate(sub_alpha)
anim_group_time = self.rate_func(alpha) * self.max_end_time
time_goes_back = anim_group_time < self.anim_group_time
# Only update ongoing animations
awt = self.anims_with_timings
new_begun = anim_group_time >= awt["start"]
new_finished = anim_group_time > awt["end"]
to_update = awt[
(self.anims_begun | new_begun) & (~self.anims_finished | ~new_finished)
]
run_times = to_update["end"] - to_update["start"]
with_zero_run_time = run_times == 0
run_times[with_zero_run_time] = 1
sub_alphas = (anim_group_time - to_update["start"]) / run_times
if time_goes_back:
sub_alphas[(sub_alphas < 0) | with_zero_run_time] = 0
else:
sub_alphas[(sub_alphas > 1) | with_zero_run_time] = 1
for anim_to_update, sub_alpha in zip(
to_update["anim"], sub_alphas, strict=True
):
anim_to_update.interpolate(sub_alpha)
self.anim_group_time = anim_group_time
self.anims_begun = new_begun
self.anims_finished = new_finished
class Succession(AnimationGroup):
@ -191,11 +232,15 @@ class Succession(AnimationGroup):
))
"""
def __init__(self, *animations: Animation, lag_ratio: float = 1, **kwargs) -> None:
def __init__(self, *animations: Animation, lag_ratio: float = 1, **kwargs: Any):
super().__init__(*animations, lag_ratio=lag_ratio, **kwargs)
def begin(self) -> None:
assert len(self.animations) > 0
if not self.animations:
raise ValueError(
f"Trying to play {self} without animations, this is not supported. "
"Please add at least one subanimation."
)
self.update_active_animation(0)
def finish(self) -> None:
@ -206,7 +251,7 @@ class Succession(AnimationGroup):
if self.active_animation:
self.active_animation.update_mobjects(dt)
def _setup_scene(self, scene) -> None:
def _setup_scene(self, scene: Scene | None) -> None:
if scene is None:
return
if self.is_introducer():
@ -226,8 +271,8 @@ class Succession(AnimationGroup):
self.active_animation = self.animations[index]
self.active_animation._setup_scene(self.scene)
self.active_animation.begin()
self.active_start_time = self.anims_with_timings[index][1]
self.active_end_time = self.anims_with_timings[index][2]
self.active_start_time = self.anims_with_timings[index]["start"]
self.active_end_time = self.anims_with_timings[index]["end"]
def next_animation(self) -> None:
"""Proceeds to the next animation.
@ -244,7 +289,7 @@ class Succession(AnimationGroup):
self.next_animation()
if self.active_animation is not None and self.active_start_time is not None:
elapsed = current_time - self.active_start_time
active_run_time = self.active_animation.get_run_time()
active_run_time = self.active_animation.run_time
subalpha = elapsed / active_run_time if active_run_time != 0.0 else 1.0
self.active_animation.interpolate(subalpha)
@ -298,7 +343,7 @@ class LaggedStart(AnimationGroup):
self,
*animations: Animation,
lag_ratio: float = DEFAULT_LAGGED_START_LAG_RATIO,
**kwargs,
**kwargs: Any,
):
super().__init__(*animations, lag_ratio=lag_ratio, **kwargs)
@ -308,7 +353,7 @@ class LaggedStartMap(LaggedStart):
Parameters
----------
AnimationClass
animation_class
:class:`~.Animation` to apply to mobject.
mobject
:class:`~.Mobject` whose submobjects the animation, and optionally the function,
@ -317,6 +362,17 @@ class LaggedStartMap(LaggedStart):
Function which will be applied to :class:`~.Mobject`.
run_time
The duration of the animation in seconds.
lag_ratio
Defines the delay after which the animation is applied to submobjects. A lag_ratio of
``n.nn`` means the next animation will play when ``nnn%`` of the current animation has played.
Defaults to 0.05, meaning that the next animation will begin when 5% of the current
animation has played.
This does not influence the total runtime of the animation. Instead the runtime
of individual animations is adjusted so that the complete animation has the defined
run time.
kwargs
Further keyword arguments that are passed to `animation_class`.
Examples
--------
@ -343,20 +399,23 @@ class LaggedStartMap(LaggedStart):
def __init__(
self,
AnimationClass: Callable[..., Animation],
animation_class: type[Animation],
mobject: Mobject,
arg_creator: Callable[[Mobject], str] = None,
arg_creator: Callable[[Mobject], Iterable[Any]] | None = None,
run_time: float = 2,
**kwargs,
) -> None:
args_list = []
for submob in mobject:
if arg_creator:
args_list.append(arg_creator(submob))
else:
args_list.append((submob,))
lag_ratio: float = DEFAULT_LAGGED_START_LAG_RATIO,
**kwargs: Any,
):
if arg_creator is None:
def identity(mob: Mobject) -> Mobject:
return mob
arg_creator = identity
args_list = [arg_creator(submob) for submob in mobject]
anim_kwargs = dict(kwargs)
if "lag_ratio" in anim_kwargs:
anim_kwargs.pop("lag_ratio")
animations = [AnimationClass(*args, **anim_kwargs) for args in args_list]
super().__init__(*animations, run_time=run_time, **kwargs)
animations = [animation_class(*args, **anim_kwargs) for args in args_list]
super().__init__(*animations, run_time=run_time, lag_ratio=lag_ratio)

View file

@ -70,17 +70,22 @@ __all__ = [
"RemoveTextLetterByLetter",
"ShowSubmobjectsOneByOne",
"AddTextWordByWord",
"TypeWithCursor",
"UntypeWithCursor",
]
import itertools as it
from typing import TYPE_CHECKING, Callable, Iterable, Sequence
from collections.abc import Callable, Iterable, Sequence
from typing import TYPE_CHECKING
import numpy as np
if TYPE_CHECKING:
from manim.mobject.text.text_mobject import Text
from manim.scene.scene import Scene
from manim.constants import RIGHT, TAU
from manim.mobject.opengl.opengl_surface import OpenGLSurface
from manim.mobject.opengl.opengl_vectorized_mobject import OpenGLVMobject
from manim.utils.color import ManimColor
@ -88,7 +93,6 @@ from manim.utils.color import ManimColor
from .. import config
from ..animation.animation import Animation
from ..animation.composition import Succession
from ..constants import TAU
from ..mobject.mobject import Group, Mobject
from ..mobject.types.vectorized_mobject import VMobject
from ..utils.bezier import integer_interpolate
@ -116,7 +120,7 @@ class ShowPartial(Animation):
):
pointwise = getattr(mobject, "pointwise_become_partial", None)
if not callable(pointwise):
raise NotImplementedError("This animation is not defined for this Mobject.")
raise TypeError(f"{self.__class__.__name__} only works for VMobjects.")
super().__init__(mobject, **kwargs)
def interpolate_submobject(
@ -129,7 +133,7 @@ class ShowPartial(Animation):
starting_submobject, *self._get_bounds(alpha)
)
def _get_bounds(self, alpha: float) -> None:
def _get_bounds(self, alpha: float) -> tuple[float, float]:
raise NotImplementedError("Please use Create or ShowPassingFlash")
@ -169,7 +173,7 @@ class Create(ShowPartial):
) -> None:
super().__init__(mobject, lag_ratio=lag_ratio, introducer=introducer, **kwargs)
def _get_bounds(self, alpha: float) -> tuple[int, float]:
def _get_bounds(self, alpha: float) -> tuple[float, float]:
return (0, alpha)
@ -225,8 +229,6 @@ class DrawBorderThenFill(Animation):
rate_func: Callable[[float], float] = double_smooth,
stroke_width: float = 2,
stroke_color: str = None,
draw_border_animation_config: dict = {}, # what does this dict accept?
fill_animation_config: dict = {},
introducer: bool = True,
**kwargs,
) -> None:
@ -240,13 +242,13 @@ class DrawBorderThenFill(Animation):
)
self.stroke_width = stroke_width
self.stroke_color = stroke_color
self.draw_border_animation_config = draw_border_animation_config
self.fill_animation_config = fill_animation_config
self.outline = self.get_outline()
def _typecheck_input(self, vmobject: VMobject | OpenGLVMobject) -> None:
if not isinstance(vmobject, (VMobject, OpenGLVMobject)):
raise TypeError("DrawBorderThenFill only works for vectorized Mobjects")
raise TypeError(
f"{self.__class__.__name__} only works for vectorized Mobjects"
)
def begin(self) -> None:
self.outline = self.get_outline()
@ -277,7 +279,7 @@ class DrawBorderThenFill(Animation):
alpha: float,
) -> None: # Fixme: not matching the parent class? What is outline doing here?
index: int
subalpha: int
subalpha: float
index, subalpha = integer_interpolate(0, 2, alpha)
if index == 0:
submobject.pointwise_become_partial(outline, 0, subalpha)
@ -347,10 +349,7 @@ class Write(DrawBorderThenFill):
) -> tuple[float, float]:
length = len(vmobject.family_members_with_points())
if run_time is None:
if length < 15:
run_time = 1
else:
run_time = 2
run_time = 1 if length < 15 else 2
if lag_ratio is None:
lag_ratio = min(4.0 / max(1.0, length), 0.2)
return run_time, lag_ratio
@ -456,7 +455,7 @@ class SpiralIn(Animation):
fade_in_fraction=0.3,
**kwargs,
) -> None:
self.shapes = shapes
self.shapes = shapes.copy()
self.scale_factor = scale_factor
self.shape_center = shapes.get_center()
self.fade_in_fraction = fade_in_fraction
@ -473,15 +472,21 @@ class SpiralIn(Animation):
def interpolate_mobject(self, alpha: float) -> None:
alpha = self.rate_func(alpha)
for shape in self.shapes:
for original_shape, shape in zip(self.shapes, self.mobject, strict=True):
shape.restore()
shape.save_state()
opacity = shape.get_fill_opacity()
new_opacity = min(opacity, alpha * opacity / self.fade_in_fraction)
fill_opacity = original_shape.get_fill_opacity()
stroke_opacity = original_shape.get_stroke_opacity()
new_fill_opacity = min(
fill_opacity, alpha * fill_opacity / self.fade_in_fraction
)
new_stroke_opacity = min(
stroke_opacity, alpha * stroke_opacity / self.fade_in_fraction
)
shape.shift((shape.final_position - shape.initial_position) * alpha)
shape.rotate(TAU * alpha, about_point=self.shape_center)
shape.rotate(-TAU * alpha, about_point=shape.get_center_of_mass())
shape.set_opacity(new_opacity)
shape.set_fill(opacity=new_fill_opacity)
shape.set_stroke(opacity=new_stroke_opacity)
class ShowIncreasingSubsets(Animation):
@ -668,3 +673,176 @@ class AddTextWordByWord(Succession):
)
)
super().__init__(*anims, **kwargs)
class TypeWithCursor(AddTextLetterByLetter):
"""Similar to :class:`~.AddTextLetterByLetter` , but with an additional cursor mobject at the end.
Parameters
----------
time_per_char
Frequency of appearance of the letters.
cursor
:class:`~.Mobject` shown after the last added letter.
buff
Controls how far away the cursor is to the right of the last added letter.
keep_cursor_y
If ``True``, the cursor's y-coordinate is set to the center of the ``Text`` and remains the same throughout the animation. Otherwise, it is set to the center of the last added letter.
leave_cursor_on
Whether to show the cursor after the animation.
.. tip::
This is currently only possible for class:`~.Text` and not for class:`~.MathTex`.
Examples
--------
.. manim:: InsertingTextExample
:ref_classes: Blink
class InsertingTextExample(Scene):
def construct(self):
text = Text("Inserting", color=PURPLE).scale(1.5).to_edge(LEFT)
cursor = Rectangle(
color = GREY_A,
fill_color = GREY_A,
fill_opacity = 1.0,
height = 1.1,
width = 0.5,
).move_to(text[0]) # Position the cursor
self.play(TypeWithCursor(text, cursor))
self.play(Blink(cursor, blinks=2))
"""
def __init__(
self,
text: Text,
cursor: Mobject,
buff: float = 0.1,
keep_cursor_y: bool = True,
leave_cursor_on: bool = True,
time_per_char: float = 0.1,
reverse_rate_function=False,
introducer=True,
**kwargs,
) -> None:
self.cursor = cursor
self.buff = buff
self.keep_cursor_y = keep_cursor_y
self.leave_cursor_on = leave_cursor_on
super().__init__(
text,
time_per_char=time_per_char,
reverse_rate_function=reverse_rate_function,
introducer=introducer,
**kwargs,
)
def begin(self) -> None:
self.y_cursor = self.cursor.get_y()
self.cursor.initial_position = self.mobject.get_center()
if self.keep_cursor_y:
self.cursor.set_y(self.y_cursor)
self.cursor.set_opacity(0)
self.mobject.add(self.cursor)
super().begin()
def finish(self) -> None:
if self.leave_cursor_on:
self.cursor.set_opacity(1)
else:
self.cursor.set_opacity(0)
self.mobject.remove(self.cursor)
super().finish()
def clean_up_from_scene(self, scene: Scene) -> None:
if not self.leave_cursor_on:
scene.remove(self.cursor)
super().clean_up_from_scene(scene)
def update_submobject_list(self, index: int) -> None:
for mobj in self.all_submobs[:index]:
mobj.set_opacity(1)
for mobj in self.all_submobs[index:]:
mobj.set_opacity(0)
if index != 0:
self.cursor.next_to(
self.all_submobs[index - 1], RIGHT, buff=self.buff
).set_y(self.cursor.initial_position[1])
else:
self.cursor.move_to(self.all_submobs[0]).set_y(
self.cursor.initial_position[1]
)
if self.keep_cursor_y:
self.cursor.set_y(self.y_cursor)
self.cursor.set_opacity(1)
class UntypeWithCursor(TypeWithCursor):
"""Similar to :class:`~.RemoveTextLetterByLetter` , but with an additional cursor mobject at the end.
Parameters
----------
time_per_char
Frequency of appearance of the letters.
cursor
:class:`~.Mobject` shown after the last added letter.
buff
Controls how far away the cursor is to the right of the last added letter.
keep_cursor_y
If ``True``, the cursor's y-coordinate is set to the center of the ``Text`` and remains the same throughout the animation. Otherwise, it is set to the center of the last added letter.
leave_cursor_on
Whether to show the cursor after the animation.
.. tip::
This is currently only possible for class:`~.Text` and not for class:`~.MathTex`.
Examples
--------
.. manim:: DeletingTextExample
:ref_classes: Blink
class DeletingTextExample(Scene):
def construct(self):
text = Text("Deleting", color=PURPLE).scale(1.5).to_edge(LEFT)
cursor = Rectangle(
color = GREY_A,
fill_color = GREY_A,
fill_opacity = 1.0,
height = 1.1,
width = 0.5,
).move_to(text[0]) # Position the cursor
self.play(UntypeWithCursor(text, cursor))
self.play(Blink(cursor, blinks=2))
"""
def __init__(
self,
text: Text,
cursor: VMobject | None = None,
time_per_char: float = 0.1,
reverse_rate_function=True,
introducer=False,
remover=True,
**kwargs,
) -> None:
super().__init__(
text,
cursor=cursor,
time_per_char=time_per_char,
reverse_rate_function=reverse_rate_function,
introducer=introducer,
remover=remover,
**kwargs,
)

View file

@ -12,7 +12,6 @@
"""
from __future__ import annotations
__all__ = [
@ -20,6 +19,8 @@ __all__ = [
"FadeIn",
]
from typing import Any
import numpy as np
from manim.mobject.opengl.opengl_mobject import OpenGLMobject
@ -54,14 +55,11 @@ class _Fade(Transform):
shift: np.ndarray | None = None,
target_position: np.ndarray | Mobject | None = None,
scale: float = 1,
**kwargs,
**kwargs: Any,
) -> None:
if not mobjects:
raise ValueError("At least one mobject must be passed.")
if len(mobjects) == 1:
mobject = mobjects[0]
else:
mobject = Group(*mobjects)
mobject = mobjects[0] if len(mobjects) == 1 else Group(*mobjects)
self.point_target = False
if shift is None:
@ -89,7 +87,7 @@ class _Fade(Transform):
Mobject
The faded, shifted and scaled copy of the mobject.
"""
faded_mobject = self.mobject.copy()
faded_mobject: Mobject = self.mobject.copy() # type: ignore[assignment]
faded_mobject.fade(1)
direction_modifier = -1 if fadeIn and not self.point_target else 1
faded_mobject.shift(self.shift_vector * direction_modifier)
@ -98,7 +96,7 @@ class _Fade(Transform):
class FadeIn(_Fade):
"""Fade in :class:`~.Mobject` s.
r"""Fade in :class:`~.Mobject` s.
Parameters
----------
@ -123,7 +121,7 @@ class FadeIn(_Fade):
dot = Dot(UP * 2 + LEFT)
self.add(dot)
tex = Tex(
"FadeIn with ", "shift ", " or target\\_position", " and scale"
"FadeIn with ", "shift ", r" or target\_position", " and scale"
).scale(1)
animations = [
FadeIn(tex[0]),
@ -135,18 +133,18 @@ class FadeIn(_Fade):
"""
def __init__(self, *mobjects: Mobject, **kwargs) -> None:
def __init__(self, *mobjects: Mobject, **kwargs: Any) -> None:
super().__init__(*mobjects, introducer=True, **kwargs)
def create_target(self):
return self.mobject
def create_target(self) -> Mobject:
return self.mobject # type: ignore[return-value]
def create_starting_mobject(self):
def create_starting_mobject(self) -> Mobject:
return self._create_faded_mobject(fadeIn=True)
class FadeOut(_Fade):
"""Fade out :class:`~.Mobject` s.
r"""Fade out :class:`~.Mobject` s.
Parameters
----------
@ -170,7 +168,7 @@ class FadeOut(_Fade):
dot = Dot(UP * 2 + LEFT)
self.add(dot)
tex = Tex(
"FadeOut with ", "shift ", " or target\\_position", " and scale"
"FadeOut with ", "shift ", r" or target\_position", " and scale"
).scale(1)
animations = [
FadeOut(tex[0]),
@ -183,12 +181,12 @@ class FadeOut(_Fade):
"""
def __init__(self, *mobjects: Mobject, **kwargs) -> None:
def __init__(self, *mobjects: Mobject, **kwargs: Any) -> None:
super().__init__(*mobjects, remover=True, **kwargs)
def create_target(self):
def create_target(self) -> Mobject:
return self._create_faded_mobject(fadeIn=False)
def clean_up_from_scene(self, scene: Scene = None) -> None:
def clean_up_from_scene(self, scene: Scene) -> None:
super().clean_up_from_scene(scene)
self.interpolate(0)

View file

@ -31,16 +31,17 @@ __all__ = [
"SpinInFromNothing",
]
import typing
import numpy as np
from typing import TYPE_CHECKING, Any
from ..animation.transform import Transform
from ..constants import PI
from ..utils.paths import spiral_path
if typing.TYPE_CHECKING:
if TYPE_CHECKING:
from manim.mobject.geometry.line import Arrow
from manim.mobject.opengl.opengl_mobject import OpenGLMobject
from manim.typing import Point3DLike, Vector3DLike
from manim.utils.color import ParsableManimColor
from ..mobject.mobject import Mobject
@ -76,16 +77,20 @@ class GrowFromPoint(Transform):
"""
def __init__(
self, mobject: Mobject, point: np.ndarray, point_color: str = None, **kwargs
) -> None:
self,
mobject: Mobject,
point: Point3DLike,
point_color: ParsableManimColor | None = None,
**kwargs: Any,
):
self.point = point
self.point_color = point_color
super().__init__(mobject, introducer=True, **kwargs)
def create_target(self) -> Mobject:
def create_target(self) -> Mobject | OpenGLMobject:
return self.mobject
def create_starting_mobject(self) -> Mobject:
def create_starting_mobject(self) -> Mobject | OpenGLMobject:
start = super().create_starting_mobject()
start.scale(0)
start.move_to(self.point)
@ -118,7 +123,12 @@ class GrowFromCenter(GrowFromPoint):
"""
def __init__(self, mobject: Mobject, point_color: str = None, **kwargs) -> None:
def __init__(
self,
mobject: Mobject,
point_color: ParsableManimColor | None = None,
**kwargs: Any,
):
point = mobject.get_center()
super().__init__(mobject, point, point_color=point_color, **kwargs)
@ -153,8 +163,12 @@ class GrowFromEdge(GrowFromPoint):
"""
def __init__(
self, mobject: Mobject, edge: np.ndarray, point_color: str = None, **kwargs
) -> None:
self,
mobject: Mobject,
edge: Vector3DLike,
point_color: ParsableManimColor | None = None,
**kwargs: Any,
):
point = mobject.get_critical_point(edge)
super().__init__(mobject, point, point_color=point_color, **kwargs)
@ -183,11 +197,13 @@ class GrowArrow(GrowFromPoint):
"""
def __init__(self, arrow: Arrow, point_color: str = None, **kwargs) -> None:
def __init__(
self, arrow: Arrow, point_color: ParsableManimColor | None = None, **kwargs: Any
):
point = arrow.get_start()
super().__init__(arrow, point, point_color=point_color, **kwargs)
def create_starting_mobject(self) -> Mobject:
def create_starting_mobject(self) -> Mobject | OpenGLMobject:
start_arrow = self.mobject.copy()
start_arrow.scale(0, scale_tips=True, about_point=self.point)
if self.point_color:
@ -224,8 +240,12 @@ class SpinInFromNothing(GrowFromCenter):
"""
def __init__(
self, mobject: Mobject, angle: float = PI / 2, point_color: str = None, **kwargs
) -> None:
self,
mobject: Mobject,
angle: float = PI / 2,
point_color: ParsableManimColor | None = None,
**kwargs: Any,
):
self.angle = angle
super().__init__(
mobject, path_func=spiral_path(angle), point_color=point_color, **kwargs

View file

@ -25,19 +25,22 @@ Examples
"""
from __future__ import annotations
__all__ = [
"FocusOn",
"Indicate",
"Flash",
"ShowPassingFlash",
"ShowPassingFlashWithThinningStrokeWidth",
"ShowCreationThenFadeOut",
"ApplyWave",
"Circumscribe",
"Wiggle",
"Blink",
]
from typing import Callable, Iterable, Optional, Tuple, Type, Union
from collections.abc import Iterable
from typing import Any, Self
import numpy as np
@ -45,6 +48,7 @@ from manim.mobject.geometry.arc import Circle, Dot
from manim.mobject.geometry.line import Line
from manim.mobject.geometry.polygram import Rectangle
from manim.mobject.geometry.shape_matchers import SurroundingRectangle
from manim.mobject.opengl.opengl_mobject import OpenGLMobject
from manim.scene.scene import Scene
from .. import config
@ -54,13 +58,14 @@ from ..animation.creation import Create, ShowPartial, Uncreate
from ..animation.fading import FadeIn, FadeOut
from ..animation.movement import Homotopy
from ..animation.transform import Transform
from ..animation.updaters.update import UpdateFromFunc
from ..constants import *
from ..mobject.mobject import Mobject
from ..mobject.types.vectorized_mobject import VGroup, VMobject
from ..typing import Point3D, Point3DLike, Vector3DLike
from ..utils.bezier import interpolate, inverse_interpolate
from ..utils.color import GREY, YELLOW, ParsableManimColor
from ..utils.deprecation import deprecated
from ..utils.rate_functions import smooth, there_and_back, wiggle
from ..utils.color import GREY, PURE_YELLOW, ParsableManimColor
from ..utils.rate_functions import RateFunction, smooth, there_and_back, wiggle
from ..utils.space_ops import normalize
@ -77,8 +82,6 @@ class FocusOn(Transform):
The color of the spotlight.
run_time
The duration of the animation.
kwargs
Additional arguments to be passed to the :class:`~.Succession` constructor
Examples
--------
@ -86,7 +89,7 @@ class FocusOn(Transform):
class UsingFocusOn(Scene):
def construct(self):
dot = Dot(color=YELLOW).shift(DOWN)
dot = Dot(color=PURE_YELLOW).shift(DOWN)
self.add(Tex("Focusing on the dot below:"), dot)
self.play(FocusOn(dot))
self.wait()
@ -94,12 +97,12 @@ class FocusOn(Transform):
def __init__(
self,
focus_point: Union[np.ndarray, Mobject],
focus_point: Point3DLike | Mobject,
opacity: float = 0.2,
color: str = GREY,
color: ParsableManimColor = GREY,
run_time: float = 2,
**kwargs
) -> None:
**kwargs: Any,
):
self.focus_point = focus_point
self.color = color
self.opacity = opacity
@ -131,7 +134,7 @@ class Indicate(Transform):
color
The color the mobject temporally takes.
rate_func
The function definig the animation progress at every point in time.
The function defining the animation progress at every point in time.
kwargs
Additional arguments to be passed to the :class:`~.Succession` constructor
@ -148,17 +151,17 @@ class Indicate(Transform):
def __init__(
self,
mobject: "Mobject",
mobject: Mobject,
scale_factor: float = 1.2,
color: str = YELLOW,
rate_func: Callable[[float, Optional[float]], np.ndarray] = there_and_back,
**kwargs
) -> None:
color: ParsableManimColor = PURE_YELLOW,
rate_func: RateFunction = there_and_back,
**kwargs: Any,
):
self.color = color
self.scale_factor = scale_factor
super().__init__(mobject, rate_func=rate_func, **kwargs)
def create_target(self) -> "Mobject":
def create_target(self) -> Mobject | OpenGLMobject:
target = self.mobject.copy()
target.scale(self.scale_factor)
target.set_color(self.color)
@ -195,7 +198,7 @@ class Flash(AnimationGroup):
class UsingFlash(Scene):
def construct(self):
dot = Dot(color=YELLOW).shift(DOWN)
dot = Dot(color=PURE_YELLOW).shift(DOWN)
self.add(Tex("Flash the dot below:"), dot)
self.play(Flash(dot))
self.wait()
@ -218,20 +221,20 @@ class Flash(AnimationGroup):
def __init__(
self,
point: Union[np.ndarray, Mobject],
point: Point3DLike | Mobject,
line_length: float = 0.2,
num_lines: int = 12,
flash_radius: float = 0.1,
line_stroke_width: int = 3,
color: str = YELLOW,
color: ParsableManimColor = PURE_YELLOW,
time_width: float = 1,
run_time: float = 1.0,
**kwargs
) -> None:
**kwargs: Any,
):
if isinstance(point, Mobject):
self.point = point.get_center()
self.point: Point3D = point.get_center()
else:
self.point = point
self.point = np.asarray(point)
self.color = color
self.line_length = line_length
self.num_lines = num_lines
@ -256,7 +259,7 @@ class Flash(AnimationGroup):
lines.set_stroke(width=self.line_stroke_width)
return lines
def create_line_anims(self) -> Iterable["ShowPassingFlash"]:
def create_line_anims(self) -> Iterable[ShowPassingFlash]:
return [
ShowPassingFlash(
line,
@ -269,7 +272,7 @@ class Flash(AnimationGroup):
class ShowPassingFlash(ShowPartial):
"""Show only a sliver of the VMobject each frame.
r"""Show only a sliver of the VMobject each frame.
Parameters
----------
@ -289,7 +292,7 @@ class ShowPassingFlash(ShowPartial):
self.add(p, lbl)
p = p.copy().set_color(BLUE)
for time_width in [0.2, 0.5, 1, 2]:
lbl.become(Tex(r"\\texttt{time\\_width={{%.1f}}}"%time_width))
lbl.become(Tex(r"\texttt{time\_width={{%.1f}}}"%time_width))
self.play(ShowPassingFlash(
p.copy().set_color(BLUE),
run_time=2,
@ -302,11 +305,13 @@ class ShowPassingFlash(ShowPartial):
"""
def __init__(self, mobject: "VMobject", time_width: float = 0.1, **kwargs) -> None:
def __init__(
self, mobject: VMobject, time_width: float = 0.1, **kwargs: Any
) -> None:
self.time_width = time_width
super().__init__(mobject, remover=True, introducer=True, **kwargs)
def _get_bounds(self, alpha: float) -> Tuple[float]:
def _get_bounds(self, alpha: float) -> tuple[float, float]:
tw = self.time_width
upper = interpolate(0, 1 + tw, alpha)
lower = upper - tw
@ -321,7 +326,14 @@ class ShowPassingFlash(ShowPartial):
class ShowPassingFlashWithThinningStrokeWidth(AnimationGroup):
def __init__(self, vmobject, n_segments=10, time_width=0.1, remover=True, **kwargs):
def __init__(
self,
vmobject: VMobject,
n_segments: int = 10,
time_width: float = 0.1,
remover: bool = True,
**kwargs: Any,
):
self.n_segments = n_segments
self.time_width = time_width
self.remover = remover
@ -337,21 +349,12 @@ class ShowPassingFlashWithThinningStrokeWidth(AnimationGroup):
for stroke_width, time_width in zip(
np.linspace(0, max_stroke_width, self.n_segments),
np.linspace(max_time_width, 0, self.n_segments),
strict=True,
)
),
)
@deprecated(
since="v0.15.0",
until="v0.16.0",
message="Use Create then FadeOut to achieve this effect.",
)
class ShowCreationThenFadeOut(Succession):
def __init__(self, mobject: "Mobject", remover: bool = True, **kwargs) -> None:
super().__init__(Create(mobject), FadeOut(mobject), remover=remover, **kwargs)
class ApplyWave(Homotopy):
"""Send a wave through the Mobject distorting it temporarily.
@ -397,25 +400,25 @@ class ApplyWave(Homotopy):
def __init__(
self,
mobject: "Mobject",
direction: np.ndarray = UP,
mobject: Mobject,
direction: Vector3DLike = UP,
amplitude: float = 0.2,
wave_func: Callable[[float], float] = smooth,
wave_func: RateFunction = smooth,
time_width: float = 1,
ripples: int = 1,
run_time: float = 2,
**kwargs
) -> None:
**kwargs: Any,
):
x_min = mobject.get_left()[0]
x_max = mobject.get_right()[0]
vect = amplitude * normalize(direction)
def wave(t):
def wave(t: float) -> float:
# Creates a wave with n ripples from a simple rate_func
# This wave is build up as follows:
# The time is split into 2*ripples phases. In every phase the amplitude
# either rises to one or goes down to zero. Consecutive ripples will have
# their amplitudes in oppising directions (first ripple from 0 to 1 to 0,
# their amplitudes in opposing directions (first ripple from 0 to 1 to 0,
# second from 0 to -1 to 0 and so on). This is how two ripples would be
# divided into phases:
@ -454,7 +457,7 @@ class ApplyWave(Homotopy):
return wave_func(t * phases)
elif phase == phases - 1:
# last ripple. Rising or falling depending on the number of ripples
# The (ripples % 2)-term is used to make this destinction.
# The (ripples % 2)-term is used to make this distinction.
t -= phase / phases # Time relative to the phase
return (1 - wave_func(t * phases)) * (2 * (ripples % 2) - 1)
else:
@ -470,13 +473,14 @@ class ApplyWave(Homotopy):
y: float,
z: float,
t: float,
) -> Tuple[float, float, float]:
) -> tuple[float, float, float]:
upper = interpolate(0, 1 + time_width, t)
lower = upper - time_width
relative_x = inverse_interpolate(x_min, x_max, x)
wave_phase = inverse_interpolate(lower, upper, relative_x)
nudge = wave(wave_phase) * vect
return np.array([x, y, z]) + nudge
return_value: tuple[float, float, float] = np.array([x, y, z]) + nudge
return return_value
super().__init__(homotopy, mobject, run_time=run_time, **kwargs)
@ -516,38 +520,42 @@ class Wiggle(Animation):
def __init__(
self,
mobject: "Mobject",
mobject: Mobject,
scale_value: float = 1.1,
rotation_angle: float = 0.01 * TAU,
n_wiggles: int = 6,
scale_about_point: Optional[np.ndarray] = None,
rotate_about_point: Optional[np.ndarray] = None,
scale_about_point: Point3DLike | None = None,
rotate_about_point: Point3DLike | None = None,
run_time: float = 2,
**kwargs
) -> None:
**kwargs: Any,
):
self.scale_value = scale_value
self.rotation_angle = rotation_angle
self.n_wiggles = n_wiggles
self.scale_about_point = scale_about_point
if scale_about_point is not None:
self.scale_about_point = np.array(scale_about_point)
self.rotate_about_point = rotate_about_point
if rotate_about_point is not None:
self.rotate_about_point = np.array(rotate_about_point)
super().__init__(mobject, run_time=run_time, **kwargs)
def get_scale_about_point(self) -> np.ndarray:
def get_scale_about_point(self) -> Point3D:
if self.scale_about_point is None:
return self.mobject.get_center()
return self.scale_about_point
def get_rotate_about_point(self) -> np.ndarray:
def get_rotate_about_point(self) -> Point3D:
if self.rotate_about_point is None:
return self.mobject.get_center()
return self.rotate_about_point
def interpolate_submobject(
self,
submobject: "Mobject",
starting_submobject: "Mobject",
submobject: Mobject,
starting_submobject: Mobject,
alpha: float,
) -> None:
) -> Self:
submobject.points[:, :] = starting_submobject.points
submobject.scale(
interpolate(1, self.scale_value, there_and_back(alpha)),
@ -557,17 +565,18 @@ class Wiggle(Animation):
wiggle(alpha, self.n_wiggles) * self.rotation_angle,
about_point=self.get_rotate_about_point(),
)
return self
class Circumscribe(Succession):
"""Draw a temporary line surrounding the mobject.
r"""Draw a temporary line surrounding the mobject.
Parameters
----------
mobject
The mobject to be circumscribed.
shape
The shape with which to surrond the given mobject. Should be either
The shape with which to surround the given mobject. Should be either
:class:`~.Rectangle` or :class:`~.Circle`
fade_in
Whether to make the surrounding shape to fade in. It will be drawn otherwise.
@ -591,7 +600,7 @@ class Circumscribe(Succession):
class UsingCircumscribe(Scene):
def construct(self):
lbl = Tex(r"Circum-\\\\scribe").scale(2)
lbl = Tex(r"Circum-\\scribe").scale(2)
self.add(lbl)
self.play(Circumscribe(lbl))
self.play(Circumscribe(lbl, Circle))
@ -604,21 +613,21 @@ class Circumscribe(Succession):
def __init__(
self,
mobject: Mobject,
shape: Type = Rectangle,
fade_in=False,
fade_out=False,
time_width=0.3,
shape: type[Rectangle] | type[Circle] = Rectangle,
fade_in: bool = False,
fade_out: bool = False,
time_width: float = 0.3,
buff: float = SMALL_BUFF,
color: ParsableManimColor = YELLOW,
run_time=1,
stroke_width=DEFAULT_STROKE_WIDTH,
**kwargs
color: ParsableManimColor = PURE_YELLOW,
run_time: float = 1,
stroke_width: float = DEFAULT_STROKE_WIDTH,
**kwargs: Any,
):
if shape is Rectangle:
frame = SurroundingRectangle(
frame: SurroundingRectangle | Circle = SurroundingRectangle(
mobject,
color,
buff,
color=color,
buff=buff,
stroke_width=stroke_width,
)
elif shape is Circle:
@ -654,3 +663,68 @@ class Circumscribe(Succession):
super().__init__(
ShowPassingFlash(frame, time_width, run_time=run_time), **kwargs
)
class Blink(Succession):
"""Blink the mobject.
Parameters
----------
mobject
The mobject to be blinked.
time_on
The duration that the mobject is shown for one blink.
time_off
The duration that the mobject is hidden for one blink.
blinks
The number of blinks
hide_at_end
Whether to hide the mobject at the end of the animation.
kwargs
Additional arguments to be passed to the :class:`~.Succession` constructor.
Examples
--------
.. manim:: BlinkingExample
class BlinkingExample(Scene):
def construct(self):
text = Text("Blinking").scale(1.5)
self.add(text)
self.play(Blink(text, blinks=3))
"""
def __init__(
self,
mobject: Mobject,
time_on: float = 0.5,
time_off: float = 0.5,
blinks: int = 1,
hide_at_end: bool = False,
**kwargs: Any,
):
animations = [
UpdateFromFunc(
mobject,
update_function=lambda mob: mob.set_opacity(1.0),
run_time=time_on,
),
UpdateFromFunc(
mobject,
update_function=lambda mob: mob.set_opacity(0.0),
run_time=time_off,
),
] * blinks
if not hide_at_end:
animations.append(
UpdateFromFunc(
mobject,
update_function=lambda mob: mob.set_opacity(1.0),
run_time=time_on,
),
)
super().__init__(*animations, **kwargs)

View file

@ -10,7 +10,8 @@ __all__ = [
"MoveAlongPath",
]
from typing import TYPE_CHECKING, Any, Callable
from collections.abc import Callable
from typing import TYPE_CHECKING, Any
import numpy as np
@ -18,7 +19,13 @@ from ..animation.animation import Animation
from ..utils.rate_functions import linear
if TYPE_CHECKING:
from ..mobject.mobject import Mobject, VMobject
from typing import Self
from manim.mobject.types.vectorized_mobject import VMobject
from manim.typing import MappingFunction, Point3D
from manim.utils.rate_functions import RateFunction
from ..mobject.mobject import Mobject
class Homotopy(Animation):
@ -44,6 +51,26 @@ class Homotopy(Animation):
Keyword arguments propagated to :meth:`.Mobject.apply_function`.
kwargs
Further keyword arguments passed to the parent class.
Examples
--------
.. manim:: HomotopyExample
class HomotopyExample(Scene):
def construct(self):
square = Square()
def homotopy(x, y, z, t):
if t <= 0.25:
progress = t / 0.25
return (x, y + progress * 0.2 * np.sin(x), z)
else:
wave_progress = (t - 0.25) / 0.75
return (x, y + 0.2 * np.sin(x + 10 * wave_progress), z)
self.play(Homotopy(homotopy, square, rate_func= linear, run_time=2))
"""
def __init__(
@ -52,27 +79,33 @@ class Homotopy(Animation):
mobject: Mobject,
run_time: float = 3,
apply_function_kwargs: dict[str, Any] | None = None,
**kwargs,
) -> None:
**kwargs: Any,
):
self.homotopy = homotopy
self.apply_function_kwargs = (
apply_function_kwargs if apply_function_kwargs is not None else {}
)
super().__init__(mobject, run_time=run_time, **kwargs)
def function_at_time_t(self, t: float) -> tuple[float, float, float]:
return lambda p: self.homotopy(*p, t)
def function_at_time_t(self, t: float) -> MappingFunction:
def mapping_function(p: Point3D) -> Point3D:
x, y, z = p
return np.array(self.homotopy(x, y, z, t))
return mapping_function
def interpolate_submobject(
self,
submobject: Mobject,
starting_submobject: Mobject,
alpha: float,
) -> None:
) -> Self:
submobject.points = starting_submobject.points
submobject.apply_function(
self.function_at_time_t(alpha), **self.apply_function_kwargs
self.function_at_time_t(alpha),
**self.apply_function_kwargs,
)
return self
class SmoothedVectorizedHomotopy(Homotopy):
@ -81,18 +114,21 @@ class SmoothedVectorizedHomotopy(Homotopy):
submobject: Mobject,
starting_submobject: Mobject,
alpha: float,
) -> None:
) -> Self:
assert isinstance(submobject, VMobject)
super().interpolate_submobject(submobject, starting_submobject, alpha)
submobject.make_smooth()
return self
class ComplexHomotopy(Homotopy):
def __init__(
self, complex_homotopy: Callable[[complex], float], mobject: Mobject, **kwargs
) -> None:
"""
Complex Homotopy a function Cx[0, 1] to C
"""
self,
complex_homotopy: Callable[[complex, float], float],
mobject: Mobject,
**kwargs: Any,
):
"""Complex Homotopy a function Cx[0, 1] to C"""
def homotopy(
x: float,
@ -113,9 +149,9 @@ class PhaseFlow(Animation):
mobject: Mobject,
virtual_time: float = 1,
suspend_mobject_updating: bool = False,
rate_func: Callable[[float], float] = linear,
**kwargs,
) -> None:
rate_func: RateFunction = linear,
**kwargs: Any,
):
self.virtual_time = virtual_time
self.function = function
super().__init__(
@ -131,13 +167,12 @@ class PhaseFlow(Animation):
self.rate_func(alpha) - self.rate_func(self.last_alpha)
)
self.mobject.apply_function(lambda p: p + dt * self.function(p))
self.last_alpha = alpha
self.last_alpha: float = alpha
class MoveAlongPath(Animation):
"""Make one mobject move along the path of another mobject.
Example
--------
.. manim:: MoveAlongPathExample
class MoveAlongPathExample(Scene):
@ -154,9 +189,9 @@ class MoveAlongPath(Animation):
self,
mobject: Mobject,
path: VMobject,
suspend_mobject_updating: bool | None = False,
**kwargs,
) -> None:
suspend_mobject_updating: bool = False,
**kwargs: Any,
):
self.path = path
super().__init__(
mobject, suspend_mobject_updating=suspend_mobject_updating, **kwargs

View file

@ -5,7 +5,8 @@ from __future__ import annotations
__all__ = ["ChangingDecimal", "ChangeDecimalToValue"]
import typing
from collections.abc import Callable
from typing import Any
from manim.mobject.text.numbers import DecimalNumber
@ -14,12 +15,47 @@ from ..utils.bezier import interpolate
class ChangingDecimal(Animation):
"""Animate a :class:`~.DecimalNumber` to values specified by a user-supplied function.
Parameters
----------
decimal_mob
The :class:`~.DecimalNumber` instance to animate.
number_update_func
A function that returns the number to display at each point in the animation.
suspend_mobject_updating
If ``True``, the mobject is not updated outside this animation.
Raises
------
TypeError
If ``decimal_mob`` is not an instance of :class:`~.DecimalNumber`.
Examples
--------
.. manim:: ChangingDecimalExample
class ChangingDecimalExample(Scene):
def construct(self):
number = DecimalNumber(0)
self.add(number)
self.play(
ChangingDecimal(
number,
lambda a: 5 * a,
run_time=3
)
)
self.wait()
"""
def __init__(
self,
decimal_mob: DecimalNumber,
number_update_func: typing.Callable[[float], float],
suspend_mobject_updating: bool | None = False,
**kwargs,
number_update_func: Callable[[float], float],
suspend_mobject_updating: bool = False,
**kwargs: Any,
) -> None:
self.check_validity_of_input(decimal_mob)
self.number_update_func = number_update_func
@ -32,12 +68,34 @@ class ChangingDecimal(Animation):
raise TypeError("ChangingDecimal can only take in a DecimalNumber")
def interpolate_mobject(self, alpha: float) -> None:
self.mobject.set_value(self.number_update_func(self.rate_func(alpha)))
self.mobject.set_value(self.number_update_func(self.rate_func(alpha))) # type: ignore[attr-defined]
class ChangeDecimalToValue(ChangingDecimal):
"""Animate a :class:`~.DecimalNumber` to a target value using linear interpolation.
Parameters
----------
decimal_mob
The :class:`~.DecimalNumber` instance to animate.
target_number
The target value to transition to.
Examples
--------
.. manim:: ChangeDecimalToValueExample
class ChangeDecimalToValueExample(Scene):
def construct(self):
number = DecimalNumber(0)
self.add(number)
self.play(ChangeDecimalToValue(number, 10, run_time=3))
self.wait()
"""
def __init__(
self, decimal_mob: DecimalNumber, target_number: int, **kwargs
self, decimal_mob: DecimalNumber, target_number: int, **kwargs: Any
) -> None:
start_number = decimal_mob.number
super().__init__(

View file

@ -4,9 +4,8 @@ from __future__ import annotations
__all__ = ["Rotating", "Rotate"]
from typing import TYPE_CHECKING, Callable, Sequence
import numpy as np
from collections.abc import Callable
from typing import TYPE_CHECKING, Any
from ..animation.animation import Animation
from ..animation.transform import Transform
@ -15,22 +14,90 @@ from ..utils.rate_functions import linear
if TYPE_CHECKING:
from ..mobject.mobject import Mobject
from ..mobject.opengl.opengl_mobject import OpenGLMobject
from ..typing import Point3DLike, Vector3DLike
class Rotating(Animation):
"""Animation that rotates a Mobject.
Parameters
----------
mobject
The mobject to be rotated.
angle
The rotation angle in radians. Predefined constants such as ``DEGREES``
can also be used to specify the angle in degrees.
axis
The rotation axis as a numpy vector.
about_point
The rotation center.
about_edge
If ``about_point`` is ``None``, this argument specifies
the direction of the bounding box point to be taken as
the rotation center.
run_time
The duration of the animation in seconds.
rate_func
The function defining the animation progress based on the relative
runtime (see :mod:`~.rate_functions`) .
**kwargs
Additional keyword arguments passed to :class:`~.Animation`.
Examples
--------
.. manim:: RotatingDemo
class RotatingDemo(Scene):
def construct(self):
circle = Circle(radius=1, color=BLUE)
line = Line(start=ORIGIN, end=RIGHT)
arrow = Arrow(start=ORIGIN, end=RIGHT, buff=0, color=GOLD)
vg = VGroup(circle,line,arrow)
self.add(vg)
anim_kw = {"about_point": arrow.get_start(), "run_time": 1}
self.play(Rotating(arrow, 180*DEGREES, **anim_kw))
self.play(Rotating(arrow, PI, **anim_kw))
self.play(Rotating(vg, PI, about_point=RIGHT))
self.play(Rotating(vg, PI, axis=UP, about_point=ORIGIN))
self.play(Rotating(vg, PI, axis=RIGHT, about_edge=UP))
self.play(vg.animate.move_to(ORIGIN))
.. manim:: RotatingDifferentAxis
class RotatingDifferentAxis(ThreeDScene):
def construct(self):
axes = ThreeDAxes()
cube = Cube()
arrow2d = Arrow(start=[0, -1.2, 1], end=[0, 1.2, 1], color=YELLOW_E)
cube_group = VGroup(cube,arrow2d)
self.set_camera_orientation(gamma=0, phi=40*DEGREES, theta=40*DEGREES)
self.add(axes, cube_group)
play_kw = {"run_time": 1.5}
self.play(Rotating(cube_group, PI), **play_kw)
self.play(Rotating(cube_group, PI, axis=UP), **play_kw)
self.play(Rotating(cube_group, 180*DEGREES, axis=RIGHT), **play_kw)
self.wait(0.5)
See also
--------
:class:`~.Rotate`, :meth:`~.Mobject.rotate`
"""
def __init__(
self,
mobject: Mobject,
axis: np.ndarray = OUT,
radians: np.ndarray = TAU,
about_point: np.ndarray | None = None,
about_edge: np.ndarray | None = None,
angle: float = TAU,
axis: Vector3DLike = OUT,
about_point: Point3DLike | None = None,
about_edge: Vector3DLike | None = None,
run_time: float = 5,
rate_func: Callable[[float], float] = linear,
**kwargs,
**kwargs: Any,
) -> None:
self.angle = angle
self.axis = axis
self.radians = radians
self.about_point = about_point
self.about_edge = about_edge
super().__init__(mobject, run_time=run_time, rate_func=rate_func, **kwargs)
@ -38,7 +105,7 @@ class Rotating(Animation):
def interpolate_mobject(self, alpha: float) -> None:
self.mobject.become(self.starting_mobject)
self.mobject.rotate(
self.rate_func(alpha) * self.radians,
self.rate_func(alpha) * self.angle,
axis=self.axis,
about_point=self.about_point,
about_edge=self.about_edge,
@ -59,7 +126,7 @@ class Rotate(Transform):
about_point
The rotation center.
about_edge
If ``about_point``is ``None``, this argument specifies
If ``about_point`` is ``None``, this argument specifies
the direction of the bounding box point to be taken as
the rotation center.
@ -79,16 +146,20 @@ class Rotate(Transform):
Rotate(Square(side_length=0.5), angle=2*PI, rate_func=linear),
)
See also
--------
:class:`~.Rotating`, :meth:`~.Mobject.rotate`
"""
def __init__(
self,
mobject: Mobject,
angle: float = PI,
axis: np.ndarray = OUT,
about_point: Sequence[float] | None = None,
about_edge: Sequence[float] | None = None,
**kwargs,
axis: Vector3DLike = OUT,
about_point: Point3DLike | None = None,
about_edge: Vector3DLike | None = None,
**kwargs: Any,
) -> None:
if "path_arc" not in kwargs:
kwargs["path_arc"] = angle
@ -102,7 +173,7 @@ class Rotate(Transform):
self.about_point = mobject.get_center()
super().__init__(mobject, path_arc_centers=self.about_point, **kwargs)
def create_target(self) -> Mobject:
def create_target(self) -> Mobject | OpenGLMobject:
target = self.mobject.copy()
target.rotate(
self.angle,

View file

@ -2,9 +2,11 @@ from __future__ import annotations
__all__ = ["Broadcast"]
from typing import Any, Sequence
from collections.abc import Sequence
from typing import Any
from manim.animation.transform import Restore
from manim.mobject.mobject import Mobject
from ..constants import *
from .composition import LaggedStart
@ -49,7 +51,7 @@ class Broadcast(LaggedStart):
def __init__(
self,
mobject,
mobject: Mobject,
focal_point: Sequence[float] = ORIGIN,
n_mobs: int = 5,
initial_opacity: float = 1,
@ -69,10 +71,7 @@ class Broadcast(LaggedStart):
anims = []
# Works by saving the mob that is passed into the animation, scaling it to 0 (or the initial_width) and then restoring the original mob.
if mobject.fill_opacity:
fill_o = True
else:
fill_o = False
fill_o = bool(mobject.fill_opacity)
for _ in range(self.n_mobs):
mob = mobject.copy()
@ -84,7 +83,7 @@ class Broadcast(LaggedStart):
mob.move_to(self.focal_point)
mob.save_state()
mob.set_width(self.initial_width)
mob.set(width=self.initial_width)
if fill_o:
mob.set_opacity(self.initial_opacity)

View file

@ -4,15 +4,21 @@ from __future__ import annotations
import inspect
import types
from typing import Callable
from collections.abc import Callable
from typing import TYPE_CHECKING
from numpy import piecewise
from ..animation.animation import Animation, Wait, prepare_animation
from ..animation.composition import AnimationGroup
from ..mobject.mobject import Mobject, Updater, _AnimationBuilder
from ..mobject.mobject import Mobject, _AnimationBuilder
from ..scene.scene import Scene
if TYPE_CHECKING:
from ..mobject.mobject import Updater
__all__ = ["ChangeSpeed"]
class ChangeSpeed(Animation):
"""Modifies the speed of passed animation.
@ -108,9 +114,9 @@ class ChangeSpeed(Animation):
self.anim = self.setup(anim)
if affects_speed_updaters:
assert (
ChangeSpeed.is_changing_dt is False
), "Only one animation at a time can play that changes speed (dt) for ChangeSpeed updaters"
assert ChangeSpeed.is_changing_dt is False, (
"Only one animation at a time can play that changes speed (dt) for ChangeSpeed updaters"
)
ChangeSpeed.is_changing_dt = True
self.t = 0
self.affects_speed_updaters = affects_speed_updaters

View file

@ -28,10 +28,12 @@ __all__ = [
import inspect
import types
from typing import TYPE_CHECKING, Any, Callable, Iterable, Sequence
from collections.abc import Callable, Iterable, Sequence
from typing import TYPE_CHECKING, Any
import numpy as np
from manim.data_structures import MethodWithArgs
from manim.mobject.opengl.opengl_mobject import OpenGLGroup, OpenGLMobject
from .. import config
@ -44,11 +46,13 @@ from ..constants import (
RendererType,
)
from ..mobject.mobject import Group, Mobject
from ..mobject.types.vectorized_mobject import VGroup
from ..utils.paths import path_along_arc, path_along_circles
from ..utils.rate_functions import smooth, squish_rate_func
if TYPE_CHECKING:
from ..scene.scene import Scene
from ..typing import Point3DLike, Point3DLike_Array
class Transform(Animation):
@ -122,6 +126,10 @@ class Transform(Animation):
self.play(*anims, run_time=2)
self.wait()
See also
--------
:class:`~.ReplacementTransform`, :meth:`~.Mobject.interpolate`, :meth:`~.Mobject.align_data`
"""
def __init__(
@ -131,12 +139,12 @@ class Transform(Animation):
path_func: Callable | None = None,
path_arc: float = 0,
path_arc_axis: np.ndarray = OUT,
path_arc_centers: np.ndarray = None,
path_arc_centers: Point3DLike | Point3DLike_Array | None = None,
replace_mobject_with_target_in_scene: bool = False,
**kwargs,
) -> None:
self.path_arc_axis: np.ndarray = path_arc_axis
self.path_arc_centers: np.ndarray = path_arc_centers
self.path_arc_centers: Point3DLike | Point3DLike_Array | None = path_arc_centers
self.path_arc: float = path_arc
# path_func is a property a few lines below so it doesn't need to be set in any case
@ -203,7 +211,7 @@ class Transform(Animation):
self.mobject.align_data(self.target_copy)
super().begin()
def create_target(self) -> Mobject:
def create_target(self) -> Mobject | OpenGLMobject:
# Has no meaningful effect here, but may be useful
# in subclasses
return self.target_mobject
@ -228,8 +236,8 @@ class Transform(Animation):
self.target_copy,
]
if config.renderer == RendererType.OPENGL:
return zip(*(mob.get_family() for mob in mobs))
return zip(*(mob.family_members_with_points() for mob in mobs))
return zip(*(mob.get_family() for mob in mobs), strict=True)
return zip(*(mob.family_members_with_points() for mob in mobs), strict=True)
def interpolate_submobject(
self,
@ -297,9 +305,7 @@ class ReplacementTransform(Transform):
class TransformFromCopy(Transform):
"""
Performs a reversed Transform
"""
"""Preserves a copy of the original VMobject and transforms only it's copy to the target VMobject"""
def __init__(self, mobject: Mobject, target_mobject: Mobject, **kwargs) -> None:
super().__init__(target_mobject, mobject, **kwargs)
@ -430,18 +436,18 @@ class MoveToTarget(Transform):
def check_validity_of_input(self, mobject: Mobject) -> None:
if not hasattr(mobject, "target"):
raise ValueError(
"MoveToTarget called on mobject" "without attribute 'target'",
"MoveToTarget called on mobjectwithout attribute 'target'",
)
class _MethodAnimation(MoveToTarget):
def __init__(self, mobject, methods):
def __init__(self, mobject: Mobject, methods: list[MethodWithArgs]) -> None:
self.methods = methods
super().__init__(mobject)
def finish(self) -> None:
for method, method_args, method_kwargs in self.methods:
method.__func__(self.mobject, *method_args, **method_kwargs)
for item in self.methods:
item.method.__func__(self.mobject, *item.args, **item.kwargs)
super().finish()
@ -730,19 +736,36 @@ class CyclicReplace(Transform):
def __init__(
self, *mobjects: Mobject, path_arc: float = 90 * DEGREES, **kwargs
) -> None:
self.group = Group(*mobjects)
if len(mobjects) == 1 and isinstance(mobjects[0], (Group, VGroup)):
self.group = mobjects[0]
else:
self.group = Group(*mobjects)
super().__init__(self.group, path_arc=path_arc, **kwargs)
def create_target(self) -> Group:
def create_target(self) -> Group | VGroup:
target = self.group.copy()
cycled_targets = [target[-1], *target[:-1]]
for m1, m2 in zip(cycled_targets, self.group):
for m1, m2 in zip(cycled_targets, self.group, strict=True):
m1.move_to(m2)
return target
class Swap(CyclicReplace):
pass # Renaming, more understandable for two entries
"""Another name for :class:`~.CyclicReplace`, which is more understandable for two entries.
Examples
--------
.. manim :: SwapExample
class SwapExample(Scene):
def construct(self):
text_a = Text("A").move_to(LEFT)
text_b = Text("B").move_to(RIGHT)
text_group = Group(text_a, text_b)
self.play(FadeIn(text_group))
self.play(Swap(text_group))
self.wait()
"""
# TODO, this may be deprecated...worth reimplementing?
@ -830,7 +853,14 @@ class FadeTransform(Transform):
"""
def __init__(self, mobject, target_mobject, stretch=True, dim_to_match=1, **kwargs):
def __init__(
self,
mobject: Mobject,
target_mobject: Mobject,
stretch: bool = True,
dim_to_match: int = 1,
**kwargs: Any,
):
self.to_add_on_completion = target_mobject
self.stretch = stretch
self.dim_to_match = dim_to_match
@ -924,5 +954,5 @@ class FadeTransformPieces(FadeTransform):
"""Replaces the source submobjects by the target submobjects and sets
the opacity to 0.
"""
for sm0, sm1 in zip(source.get_family(), target.get_family()):
for sm0, sm1 in zip(source.get_family(), target.get_family(), strict=True):
super().ghost_to(sm0, sm1)

Some files were not shown because too many files have changed in this diff Show more