xxxxxxxxxx
50
let rAngle=47;
let rScale = 1;
let rScaleDir = 1;
let rColor = ["#84faee","#ffadd3"]
let whichColor = 1;
function setup() {
createCanvas(800, 800);
}
function draw() {
rAngle = rAngle +random(0,8);
// rScale = rScale+0.02*rScaleDir;
rScale = map(mouseX,0,width,0,10);
if (rScale > 2|| rScale <0.05) {
rScaleDir = rScaleDir*(-1);
whichColor = (whichColor+1)%2;
stroke(color(rColor[whichColor]))
}
background(255,20);// transform the background to translate so that the trace is reserve
push();
translate(width/2,height/2);
angleMode(DEGREES);
rotate(rAngle);
scale(rScale);
rectMode(CENTER);
strokeWeight(5);
noFill();
rect(0,0,500,500);
pop();
push();
for (let x = 0; x < width; x+= 25) {
for (let y = 0; y < height; y += 25) {
noStroke();
fill(random(1,255));
ellipse(x,y, random(0,2))
}
}
pop();
}