xxxxxxxxxx
48
function setup() {
createCanvas(400, 400);
}
function draw() {
background(220);
}
function setup() {
createCanvas(400, 400);
}
function draw() {
background(50);
//drawStar(mouseX,mouseY);
// drawStar(200,200);
// drawStar(300,200);
// change background colors depending on location of mouse
if (mouseX > width / 2 || mouseY > height/2) {
background(100);
} else {
background(255);
}
fill("yellow");
drawStar(mouseX, mouseY, 0.01, 1.5);
fill("pink");
drawStar(mouseX, mouseY, -0.02, 1.0);
fill("cyan");
drawStar(mouseX, mouseY, 0.03, 1.2);
}
// 2. Function to draw rotating star
function drawStar(x, y, spd, scl) {
push();
translate(x, y);
rotate(frameCount * spd); // rotates below stuff
scale(scl);
noStroke();
ellipse(0, 0, 100, 40);
ellipse(0, 0, 40, 100);
pop();
}