Created
November 8, 2020 06:14
-
-
Save lovemyliwu/b305b0c661e46f3d539eeccca04941f1 to your computer and use it in GitHub Desktop.
manim hello world
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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