def __init__(self, mobject, **kwargs):
     digest_config(self, kwargs)
     rect = SurroundingRectangle(mobject,
                                 **self.surrounding_rectangle_config)
     if "surrounding_rectangle_config" in kwargs:
         kwargs.pop("surrounding_rectangle_config")
     AnimationGroup.__init__(self, self.rect_to_animation(rect, **kwargs))
Exemplo n.º 2
0
    def __init__(self, pi_creature, *content, **kwargs):
        digest_config(self, kwargs)
        bubble = pi_creature.get_bubble(
            *content,
            bubble_class=self.bubble_class,
            **self.bubble_kwargs
        )
        Group(bubble, bubble.content).shift_onto_screen()

        pi_creature.generate_target()
        pi_creature.target.change_mode(self.target_mode)
        if self.look_at_arg is not None:
            pi_creature.target.look_at(self.look_at_arg)

        change_mode = MoveToTarget(pi_creature, **self.change_mode_kwargs)
        bubble_creation = self.bubble_creation_class(
            bubble, **self.bubble_creation_kwargs
        )
        content_introduction = self.content_introduction_class(
            bubble.content, **self.content_introduction_kwargs
        )
        AnimationGroup.__init__(
            self, change_mode, bubble_creation, content_introduction,
            **kwargs
        )
Exemplo n.º 3
0
    def __init__(self, point, color=YELLOW, **kwargs):
        digest_config(self, kwargs)
        lines = VGroup()
        for angle in np.arange(0, TAU, TAU / self.num_lines):
            line = Line(ORIGIN, self.line_length * RIGHT)
            line.shift((self.flash_radius - self.line_length) * RIGHT)
            line.rotate(angle, about_point=ORIGIN)
            lines.add(line)
        lines.move_to(point)
        lines.set_color(color)
        lines.set_stroke(width=3)
        line_anims = [
            ShowCreationThenDestruction(
                line, rate_func=squish_rate_func(smooth, 0, 0.5)
            )
            for line in lines
        ]
        fade_anims = [
            UpdateFromAlphaFunc(
                line, lambda m, a: m.set_stroke(
                    width=self.line_stroke_width * (1 - a)
                ),
                rate_func=squish_rate_func(smooth, 0, 0.75)
            )
            for line in lines
        ]

        AnimationGroup.__init__(
            self, *line_anims + fade_anims, **kwargs
        )
Exemplo n.º 4
0
    def __init__(self, pi_creature, *content, **kwargs):
        digest_config(self, kwargs)
        bubble = pi_creature.get_bubble(
            *content,
            bubble_class=self.bubble_class,
            **self.bubble_kwargs
        )
        Group(bubble, bubble.content).shift_onto_screen()

        pi_creature.generate_target()
        pi_creature.target.change_mode(self.target_mode)
        if self.look_at_arg is not None:
            pi_creature.target.look_at(self.look_at_arg)

        change_mode = MoveToTarget(pi_creature, **self.change_mode_kwargs)
        bubble_creation = self.bubble_creation_class(
            bubble, **self.bubble_creation_kwargs
        )
        content_introduction = self.content_introduction_class(
            bubble.content, **self.content_introduction_kwargs
        )
        AnimationGroup.__init__(
            self, change_mode, bubble_creation, content_introduction,
            **kwargs
        )
Exemplo n.º 5
0
 def __init__(self, bubble, **kwargs):
     digest_config(self, kwargs)
     create_bubble = self.bubble_animation_class(
         bubble, *self.bubble_animation_args,
         **self.bubble_animation_kwargs)
     create_content = self.content_animation_class(
         VGroup(*bubble.content), *self.content_animation_args,
         **self.content_animation_kwargs)
     AnimationGroup.__init__(self, create_bubble, create_content, **kwargs)
Exemplo n.º 6
0
 def __init__(self, mobject, **kwargs):
     assert (isinstance(mobject, Mobject))
     digest_config(self, kwargs)
     if not hasattr(mobject, "lines"):
         self.generate_lines(mobject)
     if not hasattr(mobject, "rectangle"):
         self.generate_rec(mobject)
     mobject.rectangle.save_state()
     mobject.rectangle.set_width(0, stretch=True, about_edge=LEFT)
     AnimationGroup.__init__(self, ShowCreation(mobject.lines, lag_ratio=0),
                             Restore(mobject.rectangle), **kwargs)
Exemplo n.º 7
0
 def __init__(self, mobject, **kwargs):
     assert (isinstance(mobject, Mobject))
     digest_config(self, kwargs)
     if not hasattr(mobject, "lines"):
         raise AttributeError("mobject must has lines attribute")
     if not hasattr(mobject, "rectangle"):
         raise AttributeError("mobject must has rectangle attribute")
     mobject.rectangle.generate_target()
     mobject.rectangle.target.set_width(0, stretch=True, about_edge=LEFT)
     AnimationGroup.__init__(self, Uncreate(mobject.lines, lag_ratio=0),
                             MoveToTarget(mobject.rectangle), **kwargs)
     del mobject.lines, mobject.rectangle
Exemplo n.º 8
0
 def __init__(self, vmobject, **kwargs):
     digest_config(self, kwargs)
     max_stroke_width = vmobject.get_stroke_width()
     max_time_width = kwargs.pop("time_width", self.time_width)
     AnimationGroup.__init__(
         self, *[
             VShowPassingFlash(
                 vmobject.deepcopy().set_stroke(width=stroke_width),
                 time_width=time_width,
                 **kwargs) for stroke_width, time_width in zip(
                     np.linspace(0, max_stroke_width, self.n_segments),
                     np.linspace(max_time_width, 0, self.n_segments))
         ])
Exemplo n.º 9
0
    def __init__(self, pi_creature, **kwargs):
        assert hasattr(pi_creature, "bubble")
        digest_config(self, kwargs, locals())

        pi_creature.generate_target()
        pi_creature.target.change_mode(self.target_mode)
        if self.look_at_arg is not None:
            pi_creature.target.look_at(self.look_at_arg)

        AnimationGroup.__init__(
            self,
            MoveToTarget(pi_creature),
            FadeOut(pi_creature.bubble),
            FadeOut(pi_creature.bubble.content),
        )
Exemplo n.º 10
0
 def __init__(self, vmobject, **kwargs):
     digest_config(self, kwargs)
     max_stroke_width = vmobject.get_stroke_width()
     max_time_width = kwargs.pop("time_width", self.time_width)
     AnimationGroup.__init__(self, *[
         ShowPassingFlash(
             vmobject.deepcopy().set_stroke(width=stroke_width),
             time_width=time_width,
             **kwargs
         )
         for stroke_width, time_width in zip(
             np.linspace(0, max_stroke_width, self.n_segments),
             np.linspace(max_time_width, 0, self.n_segments)
         )
     ])
Exemplo n.º 11
0
    def __init__(self, pi_creature, **kwargs):
        assert hasattr(pi_creature, "bubble")
        digest_config(self, kwargs, locals())

        pi_creature.generate_target()
        pi_creature.target.change_mode(self.target_mode)
        if self.look_at_arg is not None:
            pi_creature.target.look_at(self.look_at_arg)

        AnimationGroup.__init__(
            self,
            MoveToTarget(pi_creature),
            FadeOut(pi_creature.bubble),
            FadeOut(pi_creature.bubble.content),
        )
Exemplo n.º 12
0
 def __init__(self, vmobject, **kwargs):
     if not hasattr(self, "args"):
         self.args = serialize_args([vmobject])
     if not hasattr(self, "config"):
         self.config = serialize_config({
             **kwargs,
         })
     digest_config(self, kwargs)
     max_stroke_width = vmobject.get_stroke_width()
     max_time_width = kwargs.pop("time_width", self.time_width)
     AnimationGroup.__init__(
         self, *[
             ShowPassingFlash(
                 vmobject.deepcopy().set_stroke(width=stroke_width),
                 time_width=time_width,
                 **kwargs) for stroke_width, time_width in zip(
                     np.linspace(0, max_stroke_width, self.n_segments),
                     np.linspace(max_time_width, 0, self.n_segments))
         ])
Exemplo n.º 13
0
 def __init__(self, mob, rec, **kwargs):
     AnimationGroup.__init__(self,
                             PassingRectangle(mob, **kwargs),
                             LaggedCreation(rec, **kwargs),
                             lag_ratio=0.1,
                             run_time=1.5)