soot sprite
//Jessie Chen
//Section D
var sprite = 220;
var eyeWidth = 82;
var eyeHeight = 82;
var irisX = 240;
var irisY = 320;
var aX = 380;
var aY = 380;
var bX = 440;
var bY = 300;
var cX = 40;
var cY = 340;
var dX = 80;
var eX = 225;
var eY = 500;
var fX = 280;
let r, g, b;
r = random(255);
g = random(255);
b = random(255);
function setup() {
createCanvas(480, 640);
}
function draw() {
var x1 = width / 2;
var y1 = height / 2;
background(243, 231, 211);
//hair
stroke(0);
strokeWeight(5)
radius = 122 + length;
for (angle = 0; angle <360; angle=angle+ 6) {
x = cos(radians(angle)) * radius + 240;
print("x = " + x.toString())
;
y = sin(radians(angle)) * radius + 320;
print("y = " + y.toString());
line(x1, y1, x , y);
}
//head
fill(45);
ellipse(x1, y1, sprite, sprite);
//eye
fill(255);
var leftEye = width / 2 - 50;
var rightEye = width / 2 + 50;
ellipse(leftEye, height / 2, eyeWidth, eyeHeight);
ellipse(rightEye, height / 2, eyeWidth, eyeHeight);
//iris
fill(0);
ellipse(irisX - 50, irisY, 20, 20);
ellipse(irisX + 50, irisY, 20, 20);
//right arm
noFill();
stroke(0);
beginShape();
curveVertex(350, 320);
curveVertex(350, 320);
curveVertex(aX, aY);
curveVertex(bX, bY);
curveVertex(bX, bY);
endShape();
//left arm
noFill();
stroke(0);
beginShape();
curveVertex(130, 320);
curveVertex(130, 320);
curveVertex(cX, cY);
curveVertex(dX, bY);
curveVertex(dX, bY);
endShape();
//left leg
noFill();
stroke(0);
beginShape();
curveVertex(200, 422);
curveVertex(200, 422);
curveVertex(eX, eY);
curveVertex(140, 600);
curveVertex(140, 600);
endShape();
//right leg
noFill();
stroke(0);
beginShape();
curveVertex(280, 422);
curveVertex(280, 422);
curveVertex(fX, eY);
curveVertex(350, 610);
curveVertex(350, 610);
endShape();
//star
stroke(r, g, b);
fill(r, g, b);
strokeJoin(ROUND);
triangle(230, 120, 250, 120, 240, 103);
triangle(230, 120, 210, 120, 220, 137);
triangle(250, 120, 270, 120, 260, 137);
triangle(230, 150, 210, 150, 220, 135);
triangle(250, 150, 270, 150, 260, 135);
triangle(230, 150, 250, 150, 240, 167);
ellipse(240, 135, 28, 25);
}
function mousePressed() {
//eye
eyeWidth = random(75, 88);
eyeHeight = random(75, 88);
//iris
irisX = random(230, 250);
irisY = random(310, 330);
//hair
length = random(5, 13);
//legs
aX = random(340, 440);
aY = random(290, 350);
bX = random(285, 300);
bY = random(140, 160);
cX = random(30, 150);
cY = random(275, 230);
dX = random(100, 210);
eX = random(180, 200);
eY = random(520, 560);
fX = random(280, 300);
//star color
r = random(255);
g = random(255);
b = random(255);
}
This was inspired by the soot sprites from the anime “Spirited Away.” This piece was really challenging since I had to use trig to figure out an equation.