Canvas rect not showing | Sololearn: Learn to code for FREE!

+4

Canvas rect not showing

See this code, why the rectangle isn't showing? If you remove the while loop from the JS tab, it appears, but when I try to increase it's coordinate, it doesn't show, why? Please help me https://code.sololearn.com/WRVH7Rkv2134/?ref=app

1/21/2022 11:26:35 AM

Parth

6 Answers

New Answer

+3

Firstly I recommend to not use jquery, the library might be good for making websites but it is only confusing when it comes to canvas and kind of stuff codes Secondly your code is total nonsense, do you know how variables in JavaScript works? If not you should learn JavaScript first

+1

Code is working fine. Do you want the rectangle to move to the right side ?

+1

yes, i want that the rectangle move to the right side For me, nothing is showing

+1

Parth why should it increase ? You might want to go through your code again if you think rectangle's x co+ordinate will increase.

+1

JaScript it is giving many errors

0

Parth You can take to your heart what David Dolejsi said.