Chernoff faces

Chernoff faces are used by computer programmers to present online data or to show your feelings. You will used it to connect to air pollution data and change the face features according to the pollution level. Click to show code to find how to create a Javascript function to draw emojis and how to change their arguments or parameters. It is also shown a map function to change properties (e.g. background color) depending on the mouse position. Change the emoji function to a Chernoff face function taking into account the parameters used to define Chernoff faces.

show code

var c1,c2;
function setup(){
createCanvas (1980, 1080);
function emoji(x,y,w,h,eyeSize, mouthSize, a1,a2,ec1,ec2,ec3,mc1,mc2,mc3){
ellipse (x,y,w,h);//face
fill (ec1,ec2,ec3);//eye rgb colour
ellipse (x-w/5, y-h/5,eyeSize,eyeSize);//eye
ellipse (x+w/5, y-h/5,eyeSize,eyeSize);
fill (mc1,mc2,mc3);//mouth rgb colour
arc(x,y+h/4,mouthSize*3, mouthSize,a1,a2,CHORD);//mouth a=angle
function draw(){
fill (255,255,0); //yellow
c2=map(mouseY, 0,height,255,0)

The best way to predict the future is to invent it (Alan Kay)