ComplexValueTracker¶
Qualified name: manim.mobject.value\_tracker.ComplexValueTracker
- class ComplexValueTracker(value=0, **kwargs)[source]¶
Bases:
ValueTrackerTracks a complex-valued parameter.
The value is internally stored as a points array [a, b, 0]. This can be accessed directly to represent the value geometrically, see the usage example. When the value is set through
animate, the value will take a straight path from the source point to the destination point.Examples
Example: ComplexValueTrackerExample ¶
from manim import * class ComplexValueTrackerExample(Scene): def construct(self): tracker = ComplexValueTracker(-2+1j) dot = Dot().add_updater( lambda x: x.move_to(tracker.points) ) self.add(NumberPlane(), dot) self.play(tracker.animate.set_value(3+2j)) self.play(tracker.animate.set_value(tracker.get_value() * 1j)) self.play(tracker.animate.set_value(tracker.get_value() - 2j)) self.play(tracker.animate.set_value(tracker.get_value() / (-2 + 3j)))
class ComplexValueTrackerExample(Scene): def construct(self): tracker = ComplexValueTracker(-2+1j) dot = Dot().add_updater( lambda x: x.move_to(tracker.points) ) self.add(NumberPlane(), dot) self.play(tracker.animate.set_value(3+2j)) self.play(tracker.animate.set_value(tracker.get_value() * 1j)) self.play(tracker.animate.set_value(tracker.get_value() - 2j)) self.play(tracker.animate.set_value(tracker.get_value() / (-2 + 3j)))Methods
Get the current value of this ComplexValueTracker as a complex number.
Sets a new complex value to the ComplexValueTracker.
Attributes
alwaysCall a method on a mobject every frame.
animateUsed to animate the application of any method of
self.animation_overridesdepthThe depth of the mobject.
heightThe height of the mobject.
widthThe width of the mobject.
- Parameters:
value (float)
kwargs (Any)
- _original__init__(value=0, **kwargs)¶
Initialize self. See help(type(self)) for accurate signature.
- Parameters:
value (float)
kwargs (Any)
- Return type:
None