from manim import *
class ZoomDemo(ZoomedScene):
    def __init__(self):
        super().__init__(zoom_factor=0.3, zoomed_display_height=2, zoomed_display_width=4)
    def construct(self):
        title = Text("ZoomedScene：局部放大镜头", font="STLiti", font_size=30).to_edge(UP)
        self.add(title)
        dots = VGroup(*[Dot(radius=0.09, color=BLUE) for _ in range(12)])
        dots.arrange_in_grid(rows=3, cols=4, buff=0.8).shift(LEFT * 1.5)
        self.add(dots)
        frame = self.zoomed_camera.frame
        frame.move_to(dots[0])
        frame.set_color(YELLOW)
        self.play(Create(frame), run_time=1.0)
        self.activate_zooming()
        self.play(self.get_zoomed_display_pop_out_animation(), run_time=1.4)
        self.play(frame.animate.move_to(dots[7]), run_time=2.0)
        self.wait(1.6)
