elijah seed-arita @elij.dev · Oct 7

Now, we can use the context (ctx) to draw something on the screen. The parameters for fillRect are (x, y, width, height). Now our program is already doing something!

2 likes 1 replies

?

Replies

elijah seed-arita · Oct 7

We can start to make this square move around. Let's create variables for x and y and use them for the position of the square. Then we can move rendering of the square into an "update" function, and update the x and y every frame. Then we set the function to be called repeatedly to make it move.