galatolofederico / manim-presentation

Tool for live presentations using manim
GNU General Public License v3.0
162 stars 18 forks source link

Can I control the slide presentation by tweaking the json file? #1

Closed emonhossainraihan closed 3 years ago

emonhossainraihan commented 3 years ago

Description

I was working with several versions of manim like manim community version (v0.5.0) and 3b1b version. Now, as they create their own partials_movie_files. I want to merge them all and control the presentation.

For this I want to know how to tweak the .json file generated inside the presentation directory. Like according the docs if I create manim presentation from example.py it creates,

{
  "slides": [
    { "type": "slide", "start_animation": 0, "end_animation": 1, "number": 1 },
    { "type": "loop", "start_animation": 1, "end_animation": 2, "number": 2 },
    { "type": "slide", "start_animation": 2, "end_animation": 3, "number": 3 }
  ],
  "files": [
    "./presentation/files/Example/450974505_3492167877_2166804963.mp4",
    "./presentation/files/Example/2788726626_291667631_3144554360.mp4",
    "./presentation/files/Example/2788726626_2464099577_429927831.mp4",
    "./presentation/files/Example/2788726626_1438405273_1585276179.mp4"
  ]
}

I want to know what those parameter means start_animation, end_animation and number.

Expected behavior

I was thinking start_animation and end_animation are the index of partials_movie_files from the values of the files key, is it?

Suppose I paced some partials_movie_files inside presentation/files/Example directory, then I tweak the .json:

{
  "slides": [
    { "type": "slide", "start_animation": 0, "end_animation": 1, "number": 1 },
    { "type": "loop", "start_animation": 1, "end_animation": 2, "number": 2 },
    { "type": "slide", "start_animation": 2, "end_animation": 3, "number": 3 },
    { "type": "loop", "start_animation": 3, "end_animation": 4, "number": 4 },
    { "type": "slide", "start_animation": 4, "end_animation": 5, "number": 5 }
  ],
  "files": [
    "./presentation/files/Example/450974505_3492167877_2166804963.mp4",
    "./presentation/files/Example/2788726626_291667631_3144554360.mp4",
    "./presentation/files/Example/2788726626_2464099577_429927831.mp4",
    "./presentation/files/Example/2788726626_1438405273_1585276179.mp4",
    "./presentation/files/Example/new_video_01.mp4",
    "./presentation/files/Example/new_video_02.mp4",
  ]
}

But it wasn't showing the desire slide-presentation.

galatolofederico commented 3 years ago

Hi, yeah your guess is right. type can be either slide or loop. slide means stop at end_animation and wait for input to continue and loop means when you reach end_animation loop back to start_animation and the numbers of start_animation and end_animation are the indices of files. Your hack should be working fine are you getting any errors? You can pass to manim_presentation multiple scenes maybe you can try rendering the two scenes separately and the call manim_presentation SceneCE Scene3B1B. I've never tried manim_presentation with the 3b1b version so maybe there is something weird going on too