drawing with javascript ['p5js'] Chao Winking
I made my own cute little chao wink!
Try pressing a key to make it wink!
All about Chao Winking
Chao winking was the second time I made my chao move.
It was so cute that when you touched the key it will wink!
How I made it
I made a bunch of different sized rectangles, like square-like ones and narrow ones.
Then I filled it in with its exact colour.
let winking = false
function setup() {
createCanvas(200, 200).parent("container");
frameRate(4);
}
function draw() {
background(200, 200, 200);
fill(132, 248, 243);
rect(10, 50, 60, 60); // head
rect(30, 110, 20, 30); // body
fill(246, 247, 2);
rect(20, 120, 10, 10); // left hand
rect(50, 120, 10, 10); // right hand
rect(20, 140, 10, 10); // left foot
rect(50, 140, 10, 10); // right foot
fill(0, 0, 0);
rect(20, 70, 10, 20); // left eye
if (winking) {
rect(50, 82.5, 10, 5); // right eye
}
else {
rect(50, 70, 10, 20); // right eye
}
// animated chao ball
fill(246, 247, 2);
if (frameCount % 2 == 0) {
rect(30, 10, 20, 20); // ball
}
else {
rect(30, 15, 20, 20); // ball
}
}
function keyPressed() {
if (winking == true) {
winking = false;
} else {
winking = true;
}
}