scan = loadImage('scantron.jpg');
font = loadFont('rocksalt.ttf');
createCanvas(windowWidth, windowHeight, WEBGL);
scan.resize(0, scan.height * height / 566);
paper = createGraphics(scan.width, scan.height);
wood = createTruncatedCone(rad, rad / 5, len / 10, 16, 1, true, true);
ppos = createVector(0, 0, 0);
gpos = createVector(paper.width / 2 + paper.height / 6.2, 0);
tang = map(mouseY, 0, height, PI / 4, -PI / 4);
ang = lerp(ang, tang, 0.1);
tang2 = map(mouseX, 0, width, -PI / 12, PI / 12);
ang2 = lerp(ang2, tang2, 0.1);
pointLight(90, 90, 90, -height/3, -height, -height / 2);
spotLight(90, 90, 90, gpos.x, height, 0, 0, -1, 0, PI / 8);
ppos.x = lerp(ppos.x, mouseX - width / 2, 0.2);
ppos.x = constrain(ppos.x, -paper.width / 2, gpos.x);
ppos.z = -paper.height / 26;
ppos.y = len * cos(map(ppos.x - (gpos.x - height / 6), -height / 9, height / 9, -HALF_PI, HALF_PI, true));
if (dist(ppos.x, ppos.z, gpos.x, 0) < height / 6) {
rfang = map(ppos.y, 0, len / 3, PI / 15, 0, true);
dip = map(ppos.y, 0, len / 2, len / 2, len / 30, true);
if(ppos.y<1) paper.ellipse(map(ppos.x, -paper.width / 2, paper.width / 2, 0, paper.width) + (paper.height / 180) * sin(ang3), (paper.height / 2 - paper.height / 26) - (paper.height / 480) * cos(ang3), (paper.height / 240));
translate(0, 0, -2 - len / 2 - len / 8);
specularMaterial('white');
box(scan.width, scan.height, 1);
translate(ppos.x, len / 2 + len / 8 - ppos.y, ppos.z);
translate(0, -len / 10, 0)
rotateX((PI / 144) * cos(ang3));
rotateZ((PI / 48) * sin(ang3));
translate(0, len / 10, 0);
specularMaterial('black');
specularMaterial('peru');
translate(0, -len / 20 - len / 80, 0);
translate(0, -len / 20, 0);
specularMaterial('rgb(247,247,13)');
translate(0, -dip / 2, 0);
cylinder(rad, dip, 16, 1);
translate(0, -dip / 2, 0);
ellipsoid(rad, len / 30, rad, 16, 1);
translate(0, -(len - dip) / 2, -dip/30);
cylinder(rad, (len - dip), 16, 1);
translate(0, -(len - dip) / 2, 0);
translate(0, -len / 20, 0);
specularMaterial('rgb(4,106,4)');
cylinder(rad * 1.05, len / 10, 16, 1);
specularMaterial('gold');
translate(0, -len / 48, 0);
cylinder(rad * 1.06, len / 96, 16, 1);
translate(0, len / 48, 0);
cylinder(rad * 1.06, len / 96, 16, 1);
translate(0, -len / 20 - len / 80, 0);
specularMaterial('rgb(225,173,182)');
cylinder(rad * 0.95, len / 40, 16, 1);
translate(0, -len / 80, 0);
ellipsoid(rad * 0.95, rad / 2, rad * 0.95);
translate(0, height / 6, 0);
specularMaterial('rgba(135,206,235,0.5)');
cylinder(height / 6.5, height / 3.2, 32, 1, true, true);
specularMaterial('rgba(250,250,250,0.5)');
translate(0, -height / 12, 0);
cylinder(height / 6, height / 2, 32, 1, false, true);
translate(0, -height / 4, 0);
torus(height / 6, height / 180, 32, 16);
paper.image(scan, paper.width / 2, paper.height / 2);
paper.translate(3.9 * paper.width / 5, paper.height / 1.9);
paper.textSize(paper.height / 72);
paper.text("Ivan Rudnicki", 0, 0);
paper.text("Physics", 0, paper.height / 36);
paper.text(floor(random(1, 29)), paper.height / 7, paper.height / 36);
paper.text((month().toString() + "/" + day().toString() + "/") + year().toString().slice(-2), 0, paper.height / 20);
paper.text(floor(random(1, 7)), paper.height / 7, paper.height / 20);
let ypos = paper.height / 6.1;
for (let i = 0; i < 20; i++) {
paper.ellipse(paper.width / 4.4 + floor(random(5)) * paper.width / 13, ypos, paper.width / 25, paper.height / 120);
ypos += paper.height / 67;