from manim import *
import numpy as np
import sympy as sp
def head(cn, en):
    t = Text(cn, font="STLiti", font_size=27).to_edge(UP)
    s = Text(en, font="Consolas", font_size=20, color=YELLOW).next_to(t, DOWN, buff=0.10)
    return VGroup(t, s)
def foot(cn):
    return Text(cn, font="STLiti", font_size=20, color=YELLOW).to_edge(DOWN)
class TypstDemo(Scene):
    def construct(self):
        self.add(head("ManimCE v0.21.0：Typst 排版支持", "Typst / v0.21.0"))
        t1 = Typst("Hello, Typst!").scale(1.5).shift(UP * 1.0)
        t2 = Typst(r"$ a^2 + b^2 = c^2 $").scale(1.4).shift(DOWN * 1.0)
        self.play(FadeIn(t1, shift=UP * 0.3), run_time=1.8)
        self.play(FadeIn(t2, shift=UP * 0.3), run_time=1.8)
        self.play(t1.animate.set_color(YELLOW), t2.animate.set_color(BLUE), run_time=1.2)
        self.play(FadeIn(foot("0.21.0 新增 Typst 文本与公式排版，无需 LaTeX")), run_time=0.4)
        self.wait(1.0)
