xxxxxxxxxx
73
let body;
let face;
let a;
let b;
function setup() {
createCanvas(400, 400);
angleMode(DEGREES);
a = random(91, 255);
b = random(150, 255);
alienMove = 1;
}
function draw() {
background(0);
noStroke();
let c = map(mouseX, 0, width, 0, 200);
let d = map(mouseX, 0, width, 0, 600);
fill(250, c, 10);
ellipse(width/2, height/2, d, d);
push();
translate(alienMove, 0);
//BODY
//map(value, start1, stop1, start2, stop2, [withinBounds])
push();
body = map(mouseX, 0, width, 0, 255);
face = map(mouseY, 0, height, 0, 255);
fill(body, 200, 200);
ellipse(200, 200, 260, 280);
ellipse(130, 230, 130, 235);
ellipse(270, 230, 130, 235);
pop();
//FACE
push();
fill(250, face, 255);
translate(90,120);
arc(50, 50, 70, 70, 0, 225, CHORD); /*arc(x, y, w, h, start, stop, [mode], [detail])*/
//RIGHT EYE
rotate(105);
arc(10,-180, 70, 70, 215, 80, CHORD);
pop();
//MOUTH
push();
stroke(58, 67, 74);
noFill();
strokeWeight(5);
arc(200, 200, 40, 30, 0, 180);
pop();
pop();
}
function keyPressed(){
alienMove = alienMove - 25;
if (alienMove > 0)
alienMove = 0;
}
function mousePressed(){
alienMove = alienMove + 25;
if (alienMove > 350)
alienMove = 0;
}