mirror of
https://github.com/3b1b/manim.git
synced 2025-07-28 20:43:56 +08:00
Make sure light styling is interpolated properly
This commit is contained in:
@ -17,6 +17,7 @@ from manimlib.utils.color import color_gradient
|
|||||||
from manimlib.utils.color import interpolate_color
|
from manimlib.utils.color import interpolate_color
|
||||||
from manimlib.utils.iterables import batch_by_property
|
from manimlib.utils.iterables import batch_by_property
|
||||||
from manimlib.utils.iterables import list_update
|
from manimlib.utils.iterables import list_update
|
||||||
|
from manimlib.utils.bezier import interpolate
|
||||||
from manimlib.utils.paths import straight_path
|
from manimlib.utils.paths import straight_path
|
||||||
from manimlib.utils.simple_functions import get_parameters
|
from manimlib.utils.simple_functions import get_parameters
|
||||||
from manimlib.utils.space_ops import angle_of_vector
|
from manimlib.utils.space_ops import angle_of_vector
|
||||||
@ -1120,11 +1121,17 @@ class Mobject(Container):
|
|||||||
"""
|
"""
|
||||||
self.points[:] = path_func(mobject1.points, mobject2.points, alpha)
|
self.points[:] = path_func(mobject1.points, mobject2.points, alpha)
|
||||||
self.interpolate_color(mobject1, mobject2, alpha)
|
self.interpolate_color(mobject1, mobject2, alpha)
|
||||||
|
self.interpolate_light_style(mobject1, mobject2, alpha)
|
||||||
return self
|
return self
|
||||||
|
|
||||||
def interpolate_color(self, mobject1, mobject2, alpha):
|
def interpolate_color(self, mobject1, mobject2, alpha):
|
||||||
pass # To implement in subclass
|
pass # To implement in subclass
|
||||||
|
|
||||||
|
def interpolate_light_style(self, mobject1, mobject2, alpha):
|
||||||
|
self.set_gloss(interpolate(mobject1.get_gloss(), mobject2.get_gloss(), alpha))
|
||||||
|
self.set_shadow(interpolate(mobject1.get_shadow(), mobject2.get_shadow(), alpha))
|
||||||
|
return self
|
||||||
|
|
||||||
def become_partial(self, mobject, a, b):
|
def become_partial(self, mobject, a, b):
|
||||||
"""
|
"""
|
||||||
Set points in such a way as to become only
|
Set points in such a way as to become only
|
||||||
|
Reference in New Issue
Block a user