Skip to content

Updater Function with Complex Plane #2896

Discussion options

You must be logged in to vote

Got it!

class Complex_Dots_with_Labels(Scene):
    def construct(self):
        def label_value_and_position(mobject):
            position_string = "{0:.1f}{1}{2:.1f}i".format(dot.get_center()[0],
                                                          '+-'[dot.get_center()[1] < 0],
                                                          abs(dot.get_center()[1]))
            mobject.set(submobjects = [SingleStringMathTex(position_string)])
            mobject.next_to(dot)
        
        tracker = ComplexValueTracker(2*np.exp(np.pi*1j))
        dot = Dot(color = YELLOW).add_updater(lambda x: x.move_to(tracker.points[0]))
        label = MathTex().add_updater(label_value_and_position…

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@SuperUser-Vermeylen
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by SuperUser-Vermeylen
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant