Skip to main content

Tool for live presentations using manim

Project description

Latest Release Python version PyPI - Downloads

Manim Slides

Tool for live presentations using either manim-community or manimgl. manim-slides will automatically detect the one you are using!

NOTE: This project extends the work of manim-presentation, with a lot more features!

Install

pip install manim-slides

Usage

Use the class Slide as your scenes base class:

from manim_slides import Slide

class Example(Slide):
    def construct(self):
        ...

call self.pause() when you want to pause the playback and wait for an input to continue (check the keybindings).

Wrap a series of animations between self.start_loop() and self.stop_loop() when you want to loop them (until input to continue):

from manim import *
# or: from manimlib import *
from manim_slides import Slide

class Example(Slide):
    def construct(self):
        circle = Circle(radius=3, color=BLUE)
        dot = Dot()

        self.play(GrowFromCenter(circle))
        self.pause()

        self.start_loop()
        self.play(MoveAlongPath(dot, circle), run_time=2, rate_func=linear)
        self.end_loop()

        self.play(dot.animate.move_to(ORIGIN))
        self.pause()

        self.wait()

You must end your Slide with a self.play(...) or a self.wait(..).

To start the presentation using Scene1, Scene2 and so on simply run:

manim-slides Scene1 Scene2...

Keybindings

Default keybindings to control the presentation:

Keybinding Action
Right Arrow Continue/Next Slide
Left Arrow Previous Slide
R Re-Animate Current Slide
V Reverse Current Slide
Spacebar Play/Pause
Q Quit

You can run the configuration wizard with:

manim-slides wizard

Alternatively you can specify different keybindings creating a file named .manim-slides.json with the keys: QUIT CONTINUE BACK REVERSE REWIND and PLAY_PAUSE.

A default file can be created with:

manim-slides init

NOTE: manim-slides uses cv2.waitKeyEx() to wait for keypresses, and directly registers the key code.

Run Example

Clone this repository:

git clone https://github.com/jeertmans/manim-slides.git
cd manim-slides

Install manim and manim-slides:

pip install manim manim-slides
# or
pip install manimgl manim-slides

Render the example scene:

manim -qh example.py Example
# or
manimgl --hd example.py Example

Run the presentation

manim-slides Example

Below is a small recording of me playing with the slides back and forth.

Comparison with original manim-presentation

Here are a few things that I implemented (or that I'm planning to implement) on top of the original work:

  • Allowing multiple keys to control one action (useful when you use a laser pointer)
  • More robust config files checking
  • Dependencies are installed with the package
  • Only one cli (to rule them all)
  • User can easily generate dummy config file
  • Config file path can be manually set
  • Play animation in reverse #9
  • Handle 3D scenes out of the box
  • Support for both manim and manimgl modules
  • Generate docs online
  • Fix the quality problem on Windows platforms with fullscreen flag

Contributions and license

The code is released as Free Software under the GNU/GPLv3 license. Copying, adapting and republishing it is not only consent but also encouraged.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

manim-slides-3.2.3.tar.gz (24.9 kB view details)

Uploaded Source

File details

Details for the file manim-slides-3.2.3.tar.gz.

File metadata

  • Download URL: manim-slides-3.2.3.tar.gz
  • Upload date:
  • Size: 24.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.14

File hashes

Hashes for manim-slides-3.2.3.tar.gz
Algorithm Hash digest
SHA256 fc0d1bd0fabd561fa31f03434f67381631b958337612173dece52d26b30878dd
MD5 cfbce6d916d14fadeb50e19b8e97a8ef
BLAKE2b-256 c2018c1dc0fab66f5e81703aaabcaacc0807fa68648a0ab3a40723c14c5f0c8a

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page