Member-only story
Features:
canvas rendering context,draw shape
win score with if(),then can start again
CODE Github
JAVASCRIPT
reset all the variables
and the ball in the center
Then createCanvas
With the blank canvas, render stuff on it
The canvas should be with two paddles, a middle dashed line, a ball, and score display /
draw a shape with canvas onMDN
the middle dashed line build with canvas setLineDash()
begin to animate() →ball move and calculate the boundaries,then stop the game.
repeat animations smoothly with requestAnimationFrame() CSS tricks and requestAnimationFrame() MDN