Introduced DrawBorderThenFill Animation

This commit is contained in:
Grant Sanderson 2017-01-25 16:57:05 -08:00
parent 4c7e04f02f
commit 25e99ea1bc

View file

@ -90,6 +90,7 @@ class DrawBorderThenFill(Animation):
CONFIG = { CONFIG = {
"run_time" : 2, "run_time" : 2,
"stroke_width" : 2, "stroke_width" : 2,
"stroke_color" : None,
"rate_func" : double_smooth, "rate_func" : double_smooth,
} }
def __init__(self, vmobject, **kwargs): def __init__(self, vmobject, **kwargs):
@ -100,14 +101,11 @@ class DrawBorderThenFill(Animation):
def update_submobject(self, submobject, starting_submobject, alpha): def update_submobject(self, submobject, starting_submobject, alpha):
if alpha < 0.5: if alpha < 0.5:
print 2*alpha
submobject.pointwise_become_partial( submobject.pointwise_become_partial(
starting_submobject, 0, 2*alpha starting_submobject, 0, 2*alpha
) )
submobject.set_stroke( color = self.stroke_color or starting_submobject.get_color()
starting_submobject.get_color(), submobject.set_stroke(color, width = self.stroke_width)
width = self.stroke_width
)
submobject.set_fill(opacity = 0) submobject.set_fill(opacity = 0)
else: else:
if not self.reached_halfway_point_before: if not self.reached_halfway_point_before: