mirror of
https://github.com/3b1b/manim.git
synced 2025-09-19 04:41:56 +00:00
Use pointlike_data_keys for interpolation and rotation
This commit is contained in:
parent
d267c00761
commit
9704f063c9
2 changed files with 4 additions and 9 deletions
|
@ -45,7 +45,8 @@ class Rotating(Animation):
|
||||||
self.starting_mobject.family_members_with_points(),
|
self.starting_mobject.family_members_with_points(),
|
||||||
)
|
)
|
||||||
for sm1, sm2 in pairs:
|
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.mobject.rotate(
|
||||||
self.rate_func(alpha) * self.angle,
|
self.rate_func(alpha) * self.angle,
|
||||||
axis=self.axis,
|
axis=self.axis,
|
||||||
|
|
|
@ -1676,15 +1676,9 @@ class Mobject(object):
|
||||||
path_func: Callable[[np.ndarray, np.ndarray, float], np.ndarray] = straight_path
|
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]
|
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:
|
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],
|
mobject1.data[key],
|
||||||
mobject2.data[key],
|
mobject2.data[key],
|
||||||
alpha
|
alpha
|
||||||
|
|
Loading…
Add table
Reference in a new issue