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


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

1/21/2022 11:26:35 AM


6 Answers

New Answer


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


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


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


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


JaScript it is giving many errors


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