def construct(self): circle = Circle(color=nq_colors["purple"]) circle.set_fill(nq_colors["purple"], opacity=0.5) square = Square(color=nq_colors["orange"]) square.flip(RIGHT) square.rotate(-3 * 2 * math.pi / 8) self.play(ShowCreation(square)) self.play(Transform(square, circle)) self.play(FadeOut(square))
def test_animationbuilder_in_group(): sqr = Square() circ = Circle() animation_group = AnimationGroup(sqr.animate.shift(DOWN).scale(2), FadeIn(circ)) assert all(isinstance(anim, Animation) for anim in animation_group.animations) succession = Succession(sqr.animate.shift(DOWN).scale(2), FadeIn(circ)) assert all(isinstance(anim, Animation) for anim in succession.animations)
def test_animationgroup_is_passing_remover_to_animations( animation_remover, animation_group_remover): scene = Scene() sqr_animation = Create(Square(), remover=animation_remover) circ_animation = Write(Circle(), remover=animation_remover) animation_group = AnimationGroup(sqr_animation, circ_animation, remover=animation_group_remover) scene.play(animation_group) scene.wait(0.1) assert sqr_animation.remover assert circ_animation.remover
def test_animationgroup_is_passing_remover_to_nested_animationgroups(): scene = Scene() sqr_animation = Create(Square()) circ_animation = Write(Circle(), remover=True) polygon_animation = Create(RegularPolygon(5)) animation_group = AnimationGroup( AnimationGroup(sqr_animation, polygon_animation), circ_animation, remover=True ) scene.play(animation_group) scene.wait(0.1) assert sqr_animation.remover assert circ_animation.remover assert polygon_animation.remover