Skip to content

Instantly share code, notes, and snippets.

@lovemyliwu
Created November 8, 2020 06:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lovemyliwu/b305b0c661e46f3d539eeccca04941f1 to your computer and use it in GitHub Desktop.
Save lovemyliwu/b305b0c661e46f3d539eeccca04941f1 to your computer and use it in GitHub Desktop.
manim hello world
from manimlib.imports import *
class HelloWorld(Scene):
def construct(self):
hello_text = TextMobject(
"Hello World, from smite",
tex_to_color_map={
"World": YELLOW,
}
)
power_text = TextMobject(
"Power by manim",
tex_to_color_map={
"manim": RED,
}
)
formula_tex = TexMobject(
"\\sum_{k=1}^\\infty {1 \\over k^2} = {\\pi^2 \\over 6}",
)
group = VGroup(hello_text, formula_tex, power_text)
group.arrange(DOWN)
self.play(Write(hello_text))
self.wait()
self.play(Write(formula_tex))
self.wait()
self.play(Write(power_text))
self.wait()
class ChineseHello(Scene):
def construct(self):
hello_text = TextMobject(
"你好世界,来自smite",
tex_to_color_map={
"smite": YELLOW,
}
)
power_text = TextMobject(
"动画引擎 manim",
tex_to_color_map={
"manim": RED,
}
)
formula_tex = TexMobject(
"\\sum_{k=1}^\\infty {1 \\over k^2} = {\\pi^2 \\over 6}",
)
group = VGroup(hello_text, formula_tex, power_text)
group.arrange(DOWN)
self.play(Write(power_text))
self.wait()
self.play(Write(formula_tex))
self.wait()
self.play(Write(hello_text))
self.wait()
class Main(Scene):
def construct(self):
HelloWorld.construct(self)
self.clear()
ChineseHello.construct(self)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment