+ 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

21st Jan 2022, 11:26 AM
Parth
Parth - avatar
6 Answers
+ 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
21st Jan 2022, 1:11 PM
<DD>
<DD> - avatar
+ 1
Code is working fine. Do you want the rectangle to move to the right side ?
21st Jan 2022, 12:22 PM
Abhay
Abhay - avatar
+ 1
yes, i want that the rectangle move to the right side For me, nothing is showing
21st Jan 2022, 12:23 PM
Parth
Parth - avatar
+ 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.
21st Jan 2022, 12:25 PM
Abhay
Abhay - avatar
+ 1
JaScript it is giving many errors
23rd Jan 2022, 8:35 AM
Parth
Parth - avatar
0
Parth You can take to your heart what David Dolejsi said.
23rd Jan 2022, 11:06 AM
JaScript
JaScript - avatar