/*
Created by Sean Braithwaite
September 16th, 2015; completed on September 22nd, 2015;
Introduction to Media Computation
Professor: Nicolas Hesler
Vison Enchancement Device Simulator 2015
Your mouse controls a pair of glasses which enchance vision as they are lowered towards ones head
The closer the glasses are to the head the easier it is to read the sign
Clicking the mouse applies a kind of x-ray effect to the glasses frame if it is infront of the players head
Pressing a button flashes the players eye on the screen (hold button for best effect)
*/
//Setup will run A SINGLE TIME upon initial program launch...
//used to setup canvas and preferred settings
void setup(){
//Open up a 400x400 pixel canvas
size(400,400);
//set creation mode for convenience
rectMode(CORNER);
ellipseMode(CENTER);
//Set framerate
frameRate(60);
}
//This function will run once per frame
void draw(){
//clear screen from previous frame
fill(0);
rect(0,0,400,400);
//set background to a darker shade to bring other objects to the foreground
background(#C1C1C1);
///////////////////////////////////////////////////////////
//////////////////////SIGN DETAILS/////////////////////////
///////////////////////////////////////////////////////////
//backboard
strokeWeight(5);
fill(#F5F5F5);
stroke(#F0F0F0);
rect(25,25,350,350,10); //backboard
//backboard details
fill(#F5E33E);
noStroke();
ellipse(50,50,10,10); //nail left
ellipse(350,50,10,10); //nail right
//sign characters first row
///////////////////////////////////////////////////////////
/////////////////////////ROW ONE///////////////////////////
///////////////////////////////////////////////////////////
//Below lines pertaining to the change in an objects width cause crashes if the mouse is clicked and dragged out of the upper boundary of the screen,
//however the resuslt visually is more powerful than the crash, thus it remains.
//Being exported and/ or embedded in a web page should resolve this issue as far as I know... This crash is unavoidable without conditionals as far as I know,
//and will affect all projects making use of width/height changes in association with mouse coordinates.
//setup vision gradient
//adjust distortion for this level
strokeWeight(406-mouseY);
stroke(0,mouseY-300);
//make letters and symbols
//#
line(185,45,205,45);//upper hori
line(185,55,205,55);//lower hori
line(190,40,190,60);//left vert
line(200,40,200,60);//right vert
//1
line(220,40,220,60);
//W
line(100,75,100,95);//leftmost vert
line(110,85,100,95);//middleleft diag
line(110,85,120,95);//middleright diag
line(120,75,120,95);//right vert
//E
line(130,75, 150, 75);//upper hori
line(130,85, 140, 85);//mid hori
line(130,95, 150, 95);//lower hori
line(130,75,130,95);//left vert
//L
line(160,75,160,95);//vert
line(160,95,180,95);//hori
//C
line(190,75,210,75);//upper hori
line(190,95,210,95);//lower hori
line(190,75,190,95);//left vert
//O
line(220,75,240,75);//upper hori
line(220,75,220,95);//left vert
line(220,95,240,95);//lower hori
line(240,75,240,95);//right vert
//M
line(250,75,250,95);//left vert
line(270,75,270,95);//right vert
line(250,75,260,85);//middleleft diag
line(270,75,260,85);//middleright diag
//E
line(280,75, 300, 75);//upper hori
line(280,85, 290, 85);//mid hori
line(280,95, 300, 95);//lower hori
line(280,75,280,95);//left vert
//second row of charactes
///////////////////////////////////////////////////////////
/////////////////////////ROW TWO///////////////////////////
///////////////////////////////////////////////////////////
//adjust distortion for this level
strokeWeight(404-mouseY);
stroke(0,mouseY-325);
//T
line(175,125,195,125);//upper hori
line(185,125,185,145);//mid vert
//O
line(205,125,205,145);//left vert
line(225,125,225,145);//right vert
line(205,125,225,125);//upper hori
line(205,145,225,145);//upper hori
//third row of characters
///////////////////////////////////////////////////////////
////////////////////////ROW THREE//////////////////////////
///////////////////////////////////////////////////////////
//adjust distortion for this level
strokeWeight(402-mouseY);
stroke(0,mouseY-350);
//S
line(85,175,105,175);//upper hori
line(85,175,85,185);//left vert
line(85,185,105,185);//mid hori
line(105,185,105,195);//right vert
line(85,195,105,195);//lower hori
//H
line(115,175,115,195);//left vert
line(135,175,135,195);//right vert
line(115,185,135,185);//middle hori
//E
line(145,175,145,195);//left vert
line(145,175,165,175);//upper hori
line(145,185,155,185);//mid hori
line(145,195,165,195);//lower hori
//R
line(175,175,175,195);//left vert
line(175,175,195,175);//top hori
line(175,185,195,185);//mid hori
line(195,175,195,185);//right vert
line(175,185,195,195);//leg
//I
line(205,175,225,175);//upper hori
line(205,195,225,195);//lower hori
line(215,175,215,195);//mid vert
//D
line(235,175,235,195);//left vert
line(235,175,255,175);//top hori
line(235,195,255,195);//lower hori
line(255,175,255,195);//right diag
//A
line(265,175,265,195);//left vert
line(285,175,285,195);//right vert
line(265,175,285,175);//upper hori
line(265,185,285,185);//lower hori
//N
line(295,175,295,195);//left vert
line(315,175,315,195);//right vert
line(295,175,315,195);//mid diag
//fourth and final row of characters
///////////////////////////////////////////////////////////
/////////////////////////ROW FOUR//////////////////////////
///////////////////////////////////////////////////////////
//adjust distortion for this level
strokeWeight(400-mouseY);
stroke(0,mouseY-375);
//C
line(105,225,105,245);//left vert
line(105,225,125,225);//upper hori
line(105,245,125,245);//lower hori
//O
line(135,225,135,245);//left vert
line(155,225,155,245);//right vert
line(135,225,155,225);//upper hori
line(135,245,155,245);//lower hori
//L
line(165,225,165,245);//left vert
line(165,245,185,245);//lower hori
//L
line(195,225,195,245);//left vert
line(195,245,215,245);//lower hori
//E
line(225,225,225,245);//left vert
line(225,225,245,225);//upper hori
line(225,235,235,235);//mid hori
line(225,245,245,245);//lower hori
//G
line(255,225,275,225);//upper hori
line(255,245,275,245);//lower hori
line(275,245,275,235);//right vert
line(255,225,255,245);//left vert
line(265,235,275,235);//middle hori
//E
line(285,225,285,245);//left vert
line(285,225,305,225);//upper hori
line(285,235,295,235);//mid hori
line(285,245,305,245);//lower hori
///////////////////////////////////////////////////////////
//////////////////////////EARS/////////////////////////////
///////////////////////////////////////////////////////////
//Ears
strokeWeight(7);
stroke(#F7E7BE);
fill(#F0E1BA);
triangle(50,400,25,350,75,355);//left ear
triangle(350,400,375,350,325,355);//right ear
///////////////////////////////////////////////////////////
//////////////////MAGNIFICATION DEVICE/////////////////////
///////////////////////////////////////////////////////////
//arms
stroke(#48402B);
line(25,400,75, mouseY);//left arm
line(375,400,325, mouseY);//right arm
//bridge (connector)
stroke(#F5E33E);
strokeWeight(12);
line(180, mouseY, 220, mouseY);
//head decoration
//white dot
noStroke();
fill(255);
ellipse(115, mouseY-25, 10, 10);//left deco
ellipse(265, mouseY-25, 10, 10);//right deco
//distortion
noFill();
stroke(#4EDFFA,50);
ellipse(125, mouseY, 87, 87);//left distort
ellipse(275, mouseY, 87, 87);//right distort
//Magnification device lens & rims
stroke(#F5E33E);
strokeWeight(7);
noFill();
ellipse(125, mouseY, 100, 100);//left rim
ellipse(275, mouseY, 100, 100);//right rim
///////////////////////////////////////////////////////////
//////////////////////////HEAD/////////////////////////////
///////////////////////////////////////////////////////////
//Head
stroke(#F7E7BE);//setup colours
fill(#F0E1BA);
//head is rectangle with greatly curved corners
rect(50,275,300,300,200,200,0,0);
fill(255);//setup bald shine effect
noStroke();
ellipse(125,325,20,20);//sheen
///////////////////////////////////////////////////////////
///////////////////SQUINTING OVERLAY///////////////////////
///////////////////////////////////////////////////////////
//as mouse is lowered, bring dark boxes into view to simulate revolutionary squinting feature like never before
fill(0);
rect(0,0,400,-350+mouseY);//upper eyelid
rect(0,400,400,350-mouseY);//lower eyelid
}
//performs function actions upon trigger (mousepress)
void mousePressed() {
//clear screen
fill(0);
rect(0,0,400,400);
//flash new glasses and eyes
///////////////////////////////////////////////////////////
//////////////////MAGNIFICATION DEVICE/////////////////////
///////////////////////////////////////////////////////////
//arms (connects to base of head behind ears)
stroke(#48402B);
line(25,400,75, mouseY);//left frame arm
line(375,400,325, mouseY);//right frame arm
//bridge (connector)
stroke(#DBDBDB);
strokeWeight(12);
line(180, mouseY, 220, mouseY);
//head decoration
//white dot
noStroke();
fill(255);
ellipse(115, mouseY-25, 10, 10);//left lens decoration
ellipse(265, mouseY-25, 10, 10);//right lens decoration
//distortion
noFill();
stroke(#4EDFFA,50);
ellipse(125, mouseY, 87, 87);//left lens distortion
ellipse(275, mouseY, 87, 87);//right lens distortion
//Magnification device lens & rims
stroke(#DBDBDB);
strokeWeight(7);
noFill();
ellipse(125, mouseY, 100, 100);//left lens frame
ellipse(275, mouseY, 100, 100);//right lens frame
//Eyes
stroke(255);
fill(0);
ellipse(125,mouseY,50,50);//left
ellipse(275,mouseY,50,50);//right
}
//Try pressing and holding the key for an especially spooky effect.
//Flashes the players big eye on screen. Works as a frontal view of the glasses being put on and taken off.
void keyPressed() {
//clear screen
fill(#F0E1BA);
rect(0,0,400,400);
//setup eye
fill(255);
strokeWeight(25);
stroke(0);
ellipse(200,200,500,250);//draw white of eye
//draw iris (stroke) and pupil (fill)
stroke(mouseY,mouseX,#006698);
fill(0);
ellipse(200,200,150,150);
//affect w/ height
//draw glasses frame
strokeWeight(25);//setup stroke size
noFill();
//glasses overlay will appear as the glasses are lowered to the players face
stroke(#4EDFFA,mouseY-350);
ellipse(200,mouseY-200,325,325);//draw distort
stroke(#F5E33E,mouseY);//setup frame colours
ellipse(200,mouseY-200,375,375);//draw frame
}