xxxxxxxxxx
54
//unfinished
let scaleXY = 1;
let colours;
let currColour = 0;
let strołkŁejt = 2;
function setup(){
createCanvas(400, 400);
background(255);
colours = [
color(255,0,0),
color(0,255,0),
color(0,0,255)
];
}
function draw(){
if (mouseIsPressed && scaleXY<=5){
scaleXY+=0.01;
} else if (!mouseIsPressed && scaleXY>1){
scaleXY-=0.01;
}
scale(scaleXY,scaleXY);
background(255);
drawCircle(width/2,height/2,200);
}
function drawCircle(x,y,r){
if (currColour>2){
currColour = 0;
} else{
currColour++;
}
switch (currColour){
case 1: stroke(colours[0]);
break;
case 2: stroke(colours[1]);
break;
case 3: stroke(colours[2]);
break;
}
strokeWeight(strołkŁejt);
ellipse(x, y, r, r);
if(r > 8) {
strokeWeight(strołkŁejt/2);
drawCircle(x + r/2, y, r/2);
drawCircle(x - r/2, y, r/2);
strokeWeight(strołkŁejt/4);
drawCircle(x, y + r/2, r/2);
drawCircle(x, y - r/2, r/2);
}
}