Up to formal definition of linearity in EoLA chapter 3

This commit is contained in:
Grant Sanderson
2016-07-22 18:45:34 -07:00
parent 46e5dbfa14
commit 17505d4d9e
8 changed files with 244 additions and 77 deletions

View File

@ -45,22 +45,22 @@ class VMobject(Mobject):
for mob in mobs:
if stroke_color is not None:
mob.stroke_rgb = color_to_rgb(stroke_color)
if stroke_width is not None:
mob.stroke_width = stroke_width
if fill_color is not None:
mob.fill_rgb = color_to_rgb(fill_color)
if stroke_width is not None:
mob.stroke_width = stroke_width
if fill_opacity is not None:
mob.fill_opacity = fill_opacity
probably_meant_to_change_opacity = reduce(op.and_, [
fill_color is not None,
fill_opacity is None,
mob.fill_opacity == 0
])
if probably_meant_to_change_opacity:
mob.fill_opacity = 1
return self
def set_fill(self, color = None, opacity = None, family = True):
probably_meant_to_change_opacity = reduce(op.and_, [
color is not None,
opacity is None,
self.fill_opacity == 0
])
if probably_meant_to_change_opacity:
opacity = 1
return self.set_style_data(
fill_color = color,
fill_opacity = opacity,
@ -75,8 +75,11 @@ class VMobject(Mobject):
)
def highlight(self, color, family = True):
self.set_fill(color = color, family = family)
self.set_stroke(color = color, family = family)
self.set_style_data(
stroke_color = color,
fill_color = color,
family = family
)
return self
# def fade(self, darkness = 0.5):
@ -203,6 +206,13 @@ class VMobject(Mobject):
self.submobjects
)
def apply_function(self, function, maintain_smoothness = True):
Mobject.apply_function(self, function)
if maintain_smoothness:
self.make_smooth()
return self
## Information about line
def component_curves(self):