xxxxxxxxxx
73
//Use mouseX to enlarge the eyes and click to see the hidden text
let img;
let eyeSize = 6;
function setup() {
createCanvas(300, 300);
img = loadImage('Tr.png');
textAlign(CENTER);
textSize(50);
textFont('Helvetica');
textStyle(BOLD);
}
function draw() {
background(220);
//parallel lines
for (l = 150; l < 300; l = l + 3){
line( l, 0, l, -200+l*1.7);
}
for (j = 0; j < 150; j = j + 3){
line(j, 0, j, 300-j*1.7);
}
//Trump
image(img,0,-5);
//text
push();
translate(width/2,height/2);
fill(180);
rotate(-11);
text('ERROR',40, 20);
pop();
//pyramid
push();
translate(-3,47);
rotate(0);
for (let i = 0; i < 200; i++) {
noFill();
circle(150, i *4, i * 4);
}
pop();
//eyes
for (r = 0; r < 50; r=r+5){
for (x = 0; x < 50; x=x+5){
noFill();
ellipse (125, 9, r);
ellipse (165, 9, x);
}
}
drawEye(125, 6);
drawEye(165, 6);
if (mouseIsPressed) {
blendMode(DIFFERENCE);
} else {
blendMode(BLEND);
}
//eyeball
function drawEye(ex, er){
fill(255);
circle(ex,9,er);
eyeSize = map(mouseX, 0, width, 0, 6);
fill(255);
ellipse(125, 9, eyeSize, eyeSize);
ellipse(165, 9, eyeSize, eyeSize);
}
}