mirror of
https://github.com/ManimCommunity/manim.git
synced 2026-06-22 10:01:47 +00:00
Merge branch 'main' of https://github.com/JasonGrace2282/manim into experimental
This commit is contained in:
commit
7de544da1c
10 changed files with 38 additions and 19 deletions
|
|
@ -3,7 +3,7 @@ build:
|
|||
os: ubuntu-22.04
|
||||
|
||||
tools:
|
||||
python: "3.11"
|
||||
python: "3.13"
|
||||
|
||||
apt_packages:
|
||||
- libpango1.0-dev
|
||||
|
|
|
|||
|
|
@ -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]
|
||||
|
|
@ -793,8 +793,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)):
|
||||
|
|
|
|||
|
|
@ -99,7 +99,8 @@ class AnimationGroup(Animation):
|
|||
self.group.suspend_updating()
|
||||
|
||||
def finish(self) -> None:
|
||||
self.interpolate(1)
|
||||
for anim in self.animations:
|
||||
anim.finish()
|
||||
self.anims_begun[:] = True
|
||||
self.anims_finished[:] = True
|
||||
for anim in self.animations:
|
||||
|
|
|
|||
|
|
@ -170,7 +170,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]),
|
||||
|
|
|
|||
|
|
@ -1059,7 +1059,7 @@ class Angle(VMobject, metaclass=ConvertToOpenGL):
|
|||
|
||||
angle = Angle(line1, line2, radius=0.4)
|
||||
|
||||
value = DecimalNumber(angle.get_value(degrees=True), unit="^{\\circ}")
|
||||
value = DecimalNumber(angle.get_value(degrees=True), unit=r"^{\circ}")
|
||||
value.next_to(angle, UR)
|
||||
|
||||
self.add(line1, line2, angle, value)
|
||||
|
|
|
|||
|
|
@ -15,8 +15,8 @@ Examples
|
|||
m2 = DecimalMatrix(
|
||||
[[3.456, 2.122], [33.2244, 12.33]],
|
||||
element_to_mobject_config={"num_decimal_places": 2},
|
||||
left_bracket="\\{",
|
||||
right_bracket="\\}")
|
||||
left_bracket=r"\{",
|
||||
right_bracket=r"\}")
|
||||
m3 = MobjectMatrix(
|
||||
[[Circle().scale(0.3), Square().scale(0.3)],
|
||||
[MathTex("\\pi").scale(2), Star().scale(0.3)]],
|
||||
|
|
@ -294,7 +294,7 @@ class Matrix(VMobject, metaclass=ConvertToOpenGL):
|
|||
|
||||
class GetColumnsExample(Scene):
|
||||
def construct(self):
|
||||
m0 = Matrix([["\\pi", 3], [1, 5]])
|
||||
m0 = Matrix([[r"\pi", 3], [1, 5]])
|
||||
m0.add(SurroundingRectangle(m0.get_columns()[1]))
|
||||
self.add(m0)
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -6,14 +6,12 @@ import numpy as np
|
|||
|
||||
from manim import config, logger
|
||||
from manim.camera.camera import Camera
|
||||
from manim.mobject.mobject import Mobject
|
||||
from manim.mobject.mobject import Mobject, _AnimationBuilder
|
||||
from manim.utils.exceptions import EndSceneEarlyException
|
||||
from manim.utils.hashing import get_hash_from_play_call
|
||||
from manim.utils.iterables import list_update
|
||||
|
||||
if typing.TYPE_CHECKING:
|
||||
import types
|
||||
from collections.abc import Iterable
|
||||
from typing import Any
|
||||
|
||||
from manim.animation.animation import Animation
|
||||
|
|
@ -58,7 +56,7 @@ class CairoRenderer:
|
|||
def play(
|
||||
self,
|
||||
scene: Scene,
|
||||
*args: Animation | Iterable[Animation] | types.GeneratorType[Animation],
|
||||
*args: Animation | Mobject | _AnimationBuilder,
|
||||
**kwargs,
|
||||
):
|
||||
# Reset skip_animations to the original state.
|
||||
|
|
|
|||
|
|
@ -16,8 +16,8 @@ from manim.camera.camera import Camera
|
|||
from manim.constants import DEFAULT_WAIT_TIME
|
||||
from manim.event_handler import EVENT_DISPATCHER
|
||||
from manim.event_handler.event_type import EventType
|
||||
from manim.mobject.mobject import Group, Point, _AnimationBuilder
|
||||
from manim.mobject.opengl.opengl_mobject import OpenGLMobject
|
||||
from manim.mobject.mobject import Group, Point
|
||||
from manim.mobject.opengl.opengl_mobject import OpenGLMobject, _AnimationBuilder
|
||||
from manim.mobject.types.vectorized_mobject import VGroup, VMobject
|
||||
from manim.scene.sections import group as SceneGroup
|
||||
from manim.utils.iterables import list_difference_update
|
||||
|
|
@ -357,7 +357,9 @@ class Scene:
|
|||
self,
|
||||
# the OpenGLMobject is a side-effect of the return type of animate, it will
|
||||
# raise a ValueError
|
||||
*proto_animations: AnimationProtocol | _AnimationBuilder | OpenGLMobject,
|
||||
*proto_animations: AnimationProtocol
|
||||
| _AnimationBuilder[OpenGLMobject]
|
||||
| OpenGLMobject,
|
||||
run_time: float | None = None,
|
||||
rate_func: Callable[[float], float] | None = None,
|
||||
lag_ratio: float | None = None,
|
||||
|
|
|
|||
|
|
@ -175,7 +175,7 @@ class ManimDirective(Directive):
|
|||
# Rendering is skipped if the tag skip-manim is present,
|
||||
# or if we are making the pot-files
|
||||
should_skip = (
|
||||
"skip-manim" in self.state.document.settings.env.app.builder.tags.tags
|
||||
"skip-manim" in self.state.document.settings.env.app.builder.tags
|
||||
or self.state.document.settings.env.app.builder.name == "gettext"
|
||||
or os.getenv("READTHEDOCS_VERSION_NAME", None) in ["3112", "3475"]
|
||||
)
|
||||
|
|
|
|||
|
|
@ -180,6 +180,24 @@ def test_animationgroup_is_passing_remover_to_nested_animationgroups():
|
|||
assert polygon_animation.remover
|
||||
|
||||
|
||||
def test_animationgroup_calls_finish():
|
||||
class MyAnimation(Animation):
|
||||
def __init__(self, mobject):
|
||||
super().__init__(mobject)
|
||||
self.finished = False
|
||||
|
||||
def finish(self):
|
||||
self.finished = True
|
||||
|
||||
scene = Scene()
|
||||
sqr_animation = MyAnimation(Square())
|
||||
circ_animation = MyAnimation(Circle())
|
||||
animation_group = AnimationGroup(sqr_animation, circ_animation)
|
||||
scene.play(animation_group)
|
||||
assert sqr_animation.finished
|
||||
assert circ_animation.finished
|
||||
|
||||
|
||||
def test_empty_animation_group_fails():
|
||||
with pytest.raises(ValueError, match="Please add at least one subanimation."):
|
||||
AnimationGroup().begin()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue