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

Take #62 to #66 off main for review

Sina Atalaye49a64aa52c7
diff --git a/browser/README.md b/browser/README.md
index 5674303d..304accc8 100644
--- a/browser/README.md
+++ b/browser/README.md
@@ -13,7 +13,7 @@ npm install manimgx
import "manimgx";
</script>
-<manimgx-player controls autoplay>
+<manimgx-player autoplay>
<script type="text/python">
import manimgx as m
@@ -41,9 +41,6 @@ document.body.append(player);
WebAssembly draws the film with WebGPU, and its face over it: the controls, the time, the
timeline in the scene's plays (each named by its line of code), captions, the scene's error
and the keys (`?` lists them), all in ManimGX's fonts. A click, a tap and a key do the same.
-- **A `<video>`'s attributes**: `controls` (without them, the player is a picture that plays,
- and every click, key and wheel is the page's), `autoplay`, `loop` and `muted`.
- `<manimgx-player autoplay loop muted>` plays a scene as a GIF does.
- **Any frame, at once**: the film is recorded as it is made (a *take*: each shape once, then
each frame), and any moment of it is drawn at once, so it plays before the scene has
finished and seeks instantly. Each frame is drawn at the size the page shows it, in the
diff --git a/browser/src/engine.ts b/browser/src/engine.ts
index 4dc675d1..185b9a46 100644
--- a/browser/src/engine.ts
+++ b/browser/src/engine.ts
@@ -18,9 +18,6 @@ export interface Player {
resize(width: number, height: number, scale: number): void;
hide(hidden: boolean): void;
fullscreen(on: boolean): void;
- controls(on: boolean): void;
- looping(on: boolean): void;
- mute(on: boolean): void;
wake(): number;
draw(): void;
asks(): (["scene", string] | ["fullscreen", boolean])[];
diff --git a/browser/src/player.ts b/browser/src/player.ts
index 1a3b2897..fab0e602 100644
--- a/browser/src/player.ts
+++ b/browser/src/player.ts
@@ -3,11 +3,9 @@
// time, the plays, captions, the scene's error, the keys) onto a canvas with WebGPU, and keeps the
// clock and the sound. The element only hands it what its viewer does, in the web's own words,
// draws it when it is due, and does what it asks (another scene, full screen). Its scene is
-// Python, run in the browser by Pyodide (see director.ts). It takes a <video>'s `controls`
-// (without them, it is a picture that plays, the page handling every event), `autoplay`, `loop`
-// and `muted`.
+// Python, run in the browser by Pyodide (see director.ts).
//
-// <manimgx-player controls><script type="text/python"> …a scene… </script></manimgx-player>
+// <manimgx-player><script type="text/python"> …a scene… </script></manimgx-player>
// player.source = code (the film made again, time kept)
import type { Engine, Player } from "./engine.js";
@@ -105,9 +103,9 @@ function begin(): Page {
let films = 0;
/** A scene written in Python, made in the page and played on a canvas by ManimGX's engine,
- * with the engine's own controls if it has `controls`. */
+ * with the engine's own controls. */
export class ManimgxPlayer extends HTMLElement {
- static observedAttributes = ["scene", "controls", "loop", "muted"];
+ static observedAttributes = ["scene"];
#film = 0;
#canvas: HTMLCanvasElement;
@@ -117,7 +115,6 @@ export class ManimgxPlayer extends HTMLElement {
#wants: { time: number; playing: boolean | null } = { time: 0, playing: null };
#begun = false;
#failed = false;
- #tabbed = false; // its tabindex is its own, not the page's
#player: Player | null = null; // native GPU resources belong to one connected lifetime
#connection: AbortController | undefined;
#timer: number | undefined;
@@ -140,6 +137,7 @@ export class ManimgxPlayer extends HTMLElement {
}
connectedCallback(): void {
+ if (!this.hasAttribute("tabindex")) this.tabIndex = 0; // it takes keys
if (this.#connection || this.#failed) return;
this.#film = ++films; // late bytes from an earlier connection belong to its old decoder
const connection = (this.#connection = new AbortController());
@@ -175,14 +173,8 @@ export class ManimgxPlayer extends HTMLElement {
}
}
- attributeChangedCallback(name: string): void {
- if (name === "scene") {
- if (this.#begun && this.#source !== null) this.#run();
- return;
- }
- if (name === "controls") this.#tab();
- this.#heed(name);
- this.#after();
+ attributeChangedCallback(): void {
+ if (this.#begun && this.#source !== null) this.#run();
}
/** The scene's Python source: set it, and the film is made again (the time kept). */
@@ -270,7 +262,6 @@ export class ManimgxPlayer extends HTMLElement {
try {
const { time, playing } = this.#wants;
this.#player = new made.Player(canvas, time, playing ?? this.hasAttribute("autoplay"), MAC);
- for (const name of ["controls", "loop", "muted"]) this.#heed(name);
this.#player.resize(canvas.width, canvas.height, devicePixelRatio);
} catch (error) {
return this.#fail(error);
@@ -281,27 +272,6 @@ export class ManimgxPlayer extends HTMLElement {
this.#after();
}
- /** Its `controls`, `loop` or `muted`, the player's. */
- #heed(name: string): void {
- const on = this.hasAttribute(name);
- if (name === "controls") this.#player?.controls(on);
- if (name === "loop") this.#player?.looping(on);
- if (name === "muted") this.#player?.mute(on);
- }
-
- /** With its controls it takes keys: a stop in the page's tab order (unless the page set its
- * own `tabindex`); without them, it is none. */
- #tab(): void {
- if (this.hasAttribute("controls")) {
- if (this.hasAttribute("tabindex")) return;
- this.tabIndex = 0;
- this.#tabbed = true;
- } else if (this.#tabbed) {
- this.removeAttribute("tabindex");
- this.#tabbed = false;
- }
- }
-
#wait(): void {
if (!this.#player && !this.#failed) this.#said.textContent = begin().status;
}
@@ -372,11 +342,10 @@ export class ManimgxPlayer extends HTMLElement {
on(canvas, "pointermove", (e) => p.pointer(...at(e)));
on(canvas, "pointerdown", (e) => {
if (pressed !== null || e.button !== 0 || !e.isPrimary) return false;
- if (!p.press(...at(e), e.pointerType === "touch")) return false; // no controls: the page's
pressed = e.pointerId;
this.focus({ preventScroll: true });
canvas.setPointerCapture(e.pointerId);
- return true;
+ return p.press(...at(e), e.pointerType === "touch");
});
const end = (e: PointerEvent, ended: () => boolean | void): boolean | void => {
if (e.pointerId !== pressed) return false;
diff --git a/browser/tests/browser.test.ts b/browser/tests/browser.test.ts
index fd8e3adc..dad92c0a 100644
--- a/browser/tests/browser.test.ts
+++ b/browser/tests/browser.test.ts
@@ -41,7 +41,6 @@ async function page(
cursor = "default";
feeds: number[][] = [];
fullscreenChanges = 0;
- switches = { controls: true, looping: false, mute: false };
wakeAfter = -1;
frees = 0;
constructor(_canvas: unknown, time: number, playing: boolean) {
@@ -69,15 +68,6 @@ async function page(
fullscreen() {
this.fullscreenChanges++;
}
- controls(on: boolean) {
- this.switches.controls = on;
- }
- looping(on: boolean) {
- this.switches.looping = on;
- }
- mute(on: boolean) {
- this.switches.mute = on;
- }
}
const waiting = { textContent: "", remove() {} };
const canvas = Object.assign(new EventTarget(), {
@@ -89,6 +79,7 @@ async function page(
class Element extends EventTarget {
isConnected = true;
+ tabIndex = -1;
style = { setProperty() {} };
attributes = new Map<string, string>();
shadowRoot = {
@@ -110,23 +101,13 @@ async function page(
}
setAttribute(name: string, value: string) {
this.attributes.set(name, value);
- this.#changed(name);
+ this.attributeChangedCallback();
}
removeAttribute(name: string) {
this.attributes.delete(name);
- this.#changed(name);
- }
- get tabIndex() {
- return Number(this.getAttribute("tabindex") ?? -1);
- }
- set tabIndex(value: number) {
- this.setAttribute("tabindex", String(value));
+ this.attributeChangedCallback();
}
- #changed(name: string) {
- const { observedAttributes } = this.constructor as { observedAttributes?: string[] };
- if (observedAttributes?.includes(name)) this.attributeChangedCallback(name);
- }
- attributeChangedCallback(_name: string) {}
+ attributeChangedCallback() {}
}
class Director {
@@ -291,6 +272,7 @@ describe("published browser module", () => {
{ film: 1, run: { source: "class Demo(Scene):\n pass\n", scene: null } },
]);
expect(state.canvas).toMatchObject({ width: 640, height: 360 });
+ expect(player.tabIndex).toBe(0);
await director.onmessage!({ data: { status: "Installing ManimGX…" } });
expect(state.waiting.textContent).toBe("Installing ManimGX…");
player.source = "class Changed(Scene): pass";
@@ -372,34 +354,6 @@ describe("published browser module", () => {
expect(state.waiting.textContent).toBe("decode failed");
});
- test("takes a video's controls, loop and muted, and is a tab stop only with its controls", async () => {
- const state = await page();
- const player = new state.api.ManimgxPlayer();
- player.setAttribute("loop", "");
- player.connectedCallback();
- state.flush();
- expect(player.hasAttribute("tabindex")).toBe(false);
- await state.workers[0]!.onmessage!({
- data: { engine: { js: "", wasm: new Uint8Array(), fonts: [] } },
- });
- await settle();
- const native = state.natives[0]!;
- expect(native.switches).toEqual({ controls: false, looping: true, mute: false });
- player.setAttribute("controls", "");
- player.setAttribute("muted", "");
- player.removeAttribute("loop");
- expect(native.switches).toEqual({ controls: true, looping: false, mute: true });
- expect(player.tabIndex).toBe(0);
- player.removeAttribute("controls");
- expect(native.switches.controls).toBe(false);
- expect(player.hasAttribute("tabindex")).toBe(false);
- // the page's own tabindex stays the page's
- player.tabIndex = -1;
- player.setAttribute("controls", "");
- player.removeAttribute("controls");
- expect(player.tabIndex).toBe(-1);
- });
-
test("disconnecting during boot does not create an orphan native player", async () => {
const state = await page();
const player = new state.api.ManimgxPlayer();
diff --git a/docs/content/changelog.md b/docs/content/changelog.md
index 6ea9cc77..814d2fab 100644
--- a/docs/content/changelog.md
+++ b/docs/content/changelog.md
@@ -22,11 +22,9 @@ 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.
-- Give `<manimgx-player>` a `<video>`'s `controls`, `loop` and `muted`, so `<manimgx-player autoplay loop muted>` plays a scene as a GIF does, with nothing over it ([#31](https://github.com/academa-labs/manimgx/issues/31)). A page's own buttons can play it with sound: `play()` and taking away `muted` let the page sound, as a click on the controls does.
### Changed
@@ -44,9 +42,6 @@ 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)).
-- Show `<manimgx-player>`'s controls only with `controls`, as a `<video>` does: without them, the player takes no click, key or wheel, and is no stop in the page's tab order ([#31](https://github.com/academa-labs/manimgx/issues/31)).
### Fixed
@@ -56,8 +51,6 @@ The notable changes to ManimGX, release by release. The format follows
- Make the folder a video or a storyboard is written in when it is missing (`render -o new/out.mp4`, `inspect -o new/sheet.png` and `Scene.render`), instead of failing with "No such file or directory" ([#34](https://github.com/academa-labs/manimgx/issues/34)).
- Raise a ValueError, naming where it is, for a nested, unclosed or stray bracket in a `say` script, which was spoken and captioned ([#39](https://github.com/academa-labs/manimgx/issues/39)).
- Time and caption speech in the pieces Unicode lets a line break between, so a `say` span in Chinese, Japanese or Thai, written without spaces, is timed by its own characters or words, where the whole sentence was one word ([#40](https://github.com/academa-labs/manimgx/issues/40)). Captions are the text as it is written, at most 42 columns wide (a Chinese or Japanese character takes two); a line never starts with a closing mark such as `,` or `」`, and ends where a sentence does, a quoted one too. A speech's words are found in its text by themselves, so a trimmed speech, or a voice that cuts its words its own way, no longer fails or mistimes a span; and an empty span after the last word starts where that word ends.
-- Find a font by any family name it lists, as font menus show it, not only by the one Typst reads: `Text(font="GenSenRounded2 TW")` found nothing, as the font's family is "GenSenRounded2 TW R" to Typst ([#33](https://github.com/academa-labs/manimgx/issues/33)). A family no font has, a typo too, is warned about, where its text quietly fell back to another font.
-- Draw with Direct3D 12 on Windows, as the docs said, not with a GPU's Vulkan driver, which the engine took first: Intel's crashed rendering ([#50](https://github.com/academa-labs/manimgx/issues/50)). Browsers draw WebGPU with Direct3D 12 on Windows too, and CI's Windows runners test it.
- Show an image drawn smaller than its pixels as their mean: each pixel of the video shows the mean of the picture's pixels it covers, however the image is squashed and whatever its `resampling_algorithm`, where it showed the picture at one point, so thin lines broke up and small text was unreadable ([#36](https://github.com/academa-labs/manimgx/issues/36)). An image at its size or larger is drawn as before.
- Keep resources needed by queued video frames until their transparency retries finish, fixing render failures during cache cleanup ([#16](https://github.com/academa-labs/manimgx/issues/16)).
- Draw a storyboard picture without dropping the frame the film holds back, fixing `manimgx render` failures ("unknown shape") under memory pressure.
diff --git a/docs/content/reference/animations/transforms.md b/docs/content/reference/animations/transforms.md
index 58f43649..87113765 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.Trajectory
+::: manimgx.Path
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 3e139fca..5f477fac 100644
--- a/docs/content/user-guide/coming-from-manim-ce.md
+++ b/docs/content/user-guide/coming-from-manim-ce.md
@@ -9,31 +9,17 @@ 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`,
- and `rate_func=m.smooth`, not `rate_functions.smooth`.
+ `from manimgx import polylabel`, not `from manimgx.utils.polylabel import polylabel`.
- 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
@@ -68,7 +54,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`. So are the setters: `set_width(3)` is `width = 3`.
+ `width`, `height`, `color`.
- `PGroup` is `Group`, and the singular `add_foreground_mobject` is
`add_foreground_mobjects`.
@@ -94,8 +80,6 @@ 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/docs/content/user-guide/rendering.md b/docs/content/user-guide/rendering.md
index 7d4a46b7..68257baf 100644
--- a/docs/content/user-guide/rendering.md
+++ b/docs/content/user-guide/rendering.md
@@ -174,7 +174,7 @@ through your bundler, and put a scene in a `<manimgx-player>`:
import "manimgx";
</script>
-<manimgx-player controls autoplay>
+<manimgx-player autoplay>
<script type="text/python">
import manimgx as m
@@ -187,9 +187,7 @@ through your bundler, and put a scene in a `<manimgx-player>`:
</manimgx-player>
```
-With `controls`, the player has the controls and keys of the preview window. It takes a
-`<video>`'s `autoplay`, `loop` and `muted` too: `<manimgx-player autoplay loop muted>` plays
-like a GIF, with nothing over it. The first video on a page downloads
+The player has the keys of the preview window. The first video on a page downloads
Python ([Pyodide](https://pyodide.org)) and ManimGX, about 26 MB; the browser keeps them
for later. It needs WebGPU: Chrome and Edge 113 or later, or Safari 26. Two things don't
work in the browser yet: shapes made from other shapes, such as `Union`, and Chinese,
diff --git a/docs/content/user-guide/text-and-math.md b/docs/content/user-guide/text-and-math.md
index b4098263..0de08e55 100644
--- a/docs/content/user-guide/text-and-math.md
+++ b/docs/content/user-guide/text-and-math.md
@@ -22,8 +22,7 @@ class Words(m.Scene):
- `font_size` sets the size: 48 unless you give another.
- `font` sets the font: `"sans-serif"`, `"monospace"`, or the name of a font on your
- computer, any family name it lists, as font menus show them. The default is New Computer
- Modern, the font of LaTeX. If no font has the name, ManimGX warns and uses the default.
+ computer. The default is New Computer Modern, the font of LaTeX.
- `t2c` colors parts of the text: `m.Text("red and blue", t2c={"red": m.RED, "blue": m.BLUE})`.
Text is a mobject like any other: you can move it, scale it, color it and animate it.
diff --git a/rust/engine/src/player.rs b/rust/engine/src/player.rs
index 5ba85210..6164f011 100644
--- a/rust/engine/src/player.rs
+++ b/rust/engine/src/player.rs
@@ -66,16 +66,12 @@ impl Clock {
self.since = None;
}
- /// Keep it within the film: at its end, it stops there, or, `looping`, plays it again from
- /// its start (true: it jumped); past its last frame made (or a time beyond it the clock was
- /// set to) while it is being made, it waits there, and runs on once more is made.
- fn bound(&mut self, made: f64, ended: bool, looping: bool) -> bool {
+ /// Keep it within the film: at its end, it stops there; past its last frame made (or a time
+ /// beyond it the clock was set to) while it is being made, it waits there, and runs on once
+ /// more is made.
+ fn bound(&mut self, made: f64, ended: bool) {
if !self.playing() || self.now() < made {
- return false;
- }
- if ended && looping && made > 0.0 {
- self.set(0.0);
- return true;
+ return;
}
if ended {
self.set(made);
@@ -84,7 +80,6 @@ impl Clock {
self.time = self.time.max(made);
self.since = Some(Instant::now());
}
- false
}
}
@@ -442,8 +437,6 @@ pub(crate) struct Player {
captions: bool,
fullscreen: bool,
mac: bool,
- controls: bool, // it shows its controls and takes its viewer's input
- looping: bool, // at its end, it plays the film again
hidden: bool, // it takes no picture: drawn again once it shows
counting: bool, // the frame drawn last has its see-through count coming back
due: bool, // to be drawn
@@ -474,8 +467,6 @@ impl Player {
captions: false,
fullscreen: false,
mac: options.mac,
- controls: true,
- looping: false,
hidden: false,
counting: false,
due: true,
@@ -579,7 +570,6 @@ impl Player {
}
pub(crate) fn play(&mut self) {
- self.sound.resume(); // played in a gesture (a page's own button's too, as a <video> is): it may sound
if self.take().is_some_and(|t| t.2) && self.time() >= self.made() - 1e-6 {
self.seek(0.0); // from the start again
}
@@ -676,9 +666,6 @@ impl Player {
/// A key pressed: `key` is its value as the web names it (`" "`, `"k"`, `"ArrowLeft"`,
/// `"Escape"`…). Whether the player took it.
pub(crate) fn key(&mut self, key: &str, m: Modifiers) -> bool {
- if !self.controls {
- return false;
- }
self.sound.resume(); // a key pressed: the page may sound now
let Some(act) = keyed(key, m, self.clock.playing(), self.help || self.fullscreen, self.mac) else { return false };
self.act(act);
@@ -706,9 +693,6 @@ impl Player {
/// The pointer moved to (x, y): pixels from the screen's top left.
pub(crate) fn pointer(&mut self, x: f64, y: f64) {
- if !self.controls {
- return;
- }
self.cursor = (x, y);
self.active = Some(Instant::now());
self.due = true;
@@ -722,9 +706,6 @@ impl Player {
/// The pointer pressed (a finger, if `touch`) at (x, y), pixels from the screen's top left.
/// Whether the player took it.
pub(crate) fn press(&mut self, x: f64, y: f64, touch: bool) -> bool {
- if !self.controls {
- return false;
- }
self.sound.resume();
// what showed before it (a finger comes down where nothing pointed)
let shown = self.shows_controls();
@@ -808,9 +789,6 @@ impl Player {
/// sideways it moves the playhead, a second per 100 points; else the player lets it go by
/// (the page scrolls). Whether it took it.
pub(crate) fn wheel(&mut self, dx: f64, dy: f64) -> bool {
- if !self.controls {
- return false;
- }
if matches!(self.pointer, Pointer::Over(Some(Control::Mute))) && dy.abs() > dx.abs() {
self.wheeled -= dy;
let steps = (self.wheeled / 50.0).trunc();
@@ -862,34 +840,6 @@ impl Player {
self.due = true;
}
- /// It shows its controls and takes its viewer's keys, pointer and wheel, or not: a picture
- /// that plays (its status and errors still show), its page handling every event.
- #[cfg(feature = "web")]
- pub(crate) fn controls(&mut self, on: bool) {
- if !on {
- self.cancel(); // a drag ends where it is
- self.help = false;
- }
- self.controls = on;
- self.due = true;
- }
-
- /// At the film's end, it plays it again from its start, or stops there.
- #[cfg(feature = "web")]
- pub(crate) fn looping(&mut self, on: bool) {
- self.looping = on;
- }
-
- /// Its sound muted, or not. Unmuted (by a page, in its viewer's gesture), it may sound.
- #[cfg(feature = "web")]
- pub(crate) fn mute(&mut self, on: bool) {
- if self.sound.muted && !on {
- self.sound.resume();
- }
- self.sound.muted = on;
- self.due = true;
- }
-
/// What it asks of its screen, since it was last asked.
pub(crate) fn asks(&mut self) -> Vec<Ask> {
std::mem::take(&mut self.asks)
@@ -900,7 +850,7 @@ impl Player {
fn shows_controls(&self) -> bool {
let lately = self.active.is_some_and(|at| at.elapsed() < IDLE);
let on = matches!(self.pointer, Pointer::Over(Some(_)) | Pointer::Dragging { .. } | Pointer::Down { on: Some(_), .. });
- self.controls && self.takes.shown.is_some() && (!self.clock.playing() || self.waits() || lately || on || self.help)
+ self.takes.shown.is_some() && (!self.clock.playing() || self.waits() || lately || on || self.help)
}
/// What the face shows now, at `time`.
@@ -974,9 +924,7 @@ impl Player {
pub(crate) fn draw(&mut self, presenting: impl FnOnce()) -> Result<(), String> {
self.due = false;
let (made, ended, playing) = (self.made(), self.take().is_some_and(|t| t.2), self.clock.playing());
- if self.clock.bound(made, ended, self.looping) {
- self.sound.jumped();
- }
+ self.clock.bound(made, ended);
let time = self.time();
let shown = self.takes.show(time);
self.notes.retain(|&take, _| take >= shown); // a take replaced goes, its notes with it
@@ -1087,24 +1035,4 @@ mod tests {
}
assert_eq!(notes.chapters(3.0), [(0.0, 1.0, "Intro".into()), (1.0, 2.0, "Middle".into()), (2.0, 3.0, "End".into())]);
}
-
- #[test]
- fn at_the_films_end_the_clock_stops_or_plays_it_again() {
- // run from 0 for 5 seconds: past a film of 3
- let ran = Clock { time: 0.0, since: Some(Instant::now() - Duration::from_secs(5)), rate: 1.0 };
- let mut clock = ran;
- assert!(!clock.bound(3.0, true, false));
- assert!(!clock.playing() && (clock.time - 3.0).abs() < 0.1);
- let mut clock = ran;
- assert!(clock.bound(3.0, true, true));
- assert!(clock.playing() && clock.now() < 1.0);
- // a film still being made waits at its last frame, looping or not
- let mut clock = ran;
- assert!(!clock.bound(3.0, false, true));
- assert!(clock.playing() && clock.now() >= 3.0 && clock.now() < 4.0);
- // with no frame yet, there is nothing to play again
- let mut clock = ran;
- assert!(!clock.bound(0.0, true, true));
- assert!(!clock.playing() && clock.time < 0.1);
- }
}
diff --git a/rust/engine/src/python.rs b/rust/engine/src/python.rs
index 76f04988..f3e8ac96 100644
--- a/rust/engine/src/python.rs
+++ b/rust/engine/src/python.rs
@@ -382,7 +382,7 @@ mod typesetting {
/// A typeset document: its rows (float64), its shapes' cubic points, its labelled groups, and
/// whether it needed the system's fonts.
- type Layout = (Py<PyBytes>, Vec<Py<PyBytes>>, Vec<(String, Vec<usize>)>, bool, Vec<String>);
+ type Layout = (Py<PyBytes>, Vec<Py<PyBytes>>, Vec<(String, Vec<usize>)>, bool);
/// Typeset `source` with the fonts in `font_paths` and Typst's own (a system font only by its
/// family's name), and the packages under `packages` besides mitex's (the engine's own): its
@@ -391,10 +391,10 @@ mod typesetting {
#[pyfunction]
#[pyo3(signature = (source, font_paths, packages=None, *, revision=0))]
pub(super) fn typeset(py: Python<'_>, source: String, font_paths: Vec<String>, packages: Option<String>, revision: u64) -> PyResult<Layout> {
- let (rows, shapes, labels, system, missing) = py.detach(|| core::typeset(source, &font_paths, packages.as_deref(), revision)).map_err(TypstError::new_err)?;
+ let (rows, shapes, labels, system) = py.detach(|| core::typeset(source, &font_paths, packages.as_deref(), revision)).map_err(TypstError::new_err)?;
let rows = PyBytes::new(py, bytemuck::cast_slice(&rows)).unbind();
let shapes = shapes.iter().map(|s| PyBytes::new(py, bytemuck::cast_slice(s)).unbind()).collect();
- Ok((rows, shapes, labels, system, missing))
+ Ok((rows, shapes, labels, system))
}
/// The system's fonts' fingerprint (every file under their directories: path, size, time), once
diff --git a/rust/engine/src/render.rs b/rust/engine/src/render.rs
index 32d1e67a..763a7c58 100644
--- a/rust/engine/src/render.rs
+++ b/rust/engine/src/render.rs
@@ -1091,17 +1091,12 @@ async fn adapter(instance: &wgpu::Instance) -> Result<wgpu::Adapter, String> {
}
impl Gpu {
- /// The system's GPU, through the system's own API (Metal on macOS, Direct3D 12 on Windows, Vulkan on Linux, the
- /// browser's WebGPU): its device, and what draws on it.
+ /// The system's GPU, WebGPU's (Metal, Vulkan, DX12, the browser's): its device, and what draws on it.
pub(crate) async fn new() -> Result<Self, String> {
// the system's adapter; where none will do, the lavapipe a Linux wheel bundles
let descriptor = wgpu::InstanceDescriptor { backends: wgpu::Backends::PRIMARY, ..wgpu::InstanceDescriptor::new_without_display_handle() };
- // On Windows, Direct3D 12 alone, as browsers draw WebGPU there: offered Vulkan too, wgpu
- // takes a GPU's Vulkan driver first, which is not the one Windows and its apps are tested
- // with (an Intel GPU's crashed), nor the one CI draws with: WARP is Direct3D 12's.
#[cfg(windows)]
let descriptor = wgpu::InstanceDescriptor {
- backends: wgpu::Backends::DX12,
backend_options: wgpu::BackendOptions { dx12: wgpu::Dx12BackendOptions { shader_compiler: dxc::compiler()?, ..Default::default() }, ..descriptor.backend_options },
..descriptor
};
diff --git a/rust/engine/src/typeset.rs b/rust/engine/src/typeset.rs
index cb082782..e3b65834 100644
--- a/rust/engine/src/typeset.rs
+++ b/rust/engine/src/typeset.rs
@@ -7,7 +7,7 @@
//! with y up (Typst's page is y down; the flip is folded in here). Shapes come in page points,
//! y up. Python scales points to scene units.
-use std::collections::{HashMap, HashSet};
+use std::collections::HashMap;
use std::path::{Path, PathBuf};
use std::sync::{Arc, Mutex, OnceLock};
@@ -75,11 +75,11 @@ fn setup(font_paths: &[String], packages: Option<&str>, named: &[String], revisi
}
let mut fonts = FontStore::new();
let dirs: Vec<PathBuf> = font_paths.iter().map(PathBuf::from).collect();
- fonts.extend(cached_scan(&dirs, || with_family_names(dirs.iter().flat_map(|dir| scan(dir)).collect())));
+ fonts.extend(cached_scan(&dirs, || dirs.iter().flat_map(|dir| scan(dir)).collect()));
fonts.extend(embedded());
if !named.is_empty() {
fonts.extend(
- cached_scan(&font_directories(), || with_family_names(system().collect()))
+ cached_scan(&font_directories(), || system().collect())
.into_iter()
.filter(|(_, info)| named.contains(&info.family.to_lowercase())),
);
@@ -116,37 +116,7 @@ impl FontSource for Mapped {
/// A scanned font as the cache keeps it: where it is, and its info's fields.
type Cached = (PathBuf, u32, String, FontVariant, FontFlags, Vec<FontAxis>, Coverage);
/// What made a cached scan, in its file's name: bump it with Typst, or when `Cached` changes.
-const SCAN: &str = "typst-0.15.1-names";
-
-/// Faces found on disk, each also under every other family name its name table lists (its
-/// typographic family, name ID 16, and its family, ID 1, as written, in every language): a font
-/// is found by any name a font menu shows for it. A name that is a face's own family (Typst's:
-/// ID 1 without its style words), or one of Typst's own fonts', finds what it found before.
-fn with_family_names(found: Vec<(FontPath, FontInfo)>) -> Vec<(FontPath, FontInfo)> {
- let mut own: HashSet<String> = found.iter().map(|(_, info)| info.family.to_lowercase()).collect();
- own.extend(embedded().map(|(_, info)| info.family.to_lowercase()));
- let mut all = Vec::with_capacity(found.len());
- for (path, info) in found {
- for family in family_names(&path).into_iter().filter(|name| !own.contains(&name.to_lowercase())) {
- all.push((FontPath { path: path.path.clone(), index: path.index }, FontInfo { family, ..info.clone() }));
- }
- all.push((path, info));
- }
- all
-}
-
-/// The family names a face's name table lists (IDs 16 and 1, in every language), each once.
-fn family_names(path: &FontPath) -> Vec<String> {
- let Ok(file) = std::fs::File::open(&path.path) else { return Vec::new() };
- // SAFETY: a font file is not written while mapped (as fontdb and typst-kit assume)
- let Ok(map) = (unsafe { memmap2::Mmap::map(&file) }) else { return Vec::new() };
- let Ok(face) = ttf_parser::Face::parse(&map, path.index) else { return Vec::new() };
- let families = [ttf_parser::name_id::FAMILY, ttf_parser::name_id::TYPOGRAPHIC_FAMILY];
- let mut names: Vec<String> = face.names().into_iter().filter(|name| families.contains(&name.name_id)).filter_map(|name| name.to_string()).collect();
- names.sort_by_key(|name| name.to_lowercase());
- names.dedup_by_key(|name| name.to_lowercase());
- names
-}
+const SCAN: &str = "typst-0.15.1";
/// MANIMGX_CACHE_DIR when set, otherwise the current user's native cache or the browser
/// runtime's private filesystem. A missing native root disables disk reuse, with no shared-temp fallback.
@@ -581,22 +551,12 @@ fn message(diagnostics: &[SourceDiagnostic], doc: &Document) -> String {
.join("; ")
}
-pub type Layout = (Vec<f64>, Vec<Vec<f64>>, Vec<(String, Vec<usize>)>, bool, Vec<String>);
-
-/// The font families a compilation found no font for, as its warnings name them, each once.
-fn unknown_families(warnings: &[SourceDiagnostic]) -> Vec<String> {
- let mut families: Vec<String> =
- warnings.iter().filter_map(|w| w.message.strip_prefix("unknown font family: ")).map(str::to_owned).collect();
- families.sort();
- families.dedup();
- families
-}
+pub type Layout = (Vec<f64>, Vec<Vec<f64>>, Vec<(String, Vec<usize>)>, bool);
/// Typeset `source` with the fonts in `font_paths` and Typst's own (a system font only by its
/// family's name), and the packages under `packages` besides mitex's (the engine's own): its
/// items (one row of `ROW` floats each, in document order), its shapes' cubic points and its
-/// labelled groups (a label and the items inside, nested ones too); whether it read a system font;
-/// and the families it names that no font has.
+/// labelled groups (a label and the items inside, nested ones too).
pub fn typeset(source: String, font_paths: &[String], packages: Option<&str>, revision: u64) -> Result<Layout, String> {
{
static COMPILES: std::sync::atomic::AtomicUsize = std::sync::atomic::AtomicUsize::new(0);
@@ -608,17 +568,23 @@ pub fn typeset(source: String, font_paths: &[String], packages: Option<&str>, re
let lean = setup(font_paths, packages, &[], revision);
let doc = Document { setup: &lean, main: main.clone() };
let warned = typst::compile::<PagedDocument>(&doc);
- let named = unknown_families(&warned.warnings);
+ let mut named: Vec<String> = warned
+ .warnings
+ .iter()
+ .filter_map(|w| w.message.strip_prefix("unknown font family: "))
+ .map(str::to_owned)
+ .collect();
+ named.sort();
+ named.dedup();
let full;
let system = !named.is_empty();
- let (doc, compiled, missing) = if system {
+ let (doc, compiled) = if system {
full = setup(font_paths, packages, &named, revision);
let doc = Document { setup: &full, main };
- let warned = typst::compile::<PagedDocument>(&doc);
- let missing = unknown_families(&warned.warnings);
- (doc, warned.output, missing)
+ let compiled = typst::compile::<PagedDocument>(&doc).output;
+ (doc, compiled)
} else {
- (doc, warned.output, named)
+ (doc, warned.output)
};
// Typst memoizes across documents; forget what the last few hundred didn't use
if COMPILES.fetch_add(1, std::sync::atomic::Ordering::Relaxed) % 256 == 255 {
@@ -635,7 +601,7 @@ pub fn typeset(source: String, font_paths: &[String], packages: Option<&str>, re
around: Vec::new(),
};
walk.frame(&page.frame, Transform::identity());
- Ok((walk.rows, walk.shapes, walk.labels, system, missing))
+ Ok((walk.rows, walk.shapes, walk.labels, system))
}
}
diff --git a/rust/engine/src/web.rs b/rust/engine/src/web.rs
index 3959c7c4..0ad6cb42 100644
--- a/rust/engine/src/web.rs
+++ b/rust/engine/src/web.rs
@@ -121,22 +121,6 @@ impl Player {
self.player.fullscreen(on);
}
- /// Its controls, as `<video controls>`: it shows them and takes its viewer's keys, pointer
- /// and wheel, or it is a picture that plays, the page handling every event.
- pub fn controls(&mut self, on: bool) {
- self.player.controls(on);
- }
-
- /// As `<video loop>`: at the film's end, it plays it again from its start.
- pub fn looping(&mut self, on: bool) {
- self.player.looping(on);
- }
-
- /// As `<video muted>`: its sound muted, or not.
- pub fn mute(&mut self, on: bool) {
- self.player.mute(on);
- }
-
/// When to draw it next: 0, at the next animation frame; milliseconds from now; −1, once
/// something happens.
pub fn wake(&mut self) -> Result<f64, JsError> {
@@ -167,12 +151,11 @@ impl Player {
.collect()
}
- /// The cursor over it, as CSS names it; empty where it has none of its own (the page's shows:
- /// an arrow, unless the page says otherwise).
+ /// The cursor over it, as CSS names it.
#[wasm_bindgen(getter)]
pub fn cursor(&self) -> String {
match self.player.cursor() {
- Cursor::Arrow => "",
+ Cursor::Arrow => "default",
Cursor::Hand => "pointer",
Cursor::Hidden => "none",
}
diff --git a/src/manimgx/_engine.pyi b/src/manimgx/_engine.pyi
index a076fee2..f8869129 100644
--- a/src/manimgx/_engine.pyi
+++ b/src/manimgx/_engine.pyi
@@ -252,12 +252,11 @@ def typeset(
packages: str | None = None,
*,
revision: int = 0,
-) -> tuple[bytes, list[bytes], list[tuple[str, list[int]]], bool, list[str]]:
+) -> tuple[bytes, list[bytes], list[tuple[str, list[int]]], bool]:
"""Typeset `source` (Typst): its items as float64 rows of 23 (kind, key, placement a b c d e f,
fill rgba, stroke rgba, stroke width, advance, node start, end, drawn start, end, node kind),
its shapes' cubic points (float64 x y z), its labelled groups (a label and the items inside
- it), whether it needed the system's fonts, and the font families it names that no font
- has. `revision` identifies the caller's font and
+ it) and whether it needed the system's fonts. `revision` identifies the caller's font and
package dependencies; a changed revision replaces the setup remembered for those paths."""
def glyph_outlines(keys: Sequence[int]) -> list[bytes]:
diff --git a/src/manimgx/animation/motion.py b/src/manimgx/animation/motion.py
index d590c45f..61a0eec6 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 (
- Trajectory,
+ Path,
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"] = Trajectory(steps=(path.point_from_proportion,))
+ kwargs["path_func"] = Path(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 1149ca20..901a0e8d 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.Trajectory]); it replaces
+ the end points and the progress (see [paths][manimgx.Path]); 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.Trajectory]); it replaces `path_arc` and `path_arc_centers`.
+ [paths][manimgx.Path]); 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,9 +347,7 @@ 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, Trajectory) and path.kind == "motion" and len(frames) == 2
- ):
+ if not (isinstance(path, Path) 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 ())
@@ -601,7 +599,7 @@ class _Leaf:
path = tween.path_func
rest = (
Blend.mix(a._geometry, b._geometry, path.coefficients(t))
- if isinstance(path, Trajectory)
+ if isinstance(path, Path)
else Blend.of(path(a.points, b.points, t))
)
else: # its chord in the frame its motion carries
@@ -1054,7 +1052,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 = Trajectory(steps=tuple(steps))
+ self._path_func = self._chosen = Path(steps=tuple(steps))
return target
def finish(self) -> None:
diff --git a/src/manimgx/cli/export.py b/src/manimgx/cli/export.py
index d70d8dcd..7851bfe3 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 Trajectory
+ from manimgx.drawing.geometry import Path as MotionPath
def render(
@@ -192,7 +192,7 @@ def inspect(
def _pure_tweens(
self, anim: Animation, alpha: list[float]
- ) -> "tuple[list[tuple[Transform, Trajectory]], set[int]] | None":
+ ) -> "tuple[list[tuple[Transform, MotionPath]], 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 1f13f1a1..9c427fe6 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 Trajectory:
+class Path:
"""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() -> Trajectory:
+def straight_path() -> Path:
"""The straight path: each point goes along the line from its start to its end, as
a transform moves points by default.
"""
- return Trajectory()
+ return Path()
-def path_along_arc(arc_angle: float, axis: Vector3DLike = _PATH_AXIS) -> Trajectory:
+def path_along_arc(arc_angle: float, axis: Vector3DLike = _PATH_AXIS) -> Path:
"""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) -> Traject
"""
if abs(arc_angle) < STRAIGHT_PATH_THRESHOLD:
return straight_path()
- return Trajectory("arc", arc_angle, _unit(axis))
+ return Path("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
- [Trajectory][manimgx.Trajectory]; 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 [Path][manimgx.Path];
+ 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 Trajectory(steps=((arc_angle, unit_axis, points),))
+ return Path(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() -> Trajectory:
+def clockwise_path() -> Path:
"""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() -> Trajectory:
+def counterclockwise_path() -> Path:
"""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) -> Trajectory:
+def spiral_path(angle: float, axis: Vector3DLike = _PATH_AXIS) -> Path:
"""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) -> Trajectory:
"""
if abs(angle) < STRAIGHT_PATH_THRESHOLD:
return straight_path()
- return Trajectory("spiral", angle, _unit(axis))
+ return Path("spiral", angle, _unit(axis))
type Matrix = Floats # 3×4: [linear 3×3 | translation]
diff --git a/src/manimgx/drawing/typesetting.py b/src/manimgx/drawing/typesetting.py
index 49392628..ebbe2c99 100644
--- a/src/manimgx/drawing/typesetting.py
+++ b/src/manimgx/drawing/typesetting.py
@@ -6,7 +6,6 @@ import functools
import os
import pickle
import tempfile
-import warnings
from dataclasses import dataclass
from importlib.resources import files
from importlib.util import find_spec
@@ -83,7 +82,7 @@ _CACHE = (
# what made a layout, part of its key: the entry's format, and the engine's own file (a rebuilt
# engine never reads a layout an older one made)
_ENGINE = Path(_engine.__file__).stat()
-_VERSION = f"layout 5, engine {_ENGINE.st_size} {_ENGINE.st_mtime_ns}".encode()
+_VERSION = f"layout 4, engine {_ENGINE.st_size} {_ENGINE.st_mtime_ns}".encode()
_CONTENT = 1 << 52 # glyph keys by content: exact in float64, apart from the engine's
type Stored = tuple[
np.ndarray,
@@ -91,11 +90,7 @@ type Stored = tuple[
list[tuple[str, list[int]]],
int,
dict[int, tuple[bytes, bytes]],
- list[str],
]
-_PACKAGE = str(
- Path(__file__).parents[1]
-) # ManimGX's files: a warning names the caller's line
def typst_string(text: str) -> str:
@@ -127,8 +122,7 @@ def typeset(
The document is set in the fonts ManimGX ships (Typst's own and the Noto faces),
after those in `font_paths`; a system font is read only for a family the document
- names that none of them has. A font is found by any family name it lists; a family
- no font has is warned about, and its text is set in another font. A layout is kept in the current user's cache directory
+ names that none of them has. A layout is kept in the current user's cache directory
(the browser's private filesystem in a page): the same document, with the same fonts
and packages, is read back, not typeset again, in any process.
@@ -153,12 +147,7 @@ def typeset(
stored = _typeset(source, fonts, packages, int.from_bytes(depends, "little"))
if path is not None:
_write(path, stored)
- rows, shapes, labels, _, glyphs, missing = stored
- for family in missing:
- warnings.warn(
- f"no font has the family name {family!r}: its text is set in another font",
- skip_file_prefixes=(_PACKAGE,),
- )
+ rows, shapes, labels, _, glyphs = stored
records = {
key: _glyph(key, points, carets) for key, (points, carets) in glyphs.items()
}
@@ -220,7 +209,7 @@ def _typeset(
source: str, fonts: tuple[str, ...], packages: str | None, revision: int
) -> Stored:
"""Typeset with Typst; every glyph's key by content, with its outline and carets along."""
- raw, shapes, labels, system, missing = _engine.typeset(
+ raw, shapes, labels, system = _engine.typeset(
source, fonts, packages, revision=revision
)
rows = np.frombuffer(raw).reshape(-1, ROW).copy()
@@ -263,5 +252,4 @@ def _typeset(
labels,
_engine.system_fonts_fingerprint() if system else 0,
glyphs,
- missing,
)
diff --git a/src/manimgx/mobject.py b/src/manimgx/mobject.py
index 855cff29..1d47ff21 100644
--- a/src/manimgx/mobject.py
+++ b/src/manimgx/mobject.py
@@ -63,7 +63,7 @@ from manimgx.drawing.geometry import (
EMPTY,
Blend,
Lattice,
- Trajectory,
+ Path,
_pathops,
bezier,
bezier_remap,
@@ -2485,28 +2485,6 @@ 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."""
@@ -4098,7 +4076,7 @@ class Mobject:
"""
g1, g2 = mobject1._geometry, mobject2._geometry
if (
- isinstance(path_func, Trajectory) and g1.n == g2.n
+ isinstance(path_func, Path) 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/mobjects/text.py b/src/manimgx/mobjects/text.py
index 9df9535e..6f2b534b 100644
--- a/src/manimgx/mobjects/text.py
+++ b/src/manimgx/mobjects/text.py
@@ -801,9 +801,8 @@ class Text(Typst):
text: The text, as written.
line_spacing: The space between lines, in ems: the baselines are
`1 + line_spacing` ems apart; -1 for 0.3.
- font: The font family, by any family name its font lists, or "serif",
- "sans-serif" or "monospace"; "" for New Computer Modern. A family no font
- has is warned about, and the text is set in New Computer Modern.
+ font: The font family, or "serif", "sans-serif" or "monospace"; "" for New
+ Computer Modern.
slant: `NORMAL`, `ITALIC` or `OBLIQUE`.
weight: A weight by name, from `THIN` through `NORMAL` and `BOLD` to
`ULTRAHEAVY`; the font's nearest weight is used.
diff --git a/src/manimgx/rendering/feed.py b/src/manimgx/rendering/feed.py
index 2dfef0e9..6482514d 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 Trajectory
+ from manimgx.drawing.geometry import Path
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], Trajectory, np.ndarray, np.ndarray]]",
+ leaves: "list[tuple[Mobject, list[Mobject], Path, 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, Trajectory, np.ndarray, np.ndarray, int
+ Mobject, Mobject, Mobject, Path, np.ndarray, np.ndarray, int
]
type Cached = dict[float, tuple[np.void | None, tuple[int, ...]]]
type Materialize = tuple[
- Mobject, Mobject, Mobject, Trajectory, np.ndarray, float, int, Cached
+ Mobject, Mobject, Mobject, Path, 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], Trajectory, np.ndarray, np.ndarray]]",
+ leaves: "list[tuple[Mobject, list[Mobject], Path, 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: "Trajectory",
+ path: "Path",
t: np.ndarray,
args: tuple,
live: np.void | None,
diff --git a/src/manimgx/rendering/film.py b/src/manimgx/rendering/film.py
index f983f46b..26d951c7 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 Trajectory
+ from manimgx.drawing.geometry import Path
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], Trajectory, np.ndarray, np.ndarray]]",
+ leaves: "list[tuple[Mobject, list[Mobject], Path, 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 bfd429e8..e222c367 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 Trajectory
+ from manimgx.drawing.geometry import Path
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, Trajectory]], set[int]] | None:
- """A play that is a pure function of time — its tweens (Transforms along a `Trajectory` between
+ ) -> tuple[list[tuple[Transform, Path]], set[int]] | None:
+ """A play that is a pure function of time — its tweens (Transforms along a `Path` 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 Trajectory
+ from manimgx.drawing.geometry import Path
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, Trajectory]] = []
+ tweens: list[tuple[Transform, Path]] = []
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, Trajectory)
+ isinstance(path, Path)
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 Trajectory stays a Trajectory)
+ # when it begins): read now, not before its part began (a Path stays a Path)
return [
- (tween, cast("Trajectory", tween.path_func)) for tween, _ in tweens
+ (tween, cast("Path", tween.path_func)) for tween, _ in tweens
], introduced
def _advance_tweens(
self,
anim: Animation,
- tweens: list[tuple[Transform, Trajectory]],
+ tweens: list[tuple[Transform, Path]],
alpha: list[float],
introduced: set[int],
) -> None:
@@ -2201,10 +2201,10 @@ class ThreeDScene(Scene):
def _tracks(
anim: Animation,
- tweens: list[tuple[Transform, Trajectory]],
+ tweens: list[tuple[Transform, Path]],
alpha: np.ndarray,
introduced: set[int],
-) -> list[tuple[Mobject, list[Mobject], Trajectory, np.ndarray, np.ndarray]]:
+) -> list[tuple[Mobject, list[Mobject], Path, 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/benchmarks/test_comparison.py b/tests/benchmarks/test_comparison.py
index d68fc5f4..8b4bbea3 100644
--- a/tests/benchmarks/test_comparison.py
+++ b/tests/benchmarks/test_comparison.py
@@ -52,16 +52,16 @@ def test_unsupported_cpu_accounting_never_starts_a_process(
def test_unsuccessful_processes_are_retained(
tmp_path: Path, monkeypatch: pytest.MonkeyPatch, timeout: bool
) -> None:
- # a shell, which starts at once: a Python child, coverage starting in it too,
- # may outlast a short timeout on a busy runner
- script = (
- "echo started; exec sleep 30" if timeout else "echo failed deliberately; exit 7"
+ code = (
+ "import time; print('started', flush=True); time.sleep(30)"
+ if timeout
+ else "import sys; print('failed deliberately', flush=True); sys.exit(7)"
)
- monkeypatch.setattr(run, "command", lambda *args: ["/bin/sh", "-c", script])
- args = argparse.Namespace(out=tmp_path, timeout=1 if timeout else 60, dry_run=False)
+ monkeypatch.setattr(run, "command", lambda *args: [sys.executable, "-c", code])
+ args = argparse.Namespace(out=tmp_path, timeout=0.5, dry_run=False)
result = run.run_one("manimgx", "linked_rings", 1, args)
assert result.status == ("timeout" if timeout else "failed")
- assert result.wall_seconds < 10
+ assert result.wall_seconds < 5
assert not result.video
assert Path(result.log).exists()
assert ("started" if timeout else "failed deliberately") in result.error
diff --git a/tests/conftest.py b/tests/conftest.py
index a3ce1318..77b9c9e8 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -136,16 +136,14 @@ def two_fonts(
def typeset(
source: str, fonts: list[str], packages: str | None = None, *, revision: int = 0
- ) -> tuple[bytes, list[bytes], list[tuple[str, list[int]]], bool, list[str]]:
- raw, shapes, labels, system, missing = native(
- source, fonts, packages, revision=revision
- )
+ ) -> tuple[bytes, list[bytes], list[tuple[str, list[int]]], bool]:
+ raw, shapes, labels, system = native(source, fonts, packages, revision=revision)
rows = np.frombuffer(raw).reshape(-1, tc.ROW).copy()
wide, tall = next((sizes[path] for path in fonts if path in sizes), (1.0, 1.0))
places = rows[:, tc.PLACEMENT] # (sx, ky, kx, sy, tx, ty): x's, then y's, apart
places[:, ::2] *= wide
places[:, 1::2] *= tall
- return rows.tobytes(), shapes, labels, system, missing
+ return rows.tobytes(), shapes, labels, system
monkeypatch.setattr(tc, "_CACHE", tc.Path(tmp_path, "layouts"))
monkeypatch.setattr(tc._engine, "typeset", typeset)
diff --git a/tests/scenes.py b/tests/scenes.py
index 0b28e6c0..c95f8581 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 Trajectory
+ from manimgx.drawing.geometry import Path
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, Trajectory]], set[int]] | None":
+ ) -> "tuple[list[tuple[Transform, Path]], 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, Trajectory]]",
+ tweens: "list[tuple[Transform, Path]]",
alpha: list[float],
introduced: set[int],
) -> None:
diff --git a/tests/unit/drawing/test_geometry.py b/tests/unit/drawing/test_geometry.py
index 6032807b..e89fd997 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.Trajectory)
+ assert isinstance(path, g.Path)
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.Trajectory(steps=tuple(steps))
+ return g.Path(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.Trajectory(steps=tuple(steps))
+ path = g.Path(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/drawing/test_typesetting.py b/tests/unit/drawing/test_typesetting.py
index 47bf3fae..51a3b598 100644
--- a/tests/unit/drawing/test_typesetting.py
+++ b/tests/unit/drawing/test_typesetting.py
@@ -14,8 +14,7 @@
- A glyph without an outline is no part, and labels lose it; a paragraph's blank lines are
empty lines.
- Text is set in the fonts ManimGX ships, the same on every machine: every script finds a face
- there (no .notdef glyph), and a system font is read only for a family a text names. A font is
- found by any family name it lists; a family no font has is warned about.
+ there (no .notdef glyph), and a system font is read only for a family a text names.
"""
import gc
@@ -46,7 +45,7 @@ from manimgx.mobject import _PROTOTYPES
from manimgx.mobjects.text import TypstGlyph, _cut
type Document = m.Typst | m.Paragraph
-type Answer = tuple[bytes, list[bytes], list[tuple[str, list[int]]], bool, list[str]]
+type Answer = tuple[bytes, list[bytes], list[tuple[str, list[int]]], bool]
@pytest.mark.parametrize("coordinate", [None, -123, 456])
@@ -57,7 +56,7 @@ def test_optional_font_caret_coordinate_is_checked(
p for p in Path(tc.FONTS[0]).glob("*.ttf") if p.name.startswith("NotoSans[")
)
source = '#set text(font: "Noto Sans")\nA'
- rows, *_ = _engine.typeset(source, [str(font.parent)])
+ rows, _, _, _ = _engine.typeset(source, [str(font.parent)])
glyph = int(np.frombuffer(rows).reshape(-1, tc.ROW)[0, tc.KEY]) % 65536
# A complete font with one optional format-1 caret. Only its coordinate is
# truncated; the font still loads and shapes normally through the real engine.
@@ -73,7 +72,7 @@ def test_optional_font_caret_coordinate_is_checked(
struct.pack_into(">II", data, slot + 8, len(data), len(table))
data.extend(table)
(tmp_path / "font.ttf").write_bytes(data)
- rows, *_ = _engine.typeset(source, [str(tmp_path)])
+ rows, _, _, _ = _engine.typeset(source, [str(tmp_path)])
key = int(np.frombuffer(rows).reshape(-1, tc.ROW)[0, tc.KEY])
assert _engine.ligature_carets(key) == ([] if coordinate is None else [coordinate])
@@ -173,7 +172,7 @@ scans = Path(tempfile.gettempdir()) / 'manimgx-fonts' if root is None else Path(
layouts = t._CACHE
before_scans = set(scans.glob('*.bin'))
before_layouts = set(layouts.glob('*.layout'))
-rows, _, _, system, _ = _engine.typeset('#set text(font:"Noto Sans")\nHello Ω', [sys.argv[1]])
+rows, _, _, system = _engine.typeset('#set text(font:"Noto Sans")\nHello Ω', [sys.argv[1]])
table = np.frombuffer(rows).reshape(-1, 23)
keys = sorted(set(int(row[1]) for row in table if row[0] == 0))
native = hashlib.sha256(rows + b''.join(_engine.glyph_outlines(keys))).hexdigest()
@@ -228,7 +227,7 @@ def test_concurrent_cache_writers_publish_complete_owned_files(
tmp_path: Path, monkeypatch: pytest.MonkeyPatch
) -> None:
path = tmp_path / "entry.layout"
- stored: tc.Stored = (np.zeros((100, tc.ROW)), [], [], 0, {}, [])
+ stored: tc.Stored = (np.zeros((100, tc.ROW)), [], [], 0, {})
expected = pickle.dumps(stored, protocol=5)
first_written, second_half, published = Event(), Event(), Event()
write_bytes, replace = Path.write_bytes, os.replace
@@ -308,7 +307,7 @@ class Engine:
rows[:, tc.FILL] = [0, 0, 0, 1]
rows[:, tc.STROKE] = [-1, -1, -1, -1]
rows[:, tc.ADVANCE] = 1000
- return rows.tobytes(), [], [], False, []
+ return rows.tobytes(), [], [], False
def change(self) -> None:
"""Change what it answered: the made-up font's carets."""
@@ -508,7 +507,7 @@ def test_a_glyph_without_an_outline_is_no_part_and_labels_lose_it(
nonlocal calls
calls += 1
assert calls == 1, "the second construction must read its disk cache"
- return raw, [horizontal.tobytes()], labels, False, []
+ return raw, [horizontal.tobytes()], labels, False
def outlines(keys: Sequence[int]) -> list[bytes]:
return [b"" if key == 981 else square.tobytes() for key in keys]
@@ -587,7 +586,7 @@ def _set(text: m.Text) -> tuple[list[int], bool]:
preamble = tc.TYPST_TEMPLATE.format(
text_size=tc.TYPST_COMPILATION_FONT_SIZE, preamble=text.typst_preamble
)
- rows, _, _, system, _ = _engine.typeset(preamble + text.typst_code, tc.FONTS)
+ rows, _, _, system = _engine.typeset(preamble + text.typst_code, tc.FONTS)
table = np.frombuffer(rows).reshape(-1, tc.ROW)
keys = table[table[:, tc.KIND] == tc.GLYPH, tc.KEY].astype(np.int64)
return [int(k) % 65536 for k in keys], system
@@ -612,14 +611,4 @@ def test_every_script_is_set_in_a_font_manimgx_ships(text: str, font: str) -> No
def test_a_system_font_is_read_only_by_name() -> None:
- # a family ManimGX doesn't ship is looked for among the system's fonts; no font has this one
- with pytest.warns(UserWarning, match="no font has the family name 'no such font'"):
- text = m.Text("Hi", font="No Such Font")
- assert _set(text)[1]
-
-
-def test_a_font_is_found_by_any_family_name_it_lists() -> None:
- # Noto Sans Hebrew lists "Noto Sans Hebrew Light" (its family, name ID 1) beside its
- # typographic family, which Typst names it by
- named = m.Text("שלום", font="Noto Sans Hebrew Light")
- assert _set(named) == _set(m.Text("שלום", font="Noto Sans Hebrew"))
+ assert _set(m.Text("Hi", font="Open Sans"))[1]
diff --git a/tests/unit/rendering/test_feed.py b/tests/unit/rendering/test_feed.py
index 7094bfa9..c9cee09e 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 Trajectory
+from manimgx.drawing.geometry import Path
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: Trajectory,
+ path: Path,
t: np.ndarray,
args: tuple,
live: np.void | None,
diff --git a/tests/unit/test_mobject.py b/tests/unit/test_mobject.py
index 3b361e62..462c5069 100644
--- a/tests/unit/test_mobject.py
+++ b/tests/unit/test_mobject.py
@@ -2848,12 +2848,3 @@ 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))