Don't use 'become' for interpolate at alpha = 0 or 1

This commit is contained in:
Grant Sanderson 2023-01-26 16:43:40 -08:00
parent a8da171adb
commit 8ef71bb930
2 changed files with 6 additions and 4 deletions

View file

@ -121,10 +121,6 @@ class Transform(Animation):
target_copy: Mobject, target_copy: Mobject,
alpha: float alpha: float
): ):
if alpha == 0:
submob.become(start)
elif alpha == 1:
submob.become(target_copy)
submob.interpolate(start, target_copy, alpha, self.path_func) submob.interpolate(start, target_copy, alpha, self.path_func)
return self return self

View file

@ -1719,6 +1719,12 @@ class Mobject(object):
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 keys: if keys:
self.note_changed_data() self.note_changed_data()
if alpha == 0:
self.data[:] = mobject1.data[:]
keys = []
elif alpha == 1:
self.data[:] = mobject2.data[:]
keys = []
for key in keys: for key in keys:
func = path_func if key in self.pointlike_data_keys else interpolate func = path_func if key in self.pointlike_data_keys else interpolate
md1 = mobject1.data[key] md1 = mobject1.data[key]