すっっごい動く月
var rad = 60;
var xpos, ypos;
var xspeed = 2.8;
var yspeed = 2.2;
var xdirection = 1;
var ydirection = 1;
function setup() {
createCanvas(1000,
1000);
noStroke();
xpos = width / 2;
ypos = height / 2;
}
function draw() {
background(0, 0, 0);
fill(255, 255, 0);
ellipseMode(RADIUS)
xpos = xpos + xspeed * xdirection;
ypos = ypos + yspeed * ydirection;
if (xpos > width - rad || xpos < rad) {
xdirection *= -1;
}
if (ypos > height - rad || ypos < rad) {
ydirection *= -1;
}
ellipse(xpos, ypos, rad, rad);
fill(255,255,255)
ellipse(700,370,60);
fill(255,255,255)
ellipse(750,370,60);
fill(255,255,255)
ellipse(725,320,60);
fill(255,255,255)
ellipse(675,320,60);
fill(255,255,255)
ellipse(625,370,60);
}