xxxxxxxxxx
56
function setup() {
createCanvas(400, 400);
background("white");
}
function draw() {
//generate hair randomly
// generate a random int in range (https://www.geeksforgeeks.org/how-to-generate-random-number-in-given-range-using-javascript/)
function RNDM(min, max) {
return Math.floor(Math.random() * (max - min) + min);
}
//list of colors
// const colors = ["#5a3825","#3d2314","#cc9966","#2c1608","white","white"]
const colors = ["#59483e","#3d2314","#543b2d","#2c1608","#8a7467","white"]
noFill()
//for loop that generates hair (the lower the value the thinner the hair)
for (let i = 0; i < 500; i++) {
stroke(colors[RNDM(0,5)])
// strokeWeight(5)
// hair parts
// x-range , y-range , arc_witdt, arcHeight, arc start angle ,arc end angle
arc(RNDM(200,205), RNDM(150,240), 100-RNDM(0,45), 150, radians(10+RNDM(90,130)), radians(220))
arc(RNDM(190,200), RNDM(105,105), 100-RNDM(0,45), 150, radians(0+RNDM(0,5)),radians(10+RNDM(80,90)))
arc(RNDM(190,220), RNDM(160,150), 100-RNDM(0,45), 100, radians(10+RNDM(90,190)), radians(270))
arc(RNDM(300,300), RNDM(105,105), 100-RNDM(0,45), 100, radians(10+RNDM(90,99)), radians(180))
// stroke("red")
arc(RNDM(270,300), RNDM(160,150), 100-RNDM(0,45), 100, radians(-50+RNDM(-20,-5)), radians(30+RNDM(1,50)))
arc(312, 260, 100-RNDM(0,30), 100, radians(-45), radians(90))
}
//eyes
noStroke()
fill("black")
ellipse(220,180, 20,30)
ellipse(270,180, 20,30)
print("X:",mouseX,"Y:",mouseY)
}