The code is not correct.
You are attempting something difficult too early.
Please go back to the tutorial I mentioned above (with the Hello mouse section) and check out the examples for the mouse there.
Then go to the examples section on the website and check out the examples in the section “Motion”.
Then come back here and get more help.
Thank you!
Warmest Regards,
Chrisir
P.S.
You must be able to work with setup()
and draw()
and {…}
Can you please explain what you want to achieve in your animation?
The bars changing length or also move up and down?