xxxxxxxxxx
67
//需要movement, 还有random用在属性里
let a,b,c,d,e,f;
let i;
let fs;
let directionA=2;
let directionB=2;
function setup() {
createCanvas(400, 400);
background(0)
}
function draw() {
// background(0)
a=random(0,width)
b=random(0,height)
c=width/2
d=height/2
e=random(0,width)
f=random(0,height)
fill(a,b,d,255)
stroke(a,b,d,a)
strokeWeight(3)
for (let i = 0; i < 15; i = i + 5) {ellipse (a+i,b+i,5);
}
a=a+directionA;b=b+directionA
for (let i = 0; i < 15; i = i + 5) {line (c,d,e,f)
}
}
// full screen
function mousePressed() {
if (mouseX < 100 && mouseY < 100) {
fs=fullscreen}
fullscreen(fs);}
function windowResized() {
resizeCanvas(windowWidth, windowHeight);
}