Commit graph

70 commits

Author SHA1 Message Date
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
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
Pedro Zanelato
e569fd47ad
test: add matrix tests (#4279) 2025-06-11 09:48:39 +02: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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
Benjamin Hackl
cac608bf2a follow-up to #3491, made errors more consistent. fixes #3527 2023-12-17 17:32:38 +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
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