mirror of
https://github.com/3b1b/manim.git
synced 2025-09-01 00:48:45 +00:00
Modify Mobject.interpolate
This commit is contained in:
parent
2dafcb3e63
commit
e37b667c8b
1 changed files with 11 additions and 9 deletions
|
@ -1673,19 +1673,21 @@ class Mobject(object):
|
|||
alpha: float,
|
||||
path_func: Callable[[np.ndarray, np.ndarray, float], np.ndarray] = straight_path
|
||||
):
|
||||
for key in self.data.dtype.names:
|
||||
if key in self.locked_data_keys:
|
||||
continue
|
||||
if len(self.data[key]) == 0:
|
||||
continue
|
||||
|
||||
func = path_func if key == "points" else interpolate
|
||||
|
||||
self.data[key][:] = func(
|
||||
keys = [k for k in self.data.dtype.names if k not in self.locked_data_keys]
|
||||
if 'points' in keys and path_func not in [straight_path, interpolate]:
|
||||
keys.remove('points')
|
||||
self.data['points'] = path_func(
|
||||
mobject1.data['points'],
|
||||
mobject2.data['points'],
|
||||
alpha
|
||||
)
|
||||
for key in keys:
|
||||
self.data[key] = interpolate(
|
||||
mobject1.data[key],
|
||||
mobject2.data[key],
|
||||
alpha
|
||||
)
|
||||
|
||||
for key in self.uniforms:
|
||||
self.uniforms[key] = interpolate(
|
||||
mobject1.uniforms[key],
|
||||
|
|
Loading…
Add table
Reference in a new issue