如何为 manim 中的扇区的角度和旋转同时变化设置动画

How to animate a simultaneous change in angle and rotation for a sector in manim

是否可以同时在同一扇区上设置旋转和大小更改动画?

我知道它可以被 Transform 欺骗以将其变成不同的扇区。但是那没有我想要的动画。 Transform先收缩再膨胀。我想让扇区在改变大小的同时旋转。

我可以得到我想要的两种效果,但不能同时得到。

我试过但未能找到 manim 的 API。我看过 readthedocs 但那不是 API 显示每个 Class.

的所有方法和变量
class Test(Scene):
    def construct(self):
        rotateGroup=VGroup(*[SmallDot()],
                           Sector(angle=45*DEGREES,
                                  start_angle=25*DEGREES,
                                  stroke_width=0,
                                  fill_color=RED),
                           Sector(angle=135*DEGREES,
                                  start_angle=185*DEGREES,
                                  stroke_width=0,
                                  fill_color=GREEN))\
                                  .shift(RIGHT,DOWN)
        # Start
        self.add(rotateGroup[1])
        self.wait()
        self.play(FadeOut(rotateGroup[1]),
                  # Ideal finishing position
                  FadeIn(rotateGroup[2]))
        self.wait()
        self.remove(rotateGroup[2])
        copy1=rotateGroup[1].copy()
        copy2=rotateGroup[2].copy()
        copy3=rotateGroup[1].copy()
        self.add(copy1)
        self.wait()

        # This has the desired rotation but lacks the size change
        self.play(Rotating(copy1,
                           axis=OUT,
                           run_time=2,
                           about_point=rotateGroup[0].get_center(),
                           radians=170*DEGREES,
                           rate_func=smooth))
        self.wait()
        self.remove(copy1)

        # This has the size change but lacks the correct rotation
        self.add(copy3)
        self.play(Transform(copy3,copy2))

提前致谢。

class Test(Scene):
    def construct(self):
        rotateGroup=VGroup(
            Sector(angle=45*DEGREES,
                    start_angle=25*DEGREES,
                    stroke_width=0,
                    fill_color=RED
            ),
            Sector(angle=135*DEGREES,
                    start_angle=185*DEGREES,
                    stroke_width=0,
                    fill_color=GREEN
                    )
        )
        red_sector, green_sector = rotateGroup
        # -----------------------------------------------
        red_sector.save_state()
        def update_sector(mob,alpha):
            mob.restore()
            angle = interpolate(45*DEGREES,135*DEGREES,alpha)
            start_angle = interpolate(25*DEGREES,185*DEGREES,alpha)
            mob.become(
                Sector(
                    angle=angle,
                    start_angle=start_angle,
                    stroke_width=0,
                    fill_color=interpolate_color(RED,GREEN,alpha)
                )
            )
        self.play(
            UpdateFromAlphaFunc(red_sector,update_sector)
        )
        self.wait()

作为任务,尝试做一个自定义动画,教程here