This is a preview prerelease. Install it with pip install --pre manim or pip install manim==0.30.0a1.
The first preview of v0.30.0 features a restructured rendering pipeline
and changes to bring the cairo and the OpenGL renderers closer together.
Highlights
The Stack #5104 of six PRs (#4989, #5002, #5004, #5005,
#5006, #5059) restructures the rendering pipeline:
- Cameras describe views, renderers draw. Cairo cameras no longer hold
pixel buffers or draw; the renderer does. Every camera has an animatable
camera.frameandauto_zoom(), so moving the camera no longer needs
MovingCameraScene. - The
Managerruns scenes. It creates the file writer, plays every
animation through one run loop shared by Cairo and OpenGL, and closes all
resources on success, failure or interrupt. Skipped and cached plays step
through their frames without drawing, so later plays start from the same
state as in a full render. - Evaluating without rendering.
Manager.evaluate()runs a scene without
producing media, and draws only the frames you ask for
(guides/evaluation). - Timelines.
--timeline-output PATHexports the plays, waits, sections,
captions and sounds of a scene with their times as JSON
(guides/timeline). - Audio without pydub. Sounds are mixed with PyAV and placed at scene
time; partial renders cut sound like video.
Breaking changes
Module paths. Top-level imports (from manim import ...) are unchanged.
Implementation modules and the OpenGL shaders moved, without compatibility
aliases:
| Removed | Use instead |
|---|---|
manim.camera.camera, .moving_camera, .multi_camera, .three_d_camera
| manim.renderer.cairo.camera
|
manim.renderer.cairo_renderer
| manim.renderer.cairo
|
manim.renderer.opengl_renderer
| manim.renderer.opengl
|
manim.renderer.opengl_renderer_window
| manim.renderer.opengl.window
|
manim.renderer.shader, .shader_wrapper, .vectorized_mobject_rendering
| the same modules in manim.renderer.opengl
|
manim/renderer/shaders
| manim/renderer/opengl/shaders
|
Cameras (#4989)
- Cairo cameras take view settings only.
pixel_width,pixel_height,
frame_rate,image_mode,n_channels,pixel_array_dtype,background
(pixel arrays),cairo_line_width_multipleandfixed_dimensionare
removed: useconfigfor render settings, andbackground_color,
background_opacityorbackground_image. Unknown keywords raise
TypeError. - Cameras no longer draw:
camera.pixel_array,capture_mobjects(),
get_image()and thedisplay_*/apply_*helpers are removed. Use
scene.get_image(),mobject.get_image(camera=...), or render through
CairoRenderer. MappingCamera,OldMultiCamera,SplitScreenCameraand
BackgroundColoredVMobjectDisplayerare removed. Useapply_function(),
MultiCamerawithImageMobjectFromCamera, and
VMobject.color_using_background_image().ImageMobjectFromCamerais no longer anAbstractImageMobjectand has no
pixel array.ThreeDScenerequires aThreeDCamera(or an OpenGL camera).
ThreeDCamera.rotation_matrixis read-only.- Deprecated:
MovingCameraandMovingCameraScene(useCameraand
Scene).ZoomedSceneis now a plainScenesubclass.
Rendering lifecycle (#5002)
- A scene renders once: calling
render()again raisesRuntimeError. - A renderer belongs to one scene.
Scene.rendererandrenderer.file_writer
are read-only; pick a custom writer with the renderer'sfile_writer_class
argument.init_scene()no longer takesfile_writer_settings. - The renderer is closed after rendering. To read its last frame, render
insidewith Manager(scene) as manager:. - The log file is created when rendering starts, not when the scene is
constructed.
scene.timeadvances in whole frames, and waits round their frame count up
like plays: afterwait(0.5)and a 0.5 s play at 15 fps, it is 16/15 s
instead of 1 s.-s,-n, skipped sections and cached plays run the updaters of every
frame. The resulting state is correct, but heavy updaters make these modes
slower than before.play()orwait()called during another play (for example from an
updater) raisesRuntimeError. Before, it silently replaced the running
play's animations.- Removed:
Scene.play_internal()and
manim.utils.caching.handle_caching_play. Deprecated:
Scene.get_time_progression().
Sound (#5059)
pydubandaudioop-ltsare no longer dependencies; install them yourself
if you use them.add_sound()checks the file when called (OSErrorif it is missing,
ValueErrorif it is not audio), and takesgain_to_backgroundinstead of
**kwargs.- The pydub-based audio API of
SceneFileWriteris removed (init_audio,
create_audio_segment,add_audio_segment,audio_segment,
includes_sound,convert_audio);SceneFileWriter.add_sound()requires
time.
What's Changed
Breaking Changes ๐จ
- Refactor: separate camera state from renderer-owned rasterization (cairo) + consolidate renderer related modules by @behackl in #4989
- Refactor: move more render lifecycle responsibilities to Manager by @behackl in #5002
- Refactor: run play calls through one loop with listeners by @behackl in #5004
- Refactor: evaluate scenes without rendering, and draw requested frames by @behackl in #5005
- Replace pydub with a PyAV sound mixer and place audio in movie time by @behackl in #5059
New Features โจ
- Add timeline capture and JSON export by @behackl in #5006
- Embed saved scene sections as MP4 chapters by @Mist-wu in #5125
Bug Fixes ๐
- Raise a clear ValueError for unsupported axes in Percent by @manan21bhalla in #5098
- Fix Line.set_points_by_ends ignoring the path_arc argument by @Timotty in #5058
- Read and write manim.cfg as UTF-8 by @b84330808 in #5103
Performance โก
- Improve CLI startup time by using lazy imports by @GniLudio in #5124
- Use direct formula instead of SciPy in
space_ops.rotation_matrix()by @chopan050 in #5129
Documentation ๐
- Speed up the documentation build and cache rendered examples by @GniLudio in #5133
- Fix docbuild warnings by @GniLudio in #5155
- Make side drawer and toc always collapsible by @GniLudio in #5131
Infrastructure & Build ๐จ
- Support preview prereleases from
preview/*branches by @behackl in #5130 - Keep changelog prose on regeneration, and link prerelease notes to the preview docs by @behackl in #5152
- Use uv for the readthedocs build by @GniLudio in #5153
Code Quality & Refactoring ๐งน
- Use attribute access for global config in scene and animation by @Hangeerh in #5138
- Use attribute access for the global config in manim/scene by @Q9Kawaii in #5142
Type Hints ๐
- Fix typing in
logo.pyby @Kayyz1603 in #5112 - Fix return type of invert_image by @GniLudio in #5132
Other Changes
New Contributors
- @manan21bhalla made their first contribution in #5098
- @Mist-wu made their first contribution in #5125
- @Timotty made their first contribution in #5058
- @Hangeerh made their first contribution in #5138
- @Q9Kawaii made their first contribution in #5142
- @b84330808 made their first contribution in #5103
Full Changelog: Compare view