### Basic Manim Slides Example Source: https://github.com/jeertmans/manim-slides/blob/main/docs/source/reference/examples.md A basic example demonstrating a Manim Slides scene. This is typically used for quickstarts. ```python from manim import * from manim_slides import Slide class BasicExample(Slide): def construct(self): circle = Circle() circle.fill(PINK, opacity=0.5) self.play(Create(circle)) self.next_slide() self.play(FadeOut(circle)) self.wait() ``` -------------------------------- ### 3D Example with ManimGL Source: https://github.com/jeertmans/manim-slides/blob/main/docs/source/reference/examples.md Demonstrates a 3D scene using ManimGL. This example highlights differences in 3D setup compared to standard Manim. ```python from manimgl import * # or from manim import * from manim_slides import ThreeDSlide class ThreeDExample(ThreeDSlide): def construct(self): axes = Axes( x_range=[0, 1, 0.1], y_range=[0, 1, 0.1], z_range=[0, 1, 0.1], x_length=2, y_length=2, z_length=2, ) # Example: plotting a function in 3D def func(x, y): return np.sin(x * y) graph = axes.plot_surface(func, color=BLUE) self.add(axes, graph) self.wait(2) self.next_slide() ``` -------------------------------- ### 3D Example with Manim Source: https://github.com/jeertmans/manim-slides/blob/main/docs/source/reference/examples.md Demonstrates a 3D scene using Manim. Note the specific import and setup for Manim's 3D capabilities. ```python from manim import * from manim_slides import ThreeDSlide class ThreeDExample(ThreeDSlide): def construct(self): axes = Axes( x_range=[0, 1, 0.1], y_range=[0, 1, 0.1], z_range=[0, 1, 0.1], x_length=2, y_length=2, z_length=2, ) # Example: plotting a function in 3D def func(x, y): return np.sin(x * y) graph = axes.plot_surface(func, color=BLUE) self.add(axes, graph) self.wait(2) self.next_slide() ``` -------------------------------- ### Install Project Dependencies with uv Source: https://github.com/jeertmans/manim-slides/blob/main/docs/source/contributing/workflow.md Use this command to install all necessary project and development dependencies using uv. ```bash uv sync ``` -------------------------------- ### Import Manim API for ManimGL Source: https://github.com/jeertmans/manim-slides/blob/main/docs/source/manim_or_manimgl.md Import the Manim API first, then `manim_slides`. This example shows the setup for the ManimGL package. ```python from manimlib import * from manim_slides import Slide ``` -------------------------------- ### Import Manim API for Manim Slides Source: https://github.com/jeertmans/manim-slides/blob/main/docs/source/manim_or_manimgl.md Import the Manim API first, then `manim_slides`. This example shows the setup for the standard Manim package. ```python from manim import * from manim_slides import Slide ``` -------------------------------- ### Install Manim Slides Source: https://github.com/jeertmans/manim-slides/blob/main/docs/source/quickstart.md Install Manim Slides along with Manim or ManimGL. Refer to the installation guide for detailed instructions. ```bash pip install manim-slides ``` -------------------------------- ### Install Manim Slides with Minimal Dependencies Source: https://github.com/jeertmans/manim-slides/blob/main/docs/source/installation.md Install Manim Slides with only the essential dependencies. Additional dependencies can be installed later as needed. ```bash pipx install -U manim-slides ``` -------------------------------- ### Start Manim Slides Presentation Source: https://github.com/jeertmans/manim-slides/blob/main/README.md Start the presentation by providing the scene names as arguments to the `manim-slides` command. ```bash manim-slides [OPTIONS] Scene1 Scene2... ``` ```bash manim-slides BasicExample ``` -------------------------------- ### Verify Manim Slides Installation Source: https://github.com/jeertmans/manim-slides/blob/main/docs/source/installation.md Run this command after installation to confirm that Manim Slides has been set up correctly. ```bash manim-slides --version ``` -------------------------------- ### Render and Present Slides with Manim Slides Installed Source: https://github.com/jeertmans/manim-slides/blob/main/docs/source/reference/sharing.md Use this command to render your Manim animations for a presentation and then present them using `manim-slides present`. Ensure Manim Slides and its dependencies are installed on the target machine. ```bash manim-slides render example.py BasicExample # This or `manim-slides BasicExample` works since # `present` is implied by default manim-slides present BasicExample ``` -------------------------------- ### Install Manim Slides with Custom Optional Dependencies Source: https://github.com/jeertmans/manim-slides/blob/main/docs/source/installation.md Use this syntax to install Manim Slides with a specific combination of optional extras, such as 'magic' or 'sphinx-directive'. ```bash pipx install -U "manim-slides[extra1,extra2]" ``` -------------------------------- ### Full Custom RevealJS Template Example Source: https://github.com/jeertmans/manim-slides/blob/main/docs/source/reference/customize_html.md This is a complete example of a custom HTML template for Manim Slides, incorporating the clock functionality. It includes basic RevealJS setup and Jinja templating for Manim Slides integration. ```html+jinja {% extends "revealjs.html" %} {% block head_end %} {% endblock %} {% block body_end %}
{% endblock %} ``` -------------------------------- ### Advanced Manim Slides Example (ConvertExample) Source: https://github.com/jeertmans/manim-slides/blob/main/docs/source/reference/examples.md An advanced example scene named 'ConvertExample', often used for demonstrating Manim Slides' features in tutorials and demos. ```python from manim import * from manim_slides import Slide class ConvertExample(Slide): def construct(self): # Example content for a slide text = Text('This is ConvertExample') self.play(Write(text)) self.next_slide() self.play(FadeOut(text)) self.wait() ``` -------------------------------- ### Install Manim Slides with Manim or ManimGL Dependencies Source: https://github.com/jeertmans/manim-slides/blob/main/docs/source/installation.md Install Manim Slides along with either Manim or ManimGL dependencies using pipx. ```bash pipx install -U "manim-slides[manim]" # For Manim ``` ```bash # or pipx install -U "manim-slides[manimgl]" # For ManimGL ``` -------------------------------- ### Install Manim Slides with Full Dependencies Source: https://github.com/jeertmans/manim-slides/blob/main/docs/source/installation.md Use this command to install the latest release of Manim Slides with all features, including PySide6 and other optional dependencies. The quotes are recommended for shell compatibility. ```bash pipx install -U "manim-slides[pyside6-full]" ``` -------------------------------- ### Example using Subclassed MovingCameraSlide Source: https://github.com/jeertmans/manim-slides/blob/main/docs/source/reference/examples.md An example demonstrating the use of a custom scene class that subclasses MovingCameraScene and Manim Slides. It animates the camera frame. ```python from manim import * from manim_slides import Slide class MovingCameraSlide(Slide, MovingCameraScene): pass class SubclassExample(MovingCameraSlide): """Example taken from ManimCE's docs.""" def construct(self): self.camera.frame.save_state() ax = Axes(x_range=[-1, 10], y_range=[-1, 10]) graph = ax.plot(lambda x: np.sin(x), color=WHITE, x_range=[0, 3 * PI]) dot_1 = Dot(ax.i2gp(graph.t_min, graph)) dot_2 = Dot(ax.i2gp(graph.t_max, graph)) self.add(ax, graph, dot_1, dot_2) self.play(self.camera.frame.animate.scale(0.5).move_to(dot_1)) self.next_slide() self.play(self.camera.frame.animate.move_to(dot_2)) self.next_slide() self.play(Restore(self.camera.frame)) self.wait() ``` -------------------------------- ### Manim Slides Example with Various Media Types Source: https://github.com/jeertmans/manim-slides/blob/main/docs/source/reference/examples.md Demonstrates how Manim Slides can incorporate external media files like images, GIFs, and videos into presentations. ```python from manim import * from manim_slides import Slide class SlideTypesExample(Slide): def construct(self): # Example: Adding an image image = ImageMobject("path/to/your/image.png") self.add(image) self.next_slide() # Example: Adding a video (requires appropriate Manim setup) # video = VideoMobject("path/to/your/video.mp4") # self.add(video) # self.wait(video.get_length()) # self.next_slide() self.wait() ``` -------------------------------- ### Render Manim Slides Source: https://github.com/jeertmans/manim-slides/blob/main/docs/source/quickstart.md Use the `manim-slides render` command to ensure you are using the correct Manim installation. This command is a wrapper around `manim render` or `manimgl render`. ```bash manim-slides render [ARGS]... ``` -------------------------------- ### Horizontal Slides Example Source: https://github.com/jeertmans/manim-slides/blob/main/docs/source/reference/html.md Demonstrates the default horizontal slide arrangement. No direction argument is passed to next_slide, resulting in a linear progression. ```python from manim import * from manim_slides import Slide class HorizontalSlides(Slide): def construct(self): circle = Circle(radius=3, color=BLUE) dot = Dot() self.play(GrowFromCenter(circle)) self.next_slide(loop=True) self.play(MoveAlongPath(dot, circle), run_time=2, rate_func=linear) self.next_slide() self.play(dot.animate.move_to(ORIGIN)) ``` -------------------------------- ### Example of Default Manim API Detection Source: https://github.com/jeertmans/manim-slides/blob/main/docs/source/manim_or_manimgl.md Demonstrates how Manim Slides automatically detects the imported Manim API. It asserts that `Slide` subclasses `Scene` from ManimGL when `manimlib` is imported, and not from Manim. ```python from manimlib import Scene from manim_slides import Slide assert issubclass(Slide, Scene) # Slide subclasses Scene from ManimGL from manim import Scene assert not issubclass(Slide, Scene) # but not Scene from Manim ``` -------------------------------- ### Vertical and Horizontal Slides Example Source: https://github.com/jeertmans/manim-slides/blob/main/docs/source/reference/html.md Illustrates the use of vertical slides. The 'direction="vertical"' argument in next_slide creates a vertical grouping accessible via up/down keys. ```python from manim import * from manim_slides import Slide class VerticalAndHorizontalSlides(Slide): def construct(self): circle = Circle(radius=3, color=BLUE) dot = Dot() self.play(GrowFromCenter(circle)) self.next_slide(direction="vertical", loop=True) self.play(MoveAlongPath(dot, circle), run_time=2, rate_func=linear) self.next_slide(direction="vertical") self.play(dot.animate.move_to(ORIGIN)) ``` -------------------------------- ### Build Documentation with uv and make Source: https://github.com/jeertmans/manim-slides/blob/main/docs/source/contributing/workflow.md Navigate to the docs directory and use 'uv run make html' to generate the project's documentation. ```bash cd docs uv run make html ``` -------------------------------- ### Try Manim Slides with Nixpkgs Source: https://github.com/jeertmans/manim-slides/blob/main/docs/source/installation.md Execute this command to try out the Manim Slides package using Nix, which includes PyQt6 and other necessary tools like ffmpeg. ```bash nix-shell -p manim ffmpeg manim-slides ``` -------------------------------- ### Show Configuration Options Source: https://github.com/jeertmans/manim-slides/blob/main/docs/source/reference/html.md This command displays a list of available configuration options for the HTML conversion. These options often correspond to RevealJS settings. ```bash manim-slides convert --show-config ``` -------------------------------- ### Manim Slides Present Help Source: https://github.com/jeertmans/manim-slides/blob/main/docs/source/reference/gui.md Displays help information for the 'present' command, listing optional parameters for the GUI. ```bash manim-slides present --help ``` -------------------------------- ### Show HTML Converter Configuration Source: https://github.com/jeertmans/manim-slides/blob/main/docs/source/reference/cli.md Use this command to display all configuration options for the HTML converter. ```bash manim-slides convert --to=html --show-config ``` -------------------------------- ### Import Manim and Manim Slides Source: https://github.com/jeertmans/manim-slides/blob/main/docs/source/reference/examples.md Import Manim Slides and Manim or ManimGL for creating presentations. ```python from manim import * from manim_slides import Slide, ThreeDSlide ``` ```python from manimlib import * from manim_slides import Slide, ThreeDSlide ``` -------------------------------- ### Render Manim Slides at Low Quality Source: https://github.com/jeertmans/manim-slides/blob/main/docs/source/reference/large_presentation_tips.md Use the -ql flag for low quality and optionally set --fps to a lower value during development to speed up rendering. Switch to higher quality settings like -qh or -qk only when finalizing the presentation. ```bash manim-slides render your_script.py YourClass -ql --fps=10 ``` -------------------------------- ### Show PDF Converter Configuration Source: https://github.com/jeertmans/manim-slides/blob/main/docs/source/reference/cli.md Use this command to display all configuration options for the PDF converter. ```bash manim-slides convert --to=pdf --show-config ``` -------------------------------- ### Initialize Manim Slides Configuration Source: https://github.com/jeertmans/manim-slides/blob/main/docs/source/reference/gui.md Initializes the default configuration file for Manim Slides. This feature is currently limited. ```bash manim-slides init ``` -------------------------------- ### Present Slides from Pre-rendered Animation Files Source: https://github.com/jeertmans/manim-slides/blob/main/docs/source/reference/sharing.md If you have already rendered your animations and have the slides folder, you can present directly using `manim-slides present`. Ensure the slides directory is in your current working directory or specify its location with `--folder`. ```bash # Make sure that the slides directory is in the current # working directory, or specify with `--folder ` manim-slides present BasicExample ``` -------------------------------- ### Render Specific Animation Range in Manim Slides Source: https://github.com/jeertmans/manim-slides/blob/main/docs/source/reference/large_presentation_tips.md Use the -n flag to specify a start and end index (inclusive) for rendering a contiguous range of animations within a scene. This is useful for quickly re-rendering only the affected slides after a bug fix. ```bash manim-slides render your_file.py YourClass -n a,b ``` -------------------------------- ### Run Linters and Formatters with uv and pre-commit Source: https://github.com/jeertmans/manim-slides/blob/main/docs/source/contributing/workflow.md Execute all configured linters and formatters using uv and pre-commit to ensure code quality and style consistency. ```bash uv run pre-commit run --all-files ``` -------------------------------- ### Launch Manim Slides GUI Source: https://github.com/jeertmans/manim-slides/blob/main/docs/source/reference/gui.md Launches the Manim Slides GUI to present scenes. If no command is specified, 'present' is used by default. ```bash manim-slides [present] [SCENES]... ``` -------------------------------- ### Show Zip Converter Configuration Source: https://github.com/jeertmans/manim-slides/blob/main/docs/source/reference/cli.md Use this command to display all configuration options for the Zip converter. The Zip converter inherits from the HTML converter. ```bash manim-slides convert --to=zip --show-config ``` -------------------------------- ### Run Manim Slides Key Binding Wizard Source: https://github.com/jeertmans/manim-slides/blob/main/docs/source/reference/gui.md Launches a configuration wizard to change default key bindings for Manim Slides. Be cautious when overwriting default bindings. ```bash manim-slides wizard ``` -------------------------------- ### Build Manim Slides Docker Image Source: https://github.com/jeertmans/manim-slides/blob/main/docker/README.md Build the Docker image from the root directory of the repository. Ensure you are in the correct directory to avoid issues with file paths. ```bash docker build -t manim-slide/manin-slide:TAG -f docker/Dockerfile . ``` -------------------------------- ### Initialize Firebase and Set Up Room Source: https://github.com/jeertmans/manim-slides/blob/main/docs/source/_static/firebase_sync_demo.html Initializes Firebase app, authentication, and database. Sets up room-specific references and handles room ID generation for presenters. This code is executed when the page loads. ```javascript import { initializeApp } from "https://www.gstatic.com/firebasejs/10.12.0/firebase-app.js"; import { getAuth, signInAnonymously } from "https://www.gstatic.com/firebasejs/10.12.0/firebase-auth.js"; import { getDatabase, ref, onValue, set, serverTimestamp, onDisconnect } from "https://www.gstatic.com/firebasejs/10.12.0/firebase-database.js"; const firebaseConfig = { apiKey: "AIzaSyD6zkJUPgUF0X5jgLo_E2lOSIUXvNPi5Xk", authDomain: "manim-slides-sync.firebaseapp.com", databaseURL: "https://manim-slides-sync-default-rtdb.europe-west1.firebasedatabase.app", projectId: "manim-slides-sync" }; const params = new URLSearchParams(window.location.search); const hash = window.location.hash; const role = (params.get("role") === "presenter" || hash.includes("presenter")) ? "presenter" : "guest"; const isPresenter = role === "presenter"; const isGuest = !isPresenter; let roomId = params.get("room"); if (isPresenter && !roomId) { roomId = "room-" + Math.random().toString(36).substring(2, 8); params.set("room", roomId); const newUrl = window.location.pathname + "?" + params.toString() + hash; window.history.replaceState(null, "", newUrl); } if (roomId) { const app = initializeApp(firebaseConfig); const auth = getAuth(app); const db = getDatabase(app); const roomRef = ref(db, `rooms/${roomId}`); const metaRef = ref(db, `rooms/${roomId}/meta`); let lastSeq = 0; let revealReady = typeof Reveal !== "undefined" && Reveal.isReady && Reveal.isReady(); let bufferedUpdate = null; ``` -------------------------------- ### Run Manim Slides Command with uv Source: https://github.com/jeertmans/manim-slides/blob/main/docs/source/contributing/workflow.md Prepend 'uv run' to any Manim Slides command to execute it within the project's virtual environment. ```bash uv run manim-slides wizard ``` -------------------------------- ### Convert to PowerPoint Presentation Source: https://github.com/jeertmans/manim-slides/blob/main/docs/source/reference/sharing.md Use this command to convert your Manim slides into a PowerPoint presentation. All videos and necessary files are embedded within the .pptx file for easy sharing. The poster frame defaults to the first frame of each slide for smooth transitions. ```bash manim-slides convert --to=pptx BasicExample basic_example.pptx ``` -------------------------------- ### Initialize Firebase and Set Up Room Source: https://github.com/jeertmans/manim-slides/blob/main/manim_slides/templates/firebase_sync.html Initializes Firebase with provided configuration and sets up a unique room ID for synchronization. If running as a presenter without a room ID, a new one is generated and updated in the URL. ```javascript import { initializeApp } from "https://www.gstatic.com/firebasejs/10.12.0/firebase-app.js"; import { getAuth, signInAnonymously } from "https://www.gstatic.com/firebasejs/10.12.0/firebase-auth.js"; import { getDatabase, ref, onValue, set, serverTimestamp, onDisconnect } from "https://www.gstatic.com/firebasejs/10.12.0/firebase-database.js"; const firebaseConfig = { apiKey: "{{ firebase_api_key | default('AIzaSyD6zkJUPgUF0X5jgLo_E2lOSIUXvNPi5Xk') }}", authDomain: "{{ firebase_auth_domain | default('manim-slides-sync.firebaseapp.com') }}", databaseURL: "{{ firebase_database_url | default('https://manim-slides-sync-default-rtdb.europe-west1.firebasedatabase.app') }}", projectId: "{{ firebase_project_id | default('manim-slides-sync') }}" }; const params = new URLSearchParams(window.location.search); const hash = window.location.hash; const role = (params.get("role") === "presenter" || hash.includes("presenter")) ? "presenter" : "guest"; const isPresenter = role === "presenter"; const isGuest = !isPresenter; let roomId = params.get("room"); if (isPresenter && !roomId) { roomId = "room-" + Math.random().toString(36).substring(2, 8); params.set("room", roomId); const newUrl = window.location.pathname + "?" + params.toString() + hash; window.history.replaceState(null, "", newUrl); } if (roomId) { const app = initializeApp(firebaseConfig); const auth = getAuth(app); const db = getDatabase(app); const roomRef = ref(db, `rooms/${roomId}`); const metaRef = ref(db, `rooms/${roomId}/meta`); let lastSeq = 0; let revealReady = typeof Reveal !== "undefined" && Reveal.isReady && Reveal.isReady(); let bufferedUpdate = null; ``` -------------------------------- ### Create Slides with Manim Slides Source: https://github.com/jeertmans/manim-slides/blob/main/README.md Use `Slide` as a base class instead of `Scene` and call `self.next_slide()` to define slide transitions. Use `loop=True` for looping animations within a slide. ```python from manim import * from manim_slides import Slide class BasicExample(Slide): def construct(self): circle = Circle(radius=3, color=BLUE) dot = Dot() self.play(GrowFromCenter(circle)) self.next_slide() # Waits user to press continue to go to the next slide self.next_slide(loop=True) # Start loop self.play(MoveAlongPath(dot, circle), run_time=2, rate_func=linear) self.next_slide() # This will start a new non-looping slide self.play(dot.animate.move_to(ORIGIN)) ``` -------------------------------- ### Import Manim and Manim Slides Source: https://github.com/jeertmans/manim-slides/blob/main/docs/source/reference/magic_example.ipynb Import necessary classes from Manim and Manim Slides. These imports are required for using the magics and creating slides. ```python from manim import * from manim_slides import * ``` -------------------------------- ### Create a Self-Contained HTML Presentation Source: https://github.com/jeertmans/manim-slides/blob/main/docs/source/reference/sharing.md Use the `--one-file` flag to generate a single HTML file containing all animations data URI encoded. Add the `--offline` flag to also embed JS and CSS files, making the presentation fully self-contained. ```bash # Example usage (flags can be combined): # manim-slides convert --one-file --offline BasicExample presentation.html ``` -------------------------------- ### Render Manim Slides Animations Source: https://github.com/jeertmans/manim-slides/blob/main/README.md Render Manim animations for presentation using the `manim-slides render` command. Specify `--GL` if using ManimGL. ```bash manim-slides render example.py BasicExample ``` ```bash manim-slides render --GL example.py BasicExample ``` -------------------------------- ### Try Manim Slides in a Python Environment with Nixpkgs Source: https://github.com/jeertmans/manim-slides/blob/main/docs/source/installation.md Use this command to run Manim Slides within a Nix-managed Python environment, specifying Manim Slides and other desired Python packages. ```bash nix-shell -p manim ffmpeg "python3.withPackages(ps: with ps; [ manim-slides, ...])" ``` -------------------------------- ### Reveal.js Initialization Configuration Source: https://github.com/jeertmans/manim-slides/blob/main/docs/source/_static/firebase_sync_demo.html Configures Reveal.js presentation settings. This includes presentation dimensions, margins, scaling, controls, slide numbering, and navigation behavior. Adjust these options to customize the presentation's appearance and interactivity. ```javascript Reveal.initialize({ // The "normal" size of the presentation, aspect ratio will // be preserved when the presentation is scaled to fit different // resolutions. Can be specified using percentage units. width: '100%', height: '100%', // Factor of the display size that should remain empty around // the content margin: 0.04, // Bounds for smallest/largest possible scale to apply to content minScale: 0.2, maxScale: 2.0, // Display presentation control arrows controls: false, // Help the user learn the controls by providing hints, for example by // bouncing the down arrow when they first encounter a vertical slide controlsTutorial: true, // Determines where controls appear, "edges" or "bottom-right" controlsLayout: 'bottom-right', // Visibility rule for backwards navigation arrows; "faded", "hidden" // or "visible" controlsBackArrows: 'faded', // Display a presentation progress bar progress: false, // Display the page number of the current slide // - true: Show slide number // - false: Hide slide number // // Can optionally be set as a string that specifies the number formatting: // - "h.v": Horizontal . vertical slide number (default) // - "h/v": Horizontal / vertical slide number // - "c": Flattened slide number // - "c/t": Flattened slide number / total slides // // Alternatively, you can provide a function that returns the slide // number for the current slide. The function should take in a slide // object and return an array with one string [slideNumber] or // three strings [n1,delimiter,n2]. See #formatSlideNumber(). slideNumber: false, // Can be used to limit the contexts in which the slide number appears // - "all": Always show the slide number // - "print": Only when printing to PDF // - "speaker": Only in the speaker view showSlideNumber: 'all', // Use 1 based indexing for # links to match slide number (default is zero // based) hashOneBasedIndex: false, // Add the current slide number to the URL hash so that reloading the // page/copying the URL will return you to the same slide hash: false, // Flags if we should monitor the hash and change slides accordingly respondToHashChanges: false, // Enable support for jump-to-slide navigation shortcuts jumpToSlide: true, // Push each slide change to the browser history. Implies `hash: true` history: false, // Enable keyboard shortcuts for navigation keyboard: true, // Optional function that blocks keyboard events when retuning false // // If you set this to 'focused', we will only capture keyboard events // for embedded decks when they are in focus keyboardCondition: null, // Disables the default reveal.js slide layout (scaling and centering) // so that you can use custom CSS layout disableLayout: false, // Enable the slide overview mode overview: true, // Vertical centering of slides center: true, // Enables touch navigation on devices with touch input touch: true, // Loop the presentation loop: false, // Change the presentation direction to be RTL rtl: false, // Changes the behavior of our navigation directions. // // "default" // Left/right arrow keys step between horizontal slides, up/down // arrow keys step between vertical slides. Space key steps through // all slides (both horizontal and vertical). // // "linear" // Removes the up/down arrows. Left/right arrows step through all // slides (both horizontal and vertical). // // "grid" // When this is enabled, stepping left/right from a vertical stack // to an adjacent vertical stack will land you at the same vertical // index. // // Consider a deck with six slides ordered in two vertical stacks: // 1.1 2.1 // 1.2 2.2 // 1.3 2.3 // // If you're on slide 1.3 and navigate right, you will normally move // from 1.3 -> 2.1. If "grid" is used, the same navigation takes you // from 1.3 -> 2.3. navigationMode: 'default', // Randomizes the order of slides each time the presentation loads shuffle: false, // Turns fragments on and off globally fragments: true, // Flags whether to include the current fragment in the URL, // so that reloading brings you to the same fragment position fragmentInURL: true, // Flags if the presentation is running in an embedded mode, // i.e. }); ``` -------------------------------- ### Reveal.js Initialization Configuration Source: https://github.com/jeertmans/manim-slides/blob/main/manim_slides/templates/firebase_sync.html Configures the Reveal.js presentation framework, including options for controls, navigation, slide numbering, history, and touch support. This snippet is typically embedded within an HTML template. ```html {% for presentation_config in presentation_configs -%} {% set ns = namespace(open_stack=false) %} {%- set outer_loop = loop %} {% for slide_config in presentation_config.slides %} {% if one_file %} {% set file = file_to_data_uri(slide_config.file) %} {% else %} {% set file = assets_dir ~ '/' ~ (prefix(outer_loop.index0) + slide_config.file.name) %} {% endif %} {% if slide_config.direction == "vertical" %} {% if not ns.open_stack %} {% set ns.open_stack = true %} {% endif %} {% else %} {% if ns.open_stack %} {% set ns.open_stack = false %} {% endif %} {% endif %} {% if slide_config.notes != "" %} {{ slide_config.notes }} {% endif %} {% endfor %} {% if ns.open_stack %} {% endif %} {% endfor %} {% if has_notes %} {% endif %} Reveal.initialize({ {% if has_notes %} /// The list of RevealJS plugins. plugins: [ RevealMarkdown, RevealNotes ], {% endif %} // The "normal" size of the presentation, aspect ratio will // be preserved when the presentation is scaled to fit different // resolutions. Can be specified using percentage units. width: {{ width }}, height: {{ height }}, // Factor of the display size that should remain empty around // the content margin: {{ margin }}, // Bounds for smallest/largest possible scale to apply to content minScale: {{ min_scale }}, maxScale: {{ max_scale }}, // Display presentation control arrows controls: {{ controls }}, // Help the user learn the controls by providing hints, for example by // bouncing the down arrow when they first encounter a vertical slide controlsTutorial: {{ controls_tutorial }}, // Determines where controls appear, "edges" or "bottom-right" controlsLayout: {{ controls_layout }}, // Visibility rule for backwards navigation arrows; "faded", "hidden" // or "visible" controlsBackArrows: {{ controls_back_arrows }}, // Display a presentation progress bar progress: {{ progress }}, // Display the page number of the current slide // - true: Show slide number // - false: Hide slide number // // Can optionally be set as a string that specifies the number formatting: // - "h.v": Horizontal . vertical slide number (default) // - "h/v": Horizontal / vertical slide number // - "c": Flattened slide number // - "c/t": Flattened slide number / total slides // // Alternatively, you can provide a function that returns the slide // number for the current slide. The function should take in a slide // object and return an array with one string [slideNumber] or // three strings [n1,delimiter,n2]. See #formatSlideNumber(). slideNumber: {{ slide_number }}, // Can be used to limit the contexts in which the slide number appears // - "all": Always show the slide number // - "print": Only when printing to PDF // - "speaker": Only in the speaker view showSlideNumber: {{ show_slide_number }}, // Use 1 based indexing for # links to match slide number (default is zero // based) hashOneBasedIndex: {{ hash_one_based_index }}, // Add the current slide number to the URL hash so that reloading the // page/copying the URL will return you to the same slide hash: {{ hash }}, // Flags if we should monitor the hash and change slides accordingly respondToHashChanges: {{ respond_to_hash_changes }}, // Enable support for jump-to-slide navigation shortcuts jumpToSlide: {{ jump_to_slide }}, // Push each slide change to the browser history. Implies `hash: true` history: {{ history }}, // Enable keyboard shortcuts for navigation keyboard: {{ keyboard }}, // Optional function that blocks keyboard events when retuning false // // If you set this to 'focused', we will only capture keyboard events // for embedded decks when they are in focus keyboardCondition: {{ keyboard_condition }}, // Disables the default reveal.js slide layout (scaling and centering) // so that you can use custom CSS layout disableLayout: {{ disable_layout }}, // Enable the slide overview mode overview: {{ overview }}, // Vertical centering of slides center: {{ center }}, // Enables touch navigation on devices with touch input touch: {{ touch }}, // Loop the presentation loop: {{ loop }}, // Change the presentation direction to be RTL rtl: {{ rtl }}, // Changes the behavior of our navigation directions. // // "default" // Left/right arrow keys step between horizontal slides, up/down // arrow keys step between vertical slides. Space key steps through // all slides (both horizontal and vertical). // // "linear" // Removes the up/down arrows. ``` -------------------------------- ### Subclassing Manim's MovingCameraScene Source: https://github.com/jeertmans/manim-slides/blob/main/docs/source/reference/examples.md Shows how to subclass Manim's MovingCameraScene along with Manim Slides for custom camera animations within slides. ```python from manim import * from manim_slides import Slide class MovingCameraSlide(Slide, MovingCameraScene): pass ``` -------------------------------- ### Generate and Convert Manim Slides Source: https://github.com/jeertmans/manim-slides/blob/main/docs/source/reference/examples.md Commands to render a Manim scene and convert it into an HTML presentation with navigation controls. ```bash manim example.py SCENE # or manimgl example SCENE manim-slides convert SCENE scene.html -ccontrols=true ``` -------------------------------- ### Manim Slides CLI Commands Source: https://github.com/jeertmans/manim-slides/blob/main/docs/source/reference/cli.md This section lists all available commands for the manim-slides CLI, generated using the click library. ```APIDOC ## manim-slides ### Description The main command-line interface for manim-slides. ### Usage ```bash manim-slides [OPTIONS] ``` ### Commands - `convert`: Convert slides to various formats. - `help`: Show help for a given command. ### See Also Use `manim-slides help ` for more information on a specific command. ``` -------------------------------- ### Parallelize Manim Slides Rendering with Media Directories Source: https://github.com/jeertmans/manim-slides/blob/main/docs/source/reference/large_presentation_tips.md To avoid media file collisions when rendering multiple scenes in parallel, assign each scene its own unique media directory. The provided script demonstrates how to automate this process. ```python ## Usage ## python fast-render.py ``` -------------------------------- ### Guest: Receive Slide State and Pointer Updates Source: https://github.com/jeertmans/manim-slides/blob/main/docs/source/_static/firebase_sync_demo.html Listens for slide changes and pointer movements from the presenter. Applies updates to the Reveal.js instance and displays a remote pointer. ```javascript } else { // Guest mode onValue(roomRef, (snapshot) => { const data = snapshot.val(); console.log("Firebase received sync event:", data); if (data && data.seq > lastSeq) { lastSeq = data.seq; if (revealReady && typeof Reveal !== "undefined") { Reveal.slide(data.h, data.v, data.f); } else { bufferedUpdate = data; } } }); // Handlers to apply update once Reveal is ready const onRevealReady = () => { revealReady = true; if (bufferedUpdate) { Reveal.slide(bufferedUpdate.h, bufferedUpdate.v, bufferedUpdate.f); bufferedUpdate = null; } // Disable guest controls Reveal.configure({ controls: false, progress: false, keyboard: false, touch: false, overview: false, mouseWheel: false, }); }; if (typeof Reveal !== "undefined") { if (Reveal.isReady()) onRevealReady(); else Reveal.on("ready", onRevealReady); } else { window.addEventListener("load", () => { if (Reveal.isReady()) onRevealReady(); else Reveal.on("ready", onRevealReady); }); } // Laser pointer setup const laser = document.createElement("div"); laser.style.position = "fixed"; laser.style.left = "0px"; laser.style.top = "0px"; laser.style.width = "15px"; laser.style.height = "15px"; laser.style.borderRadius = "50%"; laser.style.backgroundColor = "red"; laser.style.boxShadow = "0 0 10px red"; laser.style.zIndex = "99999"; laser.style.pointerEvents = "none"; laser.style.transition = "transform 0.05s linear, opacity 0.2s"; laser.style.opacity = "0"; document.body.appendChild(laser); let hideTimeout; onValue(ref(db, `rooms/${roomId}/pointer`), (snapshot) => { const data = snapshot.val(); if (data && data.active) { laser.style.opacity = "1"; laser.style.transform = `translate(${data.x * window.innerWidth - 7.5}px, ${data.y * window.innerHeight - 7.5}px)`; clearTimeout(hideTimeout); hideTimeout = setTimeout(() => { laser.style.opacity = "0"; }, 500); } else { laser.style.opacity = "0"; } }); } ``` -------------------------------- ### HTML Converter Configuration Source: https://github.com/jeertmans/manim-slides/blob/main/docs/source/reference/cli.md Displays the configuration options for the HTML converter. ```APIDOC ## manim-slides convert --to=html --show-config ### Description Shows the configuration options available for converting slides to HTML format. ### Method ```bash manim-slides convert --to=html --show-config ``` ### Parameters #### Query Parameters - `--to` (string) - Required - Specifies the output format, in this case, 'html'. - `--show-config` - Flag to display configuration options. ### Output Displays a list of configuration options specific to the HTML converter. ``` -------------------------------- ### Convert Slides to HTML Source: https://github.com/jeertmans/manim-slides/blob/main/docs/source/reference/html.md Use this command to convert your Manim Slides presentation into a single HTML file. Replace [SCENES] with your scene names and DEST with the desired .html file path. ```bash manim-slides convert [SCENES]... DEST ``` -------------------------------- ### Run Pytest for Code Testing with uv Source: https://github.com/jeertmans/manim-slides/blob/main/docs/source/contributing/workflow.md Execute the Pytest test suite using uv to ensure your code changes meet the project's testing requirements. ```bash uv run pytest ``` -------------------------------- ### Reveal.js Configuration Options Source: https://github.com/jeertmans/manim-slides/blob/main/docs/source/_static/firebase_sync_demo.html Configure various aspects of the Reveal.js presentation framework, including auto-play media, iframe preloading, auto-animation, auto-sliding, and transition effects. These settings control the presentation's behavior and appearance. ```javascript Reveal.initialize({ // Display the question mark key on each slide to enable the help overlay embedded: false, // Flags if we should show a help overlay when the question-mark // key is pressed help: true, // Flags if it should be possible to pause the presentation (blackout) pause: true, // Flags if speaker notes should be visible to all viewers showNotes: false, // Global override for autolaying embedded media (video/audio/iframe) // - null: Media will only autoplay if data-autoplay is present // - true: All media will autoplay, regardless of individual setting // - false: No media will autoplay, regardless of individual setting autoPlayMedia: null, // Global override for preloading lazy-loaded iframes // - null: Iframes with data-src AND data-preload will be loaded when within // the viewDistance, iframes with only data-src will be loaded when visible // - true: All iframes with data-src will be loaded when within the viewDistance // - false: All iframes with data-src will be loaded only when visible preloadIframes: null, // Can be used to globally disable auto-animation autoAnimate: true, // Optionally provide a custom element matcher that will be // used to dictate which elements we can animate between. autoAnimateMatcher: null, // Default settings for our auto-animate transitions, can be // overridden per-slide or per-element via data arguments autoAnimateEasing: 'ease', autoAnimateDuration: 1.0, autoAnimateUnmatched: true, // CSS properties that can be auto-animated. Position & scale // is matched separately so there's no need to include styles // like top/right/bottom/left, width/height or margin. autoAnimateStyles: [ 'opacity', 'color', 'background-color', 'padding', 'font-size', 'line-height', 'letter-spacing', 'border-width', 'border-color', 'border-radius', 'outline', 'outline-offset' ], // Controls automatic progression to the next slide // - 0: Auto-sliding only happens if the data-autoslide HTML attribute // is present on the current slide or fragment // - 1+: All slides will progress automatically at the given interval // - false: No auto-sliding, even if data-autoslide is present autoSlide: 0, // Stop auto-sliding after user input autoSlideStoppable: true, // Use this method for navigation when auto-sliding (defaults to navigateNext) autoSlideMethod: null, // Specify the average time in seconds that you think you will spend // presenting each slide. This is used to show a pacing timer in the // speaker view defaultTiming: null, // Enable slide navigation via mouse wheel mouseWheel: false, // Opens links in an iframe preview overlay // Add `data-preview-link` and `data-preview-link="false"` to customize each link // individually previewLinks: false, // Exposes the reveal.js API through window.postMessage postMessage: true, // Dispatches all reveal.js events to the parent window through postMessage postMessageEvents: false, // Focuses body when page changes visibility to ensure keyboard shortcuts work focusBodyOnPageVisibilityChange: true, // Transition style transition: 'none', // none/fade/slide/convex/concave/zoom // Transition speed transitionSpeed: 'default', // default/fast/slow // Transition style for full page slide backgrounds backgroundTransition: 'none', // none/fade/slide/convex/concave/zoom // The maximum number of pages a single slide can expand onto when printing // to PDF, unlimited by default pdfMaxPagesPerSlide: Number.POSITIVE_INFINITY, // Prints each fragment on a separate slide pdfSeparateFragments: true, // Offset used to reduce the height of content within exported PDF pages. // This exists to account for environment differences based on how you // print to PDF. CLI printing options, like phantomjs and wkpdf, can end // on precisely the total height of the document whereas in-browser // printing has to end one pixel before. pdfPageHeightOffset: -1, // Number of slides away from the current that are visible viewDistance: 3, // Number of slides away from the current that are visible on mobile // devices. It is advisable to set this to a lower number than // viewDistance in order to save resources. mobileViewDistance: 2, // The display mode that will be used to show slides display: 'block', // Hide cursor if inactive hideInactiveCursor: true, // Time before the cursor is hidden (in ms) hideCursorTime: 5000 }); ``` -------------------------------- ### Configure Reveal.js Options Source: https://github.com/jeertmans/manim-slides/blob/main/manim_slides/templates/revealjs.html Sets Reveal.js options, including slide transition effects and the time before the cursor is hidden. This configuration is essential for controlling the presentation's behavior and appearance. ```javascript Reveal.initialize({ // ... other options transition: 'fade', // Example transition // Time before the cursor is hidden (in ms) hideCursorTime: {{ hide_cursor_time }} }); ``` -------------------------------- ### Configure Firebase Project Variables Source: https://github.com/jeertmans/manim-slides/blob/main/docs/source/reference/sync.md Pass your Firebase project configuration variables as arguments when rendering the `firebase_sync.html` template for custom synchronization. ```bash manim-slides convert MainScene --use-template firebase_sync.html \ -c firebase_api_key=YOUR_API_KEY \ -c firebase_auth_domain=YOUR_AUTH_DOMAIN \ -c firebase_database_url=YOUR_DATABASE_URL \ -c firebase_project_id=YOUR_PROJECT_ID ```