xxxxxxxxxx
55
let i = 4; // intensity (0-10)
let h2ci = 0.5 // forehead to pain source relative intensity
let ep = 4 // eyes pressure (0-10)
function setup() {
createCanvas(400, 400);
t = 0
bi = i/2
hi = bi * h2ci
}
function draw() {
// time passing
t += 0.025
background(255)
// tension-pressure in the center
fill(0)
ellipse(200+random(-bi,bi), 200+random(-bi,bi),
50+random(-bi,bi), 50+random(-bi,bi))
const s = log(1 + max(2, ep / 2 * t))
// eye is y = 0.1 * pow(x, 2)
noFill();
stroke(0);
strokeWeight(5);
beginShape();
for (let x = -60; x < 61; x ++) {
const es = (pow(59, 2) - pow(x, 2)) * s / 100
curveVertex(100 - x, 200 - 0.001 * pow(x, 2) + min(es, 150))
}
endShape();
beginShape();
for (let x = -60; x < 61; x ++) {
const es = (pow(59, 2) - pow(x, 2)) * s / 100
curveVertex(300 - x, 200 - 0.001 * pow(x, 2) + min(es, 150))
}
endShape();
// forehead
noStroke()
fill(200)
ellipse(200, 135,
min(50 * s, 300) + random(-hi,hi),
min(20 * s, 80) + random(-hi,hi))
}
function keyPressed() {
// this will download the first 5 seconds of the animation!
if (key === 's') {
saveGif('S2.gif', 10);
}
}