mirror of
https://github.com/3b1b/manim.git
synced 2025-09-19 04:41:56 +00:00
Changed the way Mobject updaters are checked to be dependent on time
This commit is contained in:
parent
acb5b2cfea
commit
9bb3b8f4bf
1 changed files with 6 additions and 12 deletions
|
@ -17,7 +17,7 @@ from manimlib.utils.color import interpolate_color
|
|||
from manimlib.utils.iterables import list_update
|
||||
from manimlib.utils.iterables import remove_list_redundancies
|
||||
from manimlib.utils.paths import straight_path
|
||||
from manimlib.utils.simple_functions import get_num_args
|
||||
from manimlib.utils.simple_functions import get_parameters
|
||||
from manimlib.utils.space_ops import angle_of_vector
|
||||
from manimlib.utils.space_ops import get_norm
|
||||
from manimlib.utils.space_ops import rotation_matrix
|
||||
|
@ -147,22 +147,16 @@ class Mobject(Container):
|
|||
|
||||
def update(self, dt=0):
|
||||
for updater in self.updaters:
|
||||
num_args = get_num_args(updater)
|
||||
if num_args == 1:
|
||||
updater(self)
|
||||
elif num_args == 2:
|
||||
parameters = get_parameters(updater)
|
||||
if "dt" in parameters:
|
||||
updater(self, dt)
|
||||
else:
|
||||
raise Exception(
|
||||
"Mobject updater expected 1 or 2 "
|
||||
"arguments, %d given" % num_args
|
||||
)
|
||||
updater(self)
|
||||
|
||||
def get_time_based_updaters(self):
|
||||
return [
|
||||
updater
|
||||
for updater in self.updaters
|
||||
if get_num_args(updater) == 2
|
||||
updater for updater in self.updaters
|
||||
if "dt" in get_parameters(updater)
|
||||
]
|
||||
|
||||
def get_updaters(self):
|
||||
|
|
Loading…
Add table
Reference in a new issue