mirror of
https://github.com/3b1b/manim.git
synced 2025-07-30 21:44:19 +08:00
Update TimeVaryingVectorField to match new VectorField configuration
This commit is contained in:
@ -318,13 +318,18 @@ class TimeVaryingVectorField(VectorField):
|
|||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
# Takes in an array of points and a float for time
|
# Takes in an array of points and a float for time
|
||||||
time_func,
|
time_func: Callable[[VectArray, float], VectArray],
|
||||||
|
coordinate_system: CoordinateSystem,
|
||||||
**kwargs
|
**kwargs
|
||||||
):
|
):
|
||||||
self.time = 0
|
self.time = 0
|
||||||
super().__init__(func=lambda p: time_func(p, self.time), **kwargs)
|
|
||||||
|
def func(coords):
|
||||||
|
return time_func(coords, self.time)
|
||||||
|
|
||||||
|
super().__init__(func, coordinate_system, **kwargs)
|
||||||
self.add_updater(lambda m, dt: m.increment_time(dt))
|
self.add_updater(lambda m, dt: m.increment_time(dt))
|
||||||
always(self.update_vectors)
|
self.always.update_vectors()
|
||||||
|
|
||||||
def increment_time(self, dt):
|
def increment_time(self, dt):
|
||||||
self.time += dt
|
self.time += dt
|
||||||
|
Reference in New Issue
Block a user