from manim import *
class QualityResolutionDemo(Scene):
    """-q 五档画质与 -r / --fps 自定义分辨率"""
    def construct(self):
        title = Text("-q 画质档位与 -r 自定义分辨率", font_size=34).to_edge(UP, buff=0.5)
        self.play(Write(title))
        presets = [
            ("-ql", "854x480", "15 fps", 1.0),
            ("-qm", "1280x720", "30 fps", 1.35),
            ("-qh", "1920x1080", "60 fps", 1.75),
        ]
        group = VGroup()
        for flag, res, fps, scale in presets:
            frame = Rectangle(width=2.5 * scale, height=1.4 * scale,
                              stroke_color=BLUE, stroke_width=3)
            flag_t = Text(flag, font_size=22).next_to(frame, LEFT, buff=0.22)
            info = VGroup(Text(res, font_size=20), Text(fps, font_size=17, color=GREY_B))
            info.arrange(DOWN, buff=0.1).move_to(frame.get_center())
            group.add(VGroup(flag_t, frame, info))
        group.arrange(RIGHT, buff=0.5, aligned_edge=DOWN).shift(DOWN * 0.45)
        self.play(LaggedStart(*[FadeIn(g, shift=UP * 0.25) for g in group], lag_ratio=0.25))
        note = Text("-r 1920,1080 与 --fps 24 可自由组合", font_size=26, color=YELLOW)
        note.next_to(group, DOWN, buff=0.55)
        self.play(FadeIn(note, shift=UP * 0.2))
        self.wait(1.2)
        self.wait(1.40)