Use pointlike_data_keys for interpolation and rotation

This commit is contained in:
Grant Sanderson 2023-01-15 18:01:37 -08:00
parent d267c00761
commit 9704f063c9
2 changed files with 4 additions and 9 deletions

View file

@ -45,7 +45,8 @@ class Rotating(Animation):
self.starting_mobject.family_members_with_points(),
)
for sm1, sm2 in pairs:
sm1.data["points"][:] = sm2.data["points"]
for key in sm1.pointlike_data_keys:
sm1.data[key][:] = sm2.data[key]
self.mobject.rotate(
self.rate_func(alpha) * self.angle,
axis=self.axis,

View file

@ -1676,15 +1676,9 @@ class Mobject(object):
path_func: Callable[[np.ndarray, np.ndarray, float], np.ndarray] = straight_path
):
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(
func = path_func if key in self.pointlike_data_keys else interpolate
self.data[key] = func(
mobject1.data[key],
mobject2.data[key],
alpha