xxxxxxxxxx
70
var msg1 = "Click me!";
var msg2 = "";
var msg3 = "";
var x, y, theta;
var pX = 350;
var pY = 350;
function setup() {
createCanvas(400, 400);
angleMode(DEGREES);
rectMode(CENTER);
textAlign(CENTER);
background(255);
}
function draw() {
noStroke();
fill(255);
rect(pX, pY, 100, 100);
fill('firebrick');
theta = mouseX + mouseY;
x = 10*16*pow(sin(theta),3);
y = -10*(13*cos(theta) - 5*cos(2*theta) - 2*cos(3*theta) - cos(4*theta));
ellipse(200+x, 180+y, 10);
if(mouseIsPressed && mouseX > 300 && mouseY > 300){
msg2 = "Love You!"
msg1 = "Click me again!"
pX = 50;
}
if(mouseIsPressed && mouseX < 100 && mouseY > 300){
msg3 = "Happy";
msg1 = "One more time!";
pX = 125;
pY = 140;
}
if(mouseIsPressed && mouseX > 75 && mouseX < 175 && mouseY > 90 && mouseY < 190){
msg1 = "💕";
msg3 = "Happy Honeymoon!!"
}
push();
translate(pX,pY);
rotate(mouseX*1.85+mouseY);
strokeWeight(1);
stroke(0);
fill('skyblue');
rect(0,0,30, 20);
rect(0,-10, 32, 8);
fill('red');
rect(0, -2, 6, 26);
fill(0);
noStroke();
textSize(10);
text(msg1, 0, -24+5*sin(frameCount*5));
pop();
textSize(20);
stroke('crimson');
fill('red')
text(msg2, 275, 140, 80, 80);
textSize(30);
stroke('yellow');
fill('orange');
text(msg3, 200, 260, 200, 200);
}