This guide will help you get started with creating animations using Manim. Below are the essential commands you need to know.
My custom user snippet for starting a new scene.py
is:
gomanim or manim
Which effectively types:
from manim import *
from components.watermark import create_watermark
class Classname(Scene):
def construct(self):
self.construction()
self.animate_scene()
def construction(self):
"""
Define and position the elements of the scene.
"""
def animate_scene(self):
"""
Add elements to the scene and animate them.
"""
# Add watermark
watermark = create_watermark()
self.add(watermark)
In the terminal, I need to go to the directory of scene.py
and type:
manim scene.py [Class name]
or alternatively
python -m manim scene.py [Class name]
For Low Quality preview videos:
manim -pql scene.py [Class name]
For High Quality final videos:
manim -pqk scene.py [Class name]
To change the aspect ratio and resolution of videos add this:
from manim import *
# For vertical content
config.pixel_width = 1080
config.pixel_height = 1920
config.frame_width = 9
config.frame_height = 16
class ClassName(Scene):
def construct(self):
I can also create GIF's of different qualities with the flag:
manim --format=gif scene.py [Class name]
You can get the last frame of scene with:
manim -sqk scene.py [Class name]