Skip to content

The animation engine for agents: blazingly fast math and 3D videos with Manim's Python API, on a Rust GPU core.

Python

Rename Path Trajectory, add set_width and set_height, and name more of CE's differences

Sina Atalaye5b65849ce77
diff --git a/docs/content/changelog.md b/docs/content/changelog.md
index 0cc3962a..c3d7bcfd 100644
--- a/docs/content/changelog.md
+++ b/docs/content/changelog.md
@@ -22,6 +22,7 @@ The notable changes to ManimGX, release by release. The format follows
- Add a preview image and social metadata when sharing website and documentation links.
- Credit Academa and the creators in the README.
+- Add `set_width()` and `set_height()`, deprecated in favor of setting `width` and `height`, as `get_width()` and `get_height()` are: Manim CE scenes size mobjects with them ([#35](https://github.com/academa-labs/manimgx/issues/35)).
- Add Manim CE's `partial_bezier_points`, `subdivide_bezier`, `bezier_remap`, `integer_interpolate`, `is_closed` and `get_smooth_cubic_bezier_handle_points` to the package.
- Add `remove_fixed_in_frame_mobjects` to `ThreeDScene` and `Camera`, Manim CE's undo of `add_fixed_in_frame_mobjects`: the camera moves the mobjects again.
- Add `get_height()`, deprecated in favor of `height`, as `get_width()` is in favor of `width`: Manim CE scenes call both.
@@ -42,6 +43,8 @@ The notable changes to ManimGX, release by release. The format follows
- Take NumPy out of the package: a scene imports it itself (`import numpy as np`), and `from manimgx import *` no longer brings `np`.
- Make the voices' names the package's, as every other name is: `m.Fal`, `m.Voice`, `m.Word`, `m.timed`, `m.estimate` and `m.cached`, where they were `m.voices.Fal` and `manimgx.audio.Voice`. `m.voices` is gone.
- Name the settings' module `manimgx.settings`. `manimgx.config` is the settings themselves, as `m.config` is: after `import manimgx.config`, `manimgx.config.Config` failed.
+- Name the value that says how a transform's points travel `Trajectory`, where it was `Path`, which `from manimgx import *` put in place of `pathlib.Path` ([#35](https://github.com/academa-labs/manimgx/issues/35)).
+- Name more of Manim CE's differences on the migration page: a fraction's glyph order, `line_spacing`, `rate_functions`, `pixel_array`, held frames and `ffmpeg -ss`, and a scene's own `say` ([#35](https://github.com/academa-labs/manimgx/issues/35)).
### Fixed
diff --git a/docs/content/reference/animations/transforms.md b/docs/content/reference/animations/transforms.md
index 87113765..58f43649 100644
--- a/docs/content/reference/animations/transforms.md
+++ b/docs/content/reference/animations/transforms.md
@@ -114,7 +114,7 @@ as `path_func`.
options:
heading_level: 3
-::: manimgx.Path
+::: manimgx.Trajectory
options:
heading_level: 3
diff --git a/docs/content/user-guide/coming-from-manim-ce.md b/docs/content/user-guide/coming-from-manim-ce.md
index 5f477fac..3e139fca 100644
--- a/docs/content/user-guide/coming-from-manim-ce.md
+++ b/docs/content/user-guide/coming-from-manim-ce.md
@@ -9,17 +9,31 @@ code behaves. This page shows where it is different.
- Every name is in the package: `import manimgx as m`, then `m.Circle`, or
`from manimgx import *`. Manim CE's modules are not there: write
- `from manimgx import polylabel`, not `from manimgx.utils.polylabel import polylabel`.
+ `from manimgx import polylabel`, not `from manimgx.utils.polylabel import polylabel`,
+ and `rate_func=m.smooth`, not `rate_functions.smooth`.
- NumPy is not in the package: import it yourself (`import numpy as np`). Manim CE's
`from manim import *` brings `np` with it; ManimGX's brings only ManimGX's names.
- Render with `manimgx render scene.py MyScene`. Manim CE's quality flags (`-ql`, `-qh`,
…) become `-r` (`--resolution`) and `--fps`. `manimgx inspect` writes a storyboard and checks 2D layouts without a video. See
[Rendering and sharing](rendering.md).
+- A still part of a video is one frame, shown for as long as the part lasts, so
+ `ffmpeg -ss` can land on the frame after it. To cut or join videos with ffmpeg, make
+ their frame rate constant first: `ffmpeg -i in.mp4 -fps_mode cfr -r 60 out.mp4`.
+
+## Text, formulas and images
+
- You don't install LaTeX. `Tex` and `MathTex` convert their LaTeX to
[Typst](https://typst.app), which the engine sets. LaTeX packages and `\def` don't
convert.
- Double braces make a part wherever they are: `m.MathTex("x={{y}}")` has two parts.
Manim CE makes one only at the string's start or after a space.
+- A fraction's glyphs come in the order numerator, denominator, bar; Manim CE's come
+ numerator, bar, denominator. An overline comes after what it covers. Code that picks a
+ glyph by its place, such as `frac[0][1]` for the bar, picks another one.
+- `Text(line_spacing=x)` puts lines `1 + x` font sizes apart; Manim CE puts them
+ `0.75 × (1 + x)` apart. So Manim CE's 0.8 is ManimGX's 0.35.
+- An `ImageMobject`'s `pixel_array` can't be assigned: make a new image to show other
+ pixels.
## The frame
@@ -54,7 +68,7 @@ works, but your editor marks it deprecated and names the one to use:
- `arrange_submobjects` is `arrange`, `rotate_about_origin(angle)` is
`rotate(angle, about_point=m.ORIGIN)`, and `get_edge_center(m.UP)` is `get_top()`.
- A getter such as `get_width()`, `get_height()` or `get_color()` is its property:
- `width`, `height`, `color`.
+ `width`, `height`, `color`. So are the setters: `set_width(3)` is `width = 3`.
- `PGroup` is `Group`, and the singular `add_foreground_mobject` is
`add_foreground_mobjects`.
@@ -80,6 +94,8 @@ ManimGX does the work of manim-voiceover and manim-slides, without plugins:
- [`add_sound`][manimgx.Scene.add_sound] puts a sound in the video. A
[`Sound`][manimgx.Sound] can also be a part of a play.
- A voiceover is `self.say("The derivative of [x squared] is [two x].", anim1, anim2)`.
+ If your scene has a `say` method of its own, as many Manim CE projects do for their
+ voiceover, it replaces ManimGX's: rename yours.
Each animation plays during its words in brackets, and the scene waits until the line
ends. This replaces `with self.voiceover(...) as tracker:`, bookmarks and
`run_time=tracker.duration`. Any text-to-speech service can be a voice.
diff --git a/src/manimgx/animation/motion.py b/src/manimgx/animation/motion.py
index 61a0eec6..d590c45f 100644
--- a/src/manimgx/animation/motion.py
+++ b/src/manimgx/animation/motion.py
@@ -51,7 +51,7 @@ from manimgx.constants import (
UP,
)
from manimgx.drawing.geometry import (
- Path,
+ Trajectory,
interpolate,
inverse_interpolate,
normalize,
@@ -1867,7 +1867,7 @@ class MoveAlongPath(Transform):
self, mobject: Mobject, path: VMobject, **kwargs: Unpack[TransformOptions]
) -> None:
self.path = path
- kwargs["path_func"] = Path(steps=(path.point_from_proportion,))
+ kwargs["path_func"] = Trajectory(steps=(path.point_from_proportion,))
super().__init__(
mobject,
keys=tuple(
diff --git a/src/manimgx/animation/transform.py b/src/manimgx/animation/transform.py
index 901a0e8d..1149ca20 100644
--- a/src/manimgx/animation/transform.py
+++ b/src/manimgx/animation/transform.py
@@ -26,8 +26,8 @@ from manimgx.constants import ORIGIN, OUT, PI
from manimgx.drawing.geometry import (
Blend,
Floats,
- Path,
Step,
+ Trajectory,
carried,
path_along_arc,
path_along_circles,
@@ -170,7 +170,7 @@ class TransformOptions(_AnimationOptions, total=False, closed=True):
path_func: PathFunc | None
"""How each point travels from its start to its end: a function of the start points,
- the end points and the progress (see [paths][manimgx.Path]); it replaces
+ the end points and the progress (see [paths][manimgx.Trajectory]); it replaces
`path_arc` and `path_arc_centers` (default None: a straight path)."""
path_arc: float
"""The angle each point turns through on its way, in radians: 0 is a straight path,
@@ -210,7 +210,7 @@ class Transform[M: Mobject = Mobject](Animation[M]):
`keys` is omitted. Passing only `keys` leaves `target_mobject` as None.
path_func: How each point travels from its start to its end: a function of the
start points, the end points and the progress (see
- [paths][manimgx.Path]); it replaces `path_arc` and `path_arc_centers`.
+ [paths][manimgx.Trajectory]); it replaces `path_arc` and `path_arc_centers`.
None: a straight path.
path_arc: The angle each point turns through on its way, in radians: 0 is a
straight path, and a positive angle turns counterclockwise.
@@ -347,7 +347,9 @@ class Transform[M: Mobject = Mobject](Animation[M]):
motion undone. None when the path is not a motion.
"""
path, frames = self.path_func, self.frames
- if not (isinstance(path, Path) and path.kind == "motion" and len(frames) == 2):
+ if not (
+ isinstance(path, Trajectory) and path.kind == "motion" and len(frames) == 2
+ ):
return None
moved = frames[1].get_center() - frames[0].get_center()
steps = path.steps or ((moved,) if np.any(moved) else ())
@@ -599,7 +601,7 @@ class _Leaf:
path = tween.path_func
rest = (
Blend.mix(a._geometry, b._geometry, path.coefficients(t))
- if isinstance(path, Path)
+ if isinstance(path, Trajectory)
else Blend.of(path(a.points, b.points, t))
)
else: # its chord in the frame its motion carries
@@ -1052,7 +1054,7 @@ class Animate[M: Mobject](Transform[M], _Methods):
moved = target.get_center() - before
if np.any(moved):
steps.append(moved)
- self._path_func = self._chosen = Path(steps=tuple(steps))
+ self._path_func = self._chosen = Trajectory(steps=tuple(steps))
return target
def finish(self) -> None:
diff --git a/src/manimgx/cli/export.py b/src/manimgx/cli/export.py
index 7851bfe3..d70d8dcd 100644
--- a/src/manimgx/cli/export.py
+++ b/src/manimgx/cli/export.py
@@ -43,7 +43,7 @@ from manimgx.settings import config
if TYPE_CHECKING:
from manimgx.animation.transform import Transform
- from manimgx.drawing.geometry import Path as MotionPath
+ from manimgx.drawing.geometry import Trajectory
def render(
@@ -192,7 +192,7 @@ def inspect(
def _pure_tweens(
self, anim: Animation, alpha: list[float]
- ) -> "tuple[list[tuple[Transform, MotionPath]], set[int]] | None":
+ ) -> "tuple[list[tuple[Transform, Trajectory]], set[int]] | None":
if pending and pending[-1][0] < self.frame + len(alpha):
return None # this play needs its mutable world at the selected frames
return super()._pure_tweens(anim, alpha)
diff --git a/src/manimgx/drawing/geometry.py b/src/manimgx/drawing/geometry.py
index 9c427fe6..1f13f1a1 100644
--- a/src/manimgx/drawing/geometry.py
+++ b/src/manimgx/drawing/geometry.py
@@ -56,10 +56,10 @@ __all__ = [
"STRAIGHT_PATH_THRESHOLD",
"Coefficients",
"Floats",
- "Path",
"QuickHull",
"R3_to_complex",
"Step",
+ "Trajectory",
"angle_axis_from_quaternion",
"angle_between_vectors",
"angle_of_vector",
@@ -1633,7 +1633,7 @@ def _cross(axis: Floats) -> Floats:
@dataclass(frozen=True, slots=True, eq=False)
-class Path:
+class Trajectory:
"""How the points of a shape travel in a transform, from where they start to where
they end, as a value.
@@ -1755,14 +1755,14 @@ def _unit(axis: Vector3DLike) -> Floats:
return unit
-def straight_path() -> Path:
+def straight_path() -> Trajectory:
"""The straight path: each point goes along the line from its start to its end, as
a transform moves points by default.
"""
- return Path()
+ return Trajectory()
-def path_along_arc(arc_angle: float, axis: Vector3DLike = _PATH_AXIS) -> Path:
+def path_along_arc(arc_angle: float, axis: Vector3DLike = _PATH_AXIS) -> Trajectory:
"""A path along arcs: each point travels along a circular arc from its start to its
end, turning through an angle, as a transform's `path_arc` makes it move.
@@ -1775,7 +1775,7 @@ def path_along_arc(arc_angle: float, axis: Vector3DLike = _PATH_AXIS) -> Path:
"""
if abs(arc_angle) < STRAIGHT_PATH_THRESHOLD:
return straight_path()
- return Path("arc", arc_angle, _unit(axis))
+ return Trajectory("arc", arc_angle, _unit(axis))
def path_along_circles(
@@ -1787,9 +1787,9 @@ def path_along_circles(
it moves from its start to its end, as a transform's `path_arc_centers` makes it
move.
- With one center, the shape turns about it as a whole, as a [Path][manimgx.Path];
- with a center per point, each point turns about its own, as a plain function of
- `(start, end, alpha)`.
+ With one center, the shape turns about it as a whole, as a
+ [Trajectory][manimgx.Trajectory]; with a center per point, each point turns about its
+ own, as a plain function of `(start, end, alpha)`.
Args:
arc_angle: The angle, in radians, counterclockwise about `axis`.
@@ -1799,7 +1799,7 @@ def path_along_circles(
unit_axis = _unit(axis)
points: Floats = np.asarray(centers, dtype=np.float64)
if points.ndim == 1:
- return Path(steps=((arc_angle, unit_axis, points),))
+ return Trajectory(steps=((arc_angle, unit_axis, points),))
def path(start: Point3D_Array, end: Point3D_Array, alpha: float) -> Point3D_Array:
detransformed = (
@@ -1811,21 +1811,21 @@ def path_along_circles(
return path
-def clockwise_path() -> Path:
+def clockwise_path() -> Trajectory:
"""A path along half circles, clockwise: each point turns through π on its way from
its start to its end.
"""
return path_along_arc(-np.pi)
-def counterclockwise_path() -> Path:
+def counterclockwise_path() -> Trajectory:
"""A path along half circles, counterclockwise: each point turns through π on its
way from its start to its end.
"""
return path_along_arc(np.pi)
-def spiral_path(angle: float, axis: Vector3DLike = _PATH_AXIS) -> Path:
+def spiral_path(angle: float, axis: Vector3DLike = _PATH_AXIS) -> Trajectory:
"""A spiral path: each point spirals out from its start to its end, its offset from
its start growing as it turns counterclockwise through `angle` (for a positive
angle) into line with its end.
@@ -1838,7 +1838,7 @@ def spiral_path(angle: float, axis: Vector3DLike = _PATH_AXIS) -> Path:
"""
if abs(angle) < STRAIGHT_PATH_THRESHOLD:
return straight_path()
- return Path("spiral", angle, _unit(axis))
+ return Trajectory("spiral", angle, _unit(axis))
type Matrix = Floats # 3×4: [linear 3×3 | translation]
diff --git a/src/manimgx/mobject.py b/src/manimgx/mobject.py
index 1d47ff21..855cff29 100644
--- a/src/manimgx/mobject.py
+++ b/src/manimgx/mobject.py
@@ -63,7 +63,7 @@ from manimgx.drawing.geometry import (
EMPTY,
Blend,
Lattice,
- Path,
+ Trajectory,
_pathops,
bezier,
bezier_remap,
@@ -2485,6 +2485,28 @@ class Mobject:
"""
return self.height
+ @deprecated("set_width(w) is width = w: use it", category=None)
+ def set_width(self, width: float) -> Self:
+ """Scale the mobject to a [width][manimgx.Mobject.width], in proportion, about its
+ center.
+
+ Args:
+ width: The width, in scene units.
+ """
+ self.width = width
+ return self
+
+ @deprecated("set_height(h) is height = h: use it", category=None)
+ def set_height(self, height: float) -> Self:
+ """Scale the mobject to a [height][manimgx.Mobject.height], in proportion, about its
+ center.
+
+ Args:
+ height: The height, in scene units.
+ """
+ self.height = height
+ return self
+
# ── layout ────────────────────────────────────────────────────────────
def center(self) -> Self:
"""Move the mobject so the center of its bounding box is at the origin."""
@@ -4076,7 +4098,7 @@ class Mobject:
"""
g1, g2 = mobject1._geometry, mobject2._geometry
if (
- isinstance(path_func, Path) and g1.n == g2.n
+ isinstance(path_func, Trajectory) and g1.n == g2.n
): # a linear path moves shapes, not points
self._geometry = Blend.mix(g1, g2, path_func.coefficients(alpha))
else:
diff --git a/src/manimgx/rendering/feed.py b/src/manimgx/rendering/feed.py
index 6482514d..2dfef0e9 100644
--- a/src/manimgx/rendering/feed.py
+++ b/src/manimgx/rendering/feed.py
@@ -42,7 +42,7 @@ from manimgx.mobjects.lights import (
)
if TYPE_CHECKING:
- from manimgx.drawing.geometry import Path
+ from manimgx.drawing.geometry import Trajectory
from manimgx.mobject import Mobject
from manimgx.scene import Camera
@@ -1161,7 +1161,7 @@ class Feeder:
self,
camera: "Camera",
mobjects: "list[Mobject]",
- leaves: "list[tuple[Mobject, list[Mobject], Path, np.ndarray, np.ndarray]]",
+ leaves: "list[tuple[Mobject, list[Mobject], Trajectory, np.ndarray, np.ndarray]]",
) -> Iterator[tuple[bytes, bytes]]:
"""Mix whole keyframe intervals on the CPU; upload an interval when it first appears.
@@ -1184,11 +1184,11 @@ class Feeder:
rows[:, k], present[:, k] = r, True
position = {id(mob): k for k, mob in enumerate(mobjects)}
type Interval = tuple[
- Mobject, Mobject, Mobject, Path, np.ndarray, np.ndarray, int
+ Mobject, Mobject, Mobject, Trajectory, np.ndarray, np.ndarray, int
]
type Cached = dict[float, tuple[np.void | None, tuple[int, ...]]]
type Materialize = tuple[
- Mobject, Mobject, Mobject, Path, np.ndarray, float, int, Cached
+ Mobject, Mobject, Mobject, Trajectory, np.ndarray, float, int, Cached
]
starts: dict[int, list[Interval]] = {}
moving: dict[int, list[Materialize]] = {}
@@ -1270,7 +1270,7 @@ class Feeder:
self,
camera: "Camera",
mobjects: "list[Mobject]",
- leaves: "list[tuple[Mobject, list[Mobject], Path, np.ndarray, np.ndarray]]",
+ leaves: "list[tuple[Mobject, list[Mobject], Trajectory, np.ndarray, np.ndarray]]",
frames: int,
) -> list[bytes] | None:
"""Each frame's view of a pure play that moves the camera or a light (None if it moves
@@ -1298,7 +1298,7 @@ class Feeder:
self,
a: "Mobject",
b: "Mobject",
- path: "Path",
+ path: "Trajectory",
t: np.ndarray,
args: tuple,
live: np.void | None,
diff --git a/src/manimgx/rendering/film.py b/src/manimgx/rendering/film.py
index 26d951c7..f983f46b 100644
--- a/src/manimgx/rendering/film.py
+++ b/src/manimgx/rendering/film.py
@@ -28,7 +28,7 @@ if TYPE_CHECKING:
from manimgx.animation.timeline import Animation
from manimgx.audio.sound import Clip
- from manimgx.drawing.geometry import Path
+ from manimgx.drawing.geometry import Trajectory
from manimgx.mobject import Mobject
from manimgx.scene import Camera
@@ -450,7 +450,7 @@ class Film:
self,
camera: "Camera",
mobjects: "list[Mobject]",
- leaves: "list[tuple[Mobject, list[Mobject], Path, np.ndarray, np.ndarray]]",
+ leaves: "list[tuple[Mobject, list[Mobject], Trajectory, np.ndarray, np.ndarray]]",
) -> None:
"""Record, at once, the frames of a play that only carries its leaves between
keyframes: the scene calls it for such a play.
diff --git a/src/manimgx/scene.py b/src/manimgx/scene.py
index e222c367..bfd429e8 100644
--- a/src/manimgx/scene.py
+++ b/src/manimgx/scene.py
@@ -68,7 +68,7 @@ if TYPE_CHECKING:
from manimgx.animation.transform import Compositor, Transform, TransformOptions
from manimgx.audio import Speech, Voice
from manimgx.audio.sound import Clip, Sound
- from manimgx.drawing.geometry import Path
+ from manimgx.drawing.geometry import Trajectory
from manimgx.mobject import ValueTracker
from manimgx.mobjects.images import ImageCameraOptions
from dataclasses import dataclass
@@ -892,8 +892,8 @@ class Scene:
def _pure_tweens(
self, anim: Animation, alpha: list[float]
- ) -> tuple[list[tuple[Transform, Path]], set[int]] | None:
- """A play that is a pure function of time — its tweens (Transforms along a `Path` between
+ ) -> tuple[list[tuple[Transform, Trajectory]], set[int]] | None:
+ """A play that is a pure function of time — its tweens (Transforms along a `Trajectory` between
fixed keyframes, one per leaf, under compositions that only time them, going forward) and the
objects it introduces; None if anything else acts (updaters, procedures, a camera's picture),
and then every frame is computed. Its groups begin every part now (`begin_all`): nothing a
@@ -908,14 +908,14 @@ class Scene:
)
from manimgx.animation.transform import Transform
from manimgx.audio.sound import Sound
- from manimgx.drawing.geometry import Path
+ from manimgx.drawing.geometry import Trajectory
members = self.get_mobject_family_members()
if self.updaters or any(
m.updaters or isinstance(m.paint.texture, Camera) for m in members
):
return None
- tweens: list[tuple[Transform, Path]] = []
+ tweens: list[tuple[Transform, Trajectory]] = []
begins: list[int] = [] # the frame each tween begins at
for node, progress, closes in walk(anim, np.array(alpha)):
if not _forward(progress):
@@ -934,7 +934,7 @@ class Scene:
return None
kind, path = type(node), node.path_func
if not (
- isinstance(path, Path)
+ isinstance(path, Trajectory)
and kind.interpolate is Animation.interpolate
and kind.interpolate_mobject is Animation.interpolate_mobject
and kind.interpolate_keyframes is Transform.interpolate_keyframes
@@ -990,15 +990,15 @@ class Scene:
self.mobjects = [r for r in self.mobjects if id(r) in present] + new
introduced = {id(x) for root in new for x in root.get_family()}
# each tween's path as its beginning decided it (`.animate` makes its turns a motion
- # when it begins): read now, not before its part began (a Path stays a Path)
+ # when it begins): read now, not before its part began (a Trajectory stays a Trajectory)
return [
- (tween, cast("Path", tween.path_func)) for tween, _ in tweens
+ (tween, cast("Trajectory", tween.path_func)) for tween, _ in tweens
], introduced
def _advance_tweens(
self,
anim: Animation,
- tweens: list[tuple[Transform, Path]],
+ tweens: list[tuple[Transform, Trajectory]],
alpha: list[float],
introduced: set[int],
) -> None:
@@ -2201,10 +2201,10 @@ class ThreeDScene(Scene):
def _tracks(
anim: Animation,
- tweens: list[tuple[Transform, Path]],
+ tweens: list[tuple[Transform, Trajectory]],
alpha: np.ndarray,
introduced: set[int],
-) -> list[tuple[Mobject, list[Mobject], Path, np.ndarray, np.ndarray]]:
+) -> list[tuple[Mobject, list[Mobject], Trajectory, np.ndarray, np.ndarray]]:
"""A pure play at these alphas: per leaf, its keyframes, path, and per instant its interval
and t (-1: not begun, as the play found it; -2: absent, before the part that brings it
begins or after a remover's window closes)."""
diff --git a/tests/scenes.py b/tests/scenes.py
index c95f8581..0b28e6c0 100644
--- a/tests/scenes.py
+++ b/tests/scenes.py
@@ -30,7 +30,7 @@ from manimgx.settings import config
if TYPE_CHECKING:
from manimgx.animation.transform import Transform
- from manimgx.drawing.geometry import Path
+ from manimgx.drawing.geometry import Trajectory
from manimgx.scene import Act
@@ -234,13 +234,13 @@ class Recorder(m.Scene):
def _pure_tweens(
self, anim: m.Animation, alpha: list[float]
- ) -> "tuple[list[tuple[Transform, Path]], set[int]] | None":
+ ) -> "tuple[list[tuple[Transform, Trajectory]], set[int]] | None":
return super()._pure_tweens(anim, alpha) if self.fast else None
def _advance_tweens(
self,
anim: m.Animation,
- tweens: "list[tuple[Transform, Path]]",
+ tweens: "list[tuple[Transform, Trajectory]]",
alpha: list[float],
introduced: set[int],
) -> None:
diff --git a/tests/unit/drawing/test_geometry.py b/tests/unit/drawing/test_geometry.py
index e89fd997..6032807b 100644
--- a/tests/unit/drawing/test_geometry.py
+++ b/tests/unit/drawing/test_geometry.py
@@ -836,7 +836,7 @@ def test_a_mix_of_independent_placements_of_one_shape_stays_one_shape(
if path_kind == "straight"
else g.path_along_circles(np.pi / 3, np.array([1.0, 2.0, 3.0]))
)
- assert isinstance(path, g.Path)
+ assert isinstance(path, g.Trajectory)
coefficients = path.coefficients(alpha)
if path_kind == "circle":
assert coefficients[2].any()
@@ -929,7 +929,7 @@ def every_path(draw: st.DrawFn) -> g.PathFunc:
max_size=4,
)
)
- return g.Path(steps=tuple(steps))
+ return g.Trajectory(steps=tuple(steps))
@given(path=every_path(), ends=clouds)
@@ -1052,7 +1052,7 @@ class TestCarried:
np.testing.assert_allclose(
shape @ motion[:3, :3].T + motion[:3, 3], expected, atol=1e-9
)
- path = g.Path(steps=tuple(steps))
+ path = g.Trajectory(steps=tuple(steps))
actual = path(shape, at(1), alpha)
np.testing.assert_allclose(actual, expected, atol=1e-9)
np.testing.assert_allclose(
diff --git a/tests/unit/rendering/test_feed.py b/tests/unit/rendering/test_feed.py
index c9cee09e..7094bfa9 100644
--- a/tests/unit/rendering/test_feed.py
+++ b/tests/unit/rendering/test_feed.py
@@ -46,7 +46,7 @@ from tests.scenes import frames, scene_3d
import manimgx as m
from manimgx._engine import Player, Recorder, digest
-from manimgx.drawing.geometry import Path
+from manimgx.drawing.geometry import Trajectory
from manimgx.rendering import feed
@@ -601,7 +601,7 @@ def test_streaming_still_mixes_whole_keyframe_intervals(
def measured(
a: m.Mobject,
b: m.Mobject,
- path: Path,
+ path: Trajectory,
t: np.ndarray,
args: tuple,
live: np.void | None,
diff --git a/tests/unit/test_mobject.py b/tests/unit/test_mobject.py
index 462c5069..3b361e62 100644
--- a/tests/unit/test_mobject.py
+++ b/tests/unit/test_mobject.py
@@ -2848,3 +2848,12 @@ def test_get_height_is_height_as_get_width_is_width() -> None:
rectangle = m.Rectangle(width=3.0, height=1.25)
assert rectangle.get_width() == rectangle.width == pytest.approx(3.0)
assert rectangle.get_height() == rectangle.height == pytest.approx(1.25)
+
+
+def test_set_width_and_set_height_scale_in_proportion_as_the_properties_do() -> None:
+ """Manim CE code sizes a mobject with both setters: they set `width` and `height`."""
+ rectangle = m.Rectangle(width=3.0, height=1.5)
+ assert rectangle.set_width(6.0) is rectangle
+ assert (rectangle.width, rectangle.height) == pytest.approx((6.0, 3.0))
+ rectangle.set_height(1.0)
+ assert (rectangle.width, rectangle.height) == pytest.approx((2.0, 1.0))