from manim import * import numpy as np from numpy import array, pi, cos, sin run_time = 1 data = [[1, 2], [3, 4]] defdot(pos, **kwargs): return Dot(pos, **kwargs) classN064_01(Scene): defconstruct(self): sc = self c = Circle() self.play(*[FadeIn(_o) for _o in [BackgroundRectangle(c, color=RED)]], run_time=1.0) c = Circle() self.play(*[FadeIn(_o) for _o in [BackgroundRectangle(c, color=RED, fill_opacity=0.2)]], run_time=1.0) c = Circle() self.play(*[FadeIn(_o) for _o in [BackgroundRectangle(c, color=RED, fill_opacity=0.2, stroke_width=1, stroke_opacity=1)]], run_time=1.0) c = Circle() b = BackgroundRectangle(c, color=RED, fill_opacity=0.2).rotate(PI / 4) self.wait(0.5) self.wait(2.10)
from manim import * import numpy as np from numpy import array, pi, cos, sin run_time = 1 data = [[1, 2], [3, 4]] defdot(pos, **kwargs): return Dot(pos, **kwargs) classN064_04(Scene): defconstruct(self): sc = self t1 = Text('English') self.play(*[FadeIn(_o) for _o in [Underline(t1, color=GREEN)]], run_time=1.0) t2 = Text('中文') self.play(*[FadeIn(_o) for _o in [Underline(t2, color=BLUE)]], run_time=1.0) t3 = MathTex('a^2+b^2=c^2') self.play(*[FadeIn(_o) for _o in [Underline(t3, color=YELLOW)]], run_time=1.0) t1 = Square(side_length=1) self.play(*[FadeIn(_o) for _o in [Underline(t1, color=GREEN)]], run_time=1.0) t2 = Circle(radius=0.5) self.play(*[FadeIn(_o) for _o in [Underline(t2, color=BLUE)]], run_time=1.0) t3 = Star(outer_radius=0.6) self.play(*[FadeIn(_o) for _o in [Underline(t3, color=YELLOW)]], run_time=1.0) self.wait(0.5)
2.4. 下划线示例
下划线是最简单的一种标记,不仅仅是中英文字,它也可以加在公式和图形的下面。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
from manim import * from manim import * import numpy as np from numpy import array, pi, cos, sin classDemo(Scene): defconstruct(self): t1 = Text("English") Underline(t1, color=GREEN) t2 = Text("中文") Underline(t2, color=BLUE) t3 = Tex("a2+b2=c2") Underline(t3, color=YELLOW) t1 = Square(side_length=1) Underline(t1, color=GREEN) t2 = Circle(radius=0.5) _obj = t2 self.play(FadeIn(_obj), run_time=1.0) self.wait(3.00) self.wait(1.60)