xxxxxxxxxx
47
//called once when sketch starts
function setup() {
createCanvas(600, 400);
}
circle_color = ('rgb(249,211,32)');
//called every time we need a new frame
function draw() {
background('rgb(186,108,186)');
strokeWeight(1);
stroke('black')
fill('rgb(251,156,173)');
rect(175,100,250,200);
fill('rgba(166,166,253,0.54)');
rect(200,125,200,150);
noStroke();
fill('yellow')
circle(20,20,200)
fill(circle_color)
circle(mouseX,mouseY,200);
strokeWeight(4)
stroke('black')
point(25,65)
point(70,30)
}
function mouseClicked(){
console.log('mouse clicked at', mouseX,mouseY)
//toggle colors
if (circle_color == 'rgb(249,211,32)'){
console.log('switching to red')
circle_color = 'red'
}
if(circle_color == 'red'){
console.log('switching to purple')
circle_color = 'purple'
} else {
console.log('switching to pink')
circle_color = 'pink'
}
}