Tool for live presentations using manim

Overview

manim-presentation

Tool for live presentations using manim

Install

pip install manim-presentation opencv-python

Usage

Use the class Slide as your scenes base class

from manim_presentation 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 *
from manim_presentation 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()

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

manim_presentation Scene1 Scene2...

Default Keybindings

Default keybindings to control the presentation

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

Run Example

Clone this repository

git clone https://github.com/galatolofederico/manim-presentation.git
cd manim-presentation

Create a virtualenv

virtualenv --python=python3.7 env
. ./env/bin/activate

Install manim and manim_presentation

pip install manim manim-presentation opencv-python

Render the example scene

manim -qh example.py

Run the presentation

manim_presentation Example

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.

For any further question feel free to reach me at [email protected] or on Telegram @galatolo

Comments
  • Can't run multiple scenes behind each other

    Can't run multiple scenes behind each other

    Hi, another issue: I can't run multiple scenes behind each other. When I do manim_presentation Scene1 Scene2, manim-presentation crashes with:

        return self.caps[self.current_animation]
    IndexError: list index out of range
    

    I will look at the code and see if I can fix it.

    bug 
    opened by glatteis 18
  • I cant create my first presentation even though I followed the instructions provided.

    I cant create my first presentation even though I followed the instructions provided.

    I am trying to render my first presentation but I am getting an error that says no config file found. it asks me to use Slide as base class for scene which i am doing as is evident in the following code: P.S i am using manimCE v0.6.0

    from manim import *
    from mytextemplate import *
    from manim_presentation import Slide
    
    
    
    class Testing(Slide):
        def construct(self):
            introduction = MyTexTemplate("Introduction",tex_type = "tex",font = "Alegreya-Regular")
            self.add(introduction)
            self.wait(1)
            self.pause()
    

    The introduction variable is created and uses a custom module that I modified to suit my needs. Following is the error code after the using manim_presentation Testing File "C:\Users\khans\AppData\Local\Programs\Python\Python39\Scripts\manim_presentation-script.py", line 33, in sys.exit(load_entry_point('manim-presentation==0.1.3', 'console_scripts', 'manim_presentation')()) File "c:\users\khans\appdata\local\programs\python\python39\lib\site-packages\manim_presentation\present.py", line 238, in main raise Exception(f"File {config_file} does not exist, check the scene name and make sure to use Slide as your scene base class") Exception: File ./presentation\Testing.json does not exist, check the scene name and make sure to use Slide as your scene base class

    opened by Ammar34 8
  • Fullscreen not really fullscreen

    Fullscreen not really fullscreen

    And another one: One fullscreen, there's still a small border around the window. This causes weird aliasing effects. Will see if I can fix this as well.

    bug 
    opened by glatteis 7
  • Unable to use arrow keys

    Unable to use arrow keys

    I followed all the instructions on the readme, and everything seems to be working fine, all keybinds are okay, space, R, Q, all of them except the arrow keys. Is this a problem of the module or is this unrelated at all? Additional Info: I'm using Windows 10 64x

    opened by icedcoffeeee 6
  • Windows fullscreen fix

    Windows fullscreen fix

    This proposes a small fix to the problem where full-screen resolution is bad. Apparently, this only occurs in Windows platforms. Tested on Windows 10 & Ubuntu 22.04. The solution is mostly a copy / paste from here.

    Even though, the fix is not a perfect fix and quality is still not as good as with Ubuntu. For instance, I had to render in p or even k quality on Windows to have a result similar to h quality on Ubuntu.

    As mentioned in #15, I am working on a separate fork on which I did other improvements, and many more improvements are still ongoing. Maybe we could merge both works later, or I can keep me work separate as it implies some major changes in the codebase. Anyway, this is not the point of this PR :-)

    Closes #15.

    opened by jeertmans 3
  • Memory Leak

    Memory Leak

    Hi, I'm pretty sure that manim_presentation has a "memory leak" with regards to cv2. It doesn't unload the non-playing videos? I definitely keeps them in RAM. So it's not really a leak, but if your presentation is in sum bigger than your RAM, you have a problem.

    opened by glatteis 3
  • Arrow keys not responding - MacBook Pro, German keyboard

    Arrow keys not responding - MacBook Pro, German keyboard

    When starting a presentation, the arrow keys on my MacBook Pro - Catalina 10.15.6 - 2019 - German Keyboard - are not responding. Spacebar, q and r are working just fine.

    I have no idea how to figure out what code my arrow keys have, hence the issue here.

    opened by PhotonSpheres 2
  • Often occuring

    Often occuring "Index out of range" error

    Hi, thanks for the cool project! it often occurs that manim_presentation crashes with index out of bounds. For instance, consider this code (sorry it's not so minimal...)

    It should stay on the slide with the second graph, but it just skips to the end and then crashes with "index out of bounds".

    from manim import *
    from manim_presentation import Slide 
    red_edge = {
        "stroke_color": RED,
        "buff": 0
    }
    blue_edge = {
        "stroke_color": BLUE,
        "buff": 0
    }
    invisible_vertex = {
        "fill_opacity": 0
    }
    visible_vertex = {
        "fill_color": GREY
    }
    
    class ConstraintGraphScene(Slide):
        def construct(self):
            self.construct_vertices()
            self.clear()
            self.construct_latch()
            self.clear()
            self.play(Create(Text("")))
            self.pause()
            self.wait()
    
        def construct_latch(self):
            edge_config = {
                (2,1): blue_edge,
                (2,3): blue_edge,
                (4,2): blue_edge,
                (3,4): red_edge,
                (3,5): red_edge,
                (6,4): red_edge
            }
            vertex_config = {}
            for i in [1, 5, 6]:
                vertex_config[i] = invisible_vertex
            for i in [2, 3, 4]:
                vertex_config[i] = visible_vertex
            graph = Graph(vertex_config.keys(), edge_config.keys(), vertex_config=vertex_config, edge_config=edge_config, edge_type=Arrow)
            
            graph[1].move_to([-2,0,0])
            graph[2].move_to([-1,0,0])
            graph[3].move_to([0,1,0])
            graph[4].move_to([0,-1,0])
            graph[5].move_to([2,1,0])
            graph[6].move_to([2,-1,0])
    
            # graph.scale(1)
    
            self.play(Create(graph))
            self.play(Create(Text("Out A", color=BLACK).next_to(graph[6], RIGHT)))
            self.play(Create(Text("Out B", color=BLACK).next_to(graph[5], RIGHT)))
            self.play(Create(Text("Lock", color=BLACK).next_to(graph[1], LEFT)))
            self.pause()
    
    
        def construct_vertices(self):
            vertices = [1, 2, 3, 4]
            edges = [(1,3), (2,3), (3,4)]
            edge_config_and = {
                (1,3): red_edge,
                (2,3): red_edge,
                (3,4): blue_edge
            }
            edge_config_or = {
                (1,3): blue_edge,
                (2,3): blue_edge,
                (3,4): blue_edge
            }
            vertex_config = {
                1: invisible_vertex, 
                2: invisible_vertex,
                3: visible_vertex,
                4: invisible_vertex
            }
            graph_and_vertex = Graph(vertices, edges, edge_config=edge_config_and, vertex_config=vertex_config, edge_type=Arrow)
            graph_or_vertex = Graph(vertices, edges, edge_config=edge_config_or, vertex_config=vertex_config, edge_type=Arrow)
            graph_and_vertex.move_to(LEFT*2)
            graph_or_vertex.next_to(graph_and_vertex, RIGHT)
            graph_and_vertex.default_edge_config = blue_edge
            graph_or_vertex.default_edge_config = blue_edge
    
            and_vertex_text = Text("And", color=BLACK)
            and_vertex_text.next_to(graph_and_vertex, DOWN)
            or_vertex_text = Text("Or", color=BLACK)
            or_vertex_text.next_to(graph_or_vertex, DOWN)
    
            self.play(Create(graph_and_vertex))
            self.play(Create(graph_or_vertex))
            self.play(Create(and_vertex_text))
            self.play(Create(or_vertex_text))
    
            self.pause()
    
            self.start_loop()
            self.play(graph_and_vertex.animate.remove_edges((3,4)),
            graph_and_vertex.animate.add_edges((4,3), edge_type=Arrow))
            self.play(graph_and_vertex.animate.remove_edges((4,3)),
            graph_and_vertex.animate.add_edges((3,4), edge_type=Arrow))
            # self.play(graph.animate.add_edges((3,4)), edge_config=edge_config)
            self.end_loop()
            self.pause()
            self.wait()
    
    
    

    I compiled the project with:

    manim -ql constraint_graph_scene.py ConstraintGraphScene
    manim_presentation ConstraintGraphScene
    
    opened by glatteis 2
  • Endorse manim-slides as continuing development on manim-presentation

    Endorse manim-slides as continuing development on manim-presentation

    I think manim-slides is a project that greatly improves on the POC work here in manim-presentation. We should link people to that project as it's just better than this now!

    opened by glatteis 1
  • Animations between loops don't show without pauses

    Animations between loops don't show without pauses

    Take for example the following, where I commented out self.pause() between the two loops:

    from manim import *
    from manim_presentation 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.play(dot.animate.move_to(RIGHT*3))
            #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))
    

    When I run through the presentation, it skips past the animation of the dot moving to and from the origin and continues to the next loop. The video files for these animations are still in \manim-presentation\presentation\files but the presentation skips from Animation: 1 to Animation: 4.

    bug 
    opened by jacquesrabie 1
  • Fix memory problems

    Fix memory problems

    This only keeps the currently played video in memory. Load times seem to be neglegible, so preloading the next video does not seem to be necessary. This took my presentation from using 8GB of RAM to a few MB.

    opened by glatteis 1
  • Bad quality of presentation with --fullscreen flag

    Bad quality of presentation with --fullscreen flag

    image I did a comparison about the quality of manim presentation with the --fullscreen flag. In the first picture, I rendererd a manim scene with manim -qh example.py and then ran it with manim_presentation --fullscreen example. As we can see in the 1st picture, the quality is not so high (it's bad as low-quality rendering).

    Then, I tried running without --fullscreen, the quality of the scene turn back to high quality (but lost the ability to be fullscreen). Seems like when doing the full-screen, the presentation has been scaled down to fit the screen, and cause this bad quality. image

    Is there any way to fix this?

    bug 
    opened by torannn 5
Owner
Federico Galatolo
PhD Student @ University of Pisa
Federico Galatolo
Seeing if I can put together an interactive version of 3b1b's Manim in Streamlit

streamlit-manim Seeing if I can put together an interactive version of 3b1b's Manim in Streamlit Installation I had to install pango with sudo apt-get

Adrien Treuille 6 Aug 3, 2022
ManimML is a project focused on providing animations and visualizations of common machine learning concepts with the Manim Community Library.

ManimML ManimML is a project focused on providing animations and visualizations of common machine learning concepts with the Manim Community Library.

null 259 Jan 4, 2023
my graduation project is about live human face augmentation by projection mapping by using CNN

Live-human-face-expression-augmentation-by-projection my graduation project is about live human face augmentation by projection mapping by using CNN o

null 1 Mar 8, 2022
Live Hand Tracking Using Python

Live-Hand-Tracking-Using-Python Project Description: In this project, we will be

Hassan Shahzad 2 Jan 6, 2022
DL & CV-based indicator toolset for the vehicle drivers via live dash-cam footage.

Vehicle Indicator Toolset Deep Learning and Computer Vision based indicator toolset for vehicle drivers using live dash-cam footages. Tracking of vehi

Alex Xu 12 Dec 28, 2021
Python implementation of a live deep learning based age/gender/expression recognizer

TUT live age estimator Python implementation of a live deep learning based age/gender/smile/celebrity twin recognizer. All components use convolutiona

Heikki Huttunen 80 Nov 21, 2022
LIVECell - A large-scale dataset for label-free live cell segmentation

LIVECell dataset This document contains instructions of how to access the data associated with the submitted manuscript "LIVECell - A large-scale data

Sartorius Corporate Research 112 Jan 7, 2023
This program was designed to detect whether someone is wearing a facemask through a live video stream.

This program was designed to detect whether someone is wearing a facemask through a live video stream. A custom lightweight CNN trained with TensorFlow on a public dataset provided by Kaggle is used to detect whether each face detected by the cv2 face detection dnn is wearing a mask

null 0 Apr 2, 2022
Measures input lag without dedicated hardware, performing motion detection on recorded or live video

What is InputLagTimer? This tool can measure input lag by analyzing a video where both the game controller and the game screen can be seen on a webcam

Bruno Gonzalez 4 Aug 18, 2022
Fuzzing tool (TFuzz): a fuzzing tool based on program transformation

T-Fuzz T-Fuzz consists of 2 components: Fuzzing tool (TFuzz): a fuzzing tool based on program transformation Crash Analyzer (CrashAnalyzer): a tool th

HexHive 244 Nov 9, 2022
Raptor-Multi-Tool - Raptor Multi Tool With Python

Promises ?? 20 Stars and I'll fix every error that there is 50 Stars and we will

Aran 44 Jan 4, 2023
Torchlight2 lan game server tool - A message forwarding tool for Torchlight 2 lan game

Torchlight 2 Lan Game Server Tool A message forwarding tool for Torchlight 2 lan

Huaijun Jiang 3 Nov 1, 2022
Simple tool to combine(merge) onnx models. Simple Network Combine Tool for ONNX.

snc4onnx Simple tool to combine(merge) onnx models. Simple Network Combine Tool for ONNX. https://github.com/PINTO0309/simple-onnx-processing-tools 1.

Katsuya Hyodo 8 Oct 13, 2022
A Python Automated Machine Learning tool that optimizes machine learning pipelines using genetic programming.

Master status: Development status: Package information: TPOT stands for Tree-based Pipeline Optimization Tool. Consider TPOT your Data Science Assista

Epistasis Lab at UPenn 8.9k Dec 30, 2022
Simple command line tool for text to image generation using OpenAI's CLIP and Siren (Implicit neural representation network)

Deep Daze mist over green hills shattered plates on the grass cosmic love and attention a time traveler in the crowd life during the plague meditative

Phil Wang 4.4k Jan 3, 2023
A simple command line tool for text to image generation, using OpenAI's CLIP and a BigGAN.

Ryan Murdock has done it again, combining OpenAI's CLIP and the generator from a BigGAN! This repository wraps up his work so it is easily accessible to anyone who owns a GPU.

Phil Wang 2.3k Jan 9, 2023
OpenCVのGrabCut()を利用したセマンティックセグメンテーション向けアノテーションツール(Annotation tool using GrabCut() of OpenCV. It can be used to create datasets for semantic segmentation.)

[Japanese/English] GrabCut-Annotation-Tool GrabCut-Annotation-Tool.mp4 OpenCVのGrabCut()を利用したアノテーションツールです。 セマンティックセグメンテーション向けのデータセット作成にご使用いただけます。 ※Grab

KazuhitoTakahashi 30 Nov 18, 2022