xxxxxxxxxx
40
function setup() {
createCanvas(random(150, 500), random(150, 500));
}
function draw() {
let eyeballSize = width/2;
let blackEyeballSize = width/7;
let toothNum = 6;
background(0, 20); // 왜 안되지?
fill(255);
stroke(0);
strokeWeight(10);
// 눈1
push();
translate(width / 4, height / 4 * 1.5);
ellipse(0, 0, eyeballSize);
fill(0);
rotate(frameCount / 30);
ellipse(blackEyeballSize, 0, blackEyeballSize);
pop();
// 눈2
push();
translate(width / 4 * 3, height / 4 * 1.5);
ellipse(0, 0, eyeballSize);
fill(0);
rotate(frameCount / 30 * -1);
ellipse(blackEyeballSize, 0, blackEyeballSize);
pop();
// 입
triangle(width / 2, height / 4 * 3, 0, height, width, height);
for (let i = 0; i < toothNum; i++) {
line(width/toothNum*i, height / 4 * 3, width/toothNum*i, height);
}
}