0
Can someone explain to me why the setInterval can not take the function that draws the rectangle as argument?
7 Respostas
+ 3
Make your life easier:
1. Split web code in the specific files (tabs in Code Playground): HTML, CSS and JS. Mixing them all always gets quite messy and hard to debug.
2. Use proper indentation. It's meant exactly to make code more readable (and work, in Python).
+ 2
Patrick agbenyo paul Yes. It's supposed to be an answer, and also to keep your soul healthier. Trust that: easier to read is easier to debug and fix.
That said, what makes you think setInterval can't take your function? I ran it without issues.
But it always draws the same thing in the same place. If you expect the circle to move, you have to erase the previous one and redraw somewhere else.
0
Thks buh it a small code and I need answers cuz d problem it's eating up my soul
0
Thks pls how do I do that
0
Patrick agbenyo paul To erase, just redraw with the background color. To draw in arbitrary places, add position parameters in the draw function.
0
Patrick agbenyo paul Before anything, follow my first hints on tabs and indentaion. It's an easy job, and will make the real hard ones easier.
0
Yeah thks I will get beta and beta day by day