
I understand that the x parameter inside moveBall() can only be used within that function, so I can’t use it in drawball() to draw the ball. How can I make moveBall() and drawBall() share the same x position so the ball moves correctly?

How can I make a new ripple appear at the mouse position each time I click, while keeping the previous ripples on the screen and letting them continue to expand?
can do with array?数组 a
var ripple = {
x: 0,
y: 100,
diameter: 50
};
function 和 class 的区别function = 做一件事
class = 定义一种东西
function drawBall(x, y) {
circle(x, y, 50);
}
这个 function 的作用是:
在指定位置画一个球。
但如果你希望每一个球都有自己的: