xxxxxxxxxx
57
//By moving the mouse, I can imitate the shape of the singer's mouth in the music video. It took me a long time to control the size of the mouth so that it won't exceed the character's face. At the same time, I can change the background color by pressing the keyboard. Although I can change the color of the mouth by the position of the mouse, I don't know how to do the specific color control.
//video: https://youtu.be/gvtf4lss7zE
let myTex = 'MOVE your mouse to sing'
let x;
let r;
let g;
let b;
let e;
function setup() {
createCanvas(400, 400);
}
function keyPressed(){
y = random(30,40);
}
function draw() {
//background(220);
//face
push();
fill(255, 255, 255);
e = random(0,8);
strokeWeight(e);
ellipse(200, 200, 250, 350);
pop();
//eyes
fill(0, 0, 0);
circle(150, 120, 20);
fill(0, 0, 0);
circle(250, 120, 20);
//mouth
r = mouseX/2.5;
g = mouseY/2.5;
b = mouseX/2.5;
fill(r,g,b);
ellipse(200, 250, mouseX*160/450, mouseY*160/450);
textSize(20);
fill(237, 34, 92);
text(myTex,80,20);
}
function keyPressed(){
x = random(0,255);
background(x);
}