mirror of
https://github.com/3b1b/manim.git
synced 2025-08-01 17:29:06 +08:00
Modify Mobject.interpolate
This commit is contained in:
@ -1673,19 +1673,21 @@ class Mobject(object):
|
|||||||
alpha: float,
|
alpha: float,
|
||||||
path_func: Callable[[np.ndarray, np.ndarray, float], np.ndarray] = straight_path
|
path_func: Callable[[np.ndarray, np.ndarray, float], np.ndarray] = straight_path
|
||||||
):
|
):
|
||||||
for key in self.data.dtype.names:
|
keys = [k for k in self.data.dtype.names if k not in self.locked_data_keys]
|
||||||
if key in self.locked_data_keys:
|
if 'points' in keys and path_func not in [straight_path, interpolate]:
|
||||||
continue
|
keys.remove('points')
|
||||||
if len(self.data[key]) == 0:
|
self.data['points'] = path_func(
|
||||||
continue
|
mobject1.data['points'],
|
||||||
|
mobject2.data['points'],
|
||||||
func = path_func if key == "points" else interpolate
|
alpha
|
||||||
|
)
|
||||||
self.data[key][:] = func(
|
for key in keys:
|
||||||
|
self.data[key] = interpolate(
|
||||||
mobject1.data[key],
|
mobject1.data[key],
|
||||||
mobject2.data[key],
|
mobject2.data[key],
|
||||||
alpha
|
alpha
|
||||||
)
|
)
|
||||||
|
|
||||||
for key in self.uniforms:
|
for key in self.uniforms:
|
||||||
self.uniforms[key] = interpolate(
|
self.uniforms[key] = interpolate(
|
||||||
mobject1.uniforms[key],
|
mobject1.uniforms[key],
|
||||||
|
Reference in New Issue
Block a user