2020 Calendar shaunmurDownloadvar imgJanCal, imgFebCal, imgMarCal, imgAprCal,
imgMayCal, imgJunCal, imgJulCal, imgAugCal,
imgSepCal, imgOctCal, imgNovCal, imgDecCal;
var imgJan2, imgMar, aprImg, aprImg2,
aprImg3, imgJun1, imgJun2, imgJun3,
imgJul, imgOct, imgNov;
function preload() {
imgJanCal = loadImage("https://i.imgur.com/mGCWr67.jpg?2"); imgFebCal = loadImage("https://i.imgur.com/8hI9x3x.jpg"); imgMarCal = loadImage("https://i.imgur.com/hozlVRU.jpg"); imgAprCal = loadImage("https://i.imgur.com/PUDQpPe.jpg"); imgMayCal = loadImage("https://i.imgur.com/FyUdmy7.png"); imgJunCal = loadImage("https://i.imgur.com/1V9Akde.jpg"); imgJulCal = loadImage("https://i.imgur.com/Tvukiin.jpg"); imgAugCal = loadImage("https://i.imgur.com/kECFW1b.jpg"); imgSepCal = loadImage("https://i.imgur.com/O6e3LcQ.jpg"); imgOctCal = loadImage("https://i.imgur.com/CcQpShS.jpg"); imgNovCal = loadImage("https://i.imgur.com/8Sqt5Um.jpg"); imgDecCal = loadImage("https://i.imgur.com/DrModlG.jpg");
imgJan = loadImage("https://i.imgur.com/UO8RoiW.png"); imgJan2 = loadImage("https://i.imgur.com/lM5i1Gp.jpeg") imgFeb = loadImage("https://i.imgur.com/AIq3z8n.jpeg"); imgMar = loadImage("https://i.imgur.com/VFoP91O.png"); mayImg1 = loadImage("https://i.imgur.com/RhNvf13.jpeg"); mayImg2 = loadImage("https://i.imgur.com/huOal0b.png"); mayImg3 = loadImage("https://i.imgur.com/20G2Bj4.jpg"); aprImg = loadImage("https://i.imgur.com/G0SnXSB.jpg"); aprImg2 = loadImage("https://i.imgur.com/VVfSCll.jpeg"); aprImg3 = loadImage("https://i.imgur.com/IgLfZQb.png"); imgJun1 = loadImage("https://i.imgur.com/V8MHehF.jpg"); imgJun2 = loadImage("https://i.imgur.com/on3fzqb.jpg"); imgJun3 = loadImage("https://i.imgur.com/SAUkUd3.jpg"); imgJul = loadImage("https://i.imgur.com/FXdV1Bk.jpg"); imgOct = loadImage("https://i.imgur.com/a7W8anl.png"); imgNov = loadImage("https://i.imgur.com/OCT1IpR.jpg");}
function setup() {
createCanvas(500, 400);
makeCalendar();
for (var i = 0; i < 1; i++) {
var v = makeVirus(200, 200,
random(-50, 50), random(10, 50));
viruses.push(v);
}
for (var i = 0; i < 12; i++){ var rx = random(width);
tigers[i] = makeTigers(rx);
}
for (var i = 0; i < 1; i++){
var hy = random(height/3, height);
hurricane[i] = makeHurricane(hy);
}
for (var i = 0; i <= 100; i++) {
var n = noise(noiseParam);
var value = map(n, 0, 1, 0, height/2);
mountain.push(value);
noiseParam += noiseStep;
}
for (var i = 0; i <= 100; i++) {
var n = noise(fNoiseParam);
var value = map(n, 0, 1, 0, height);
fire.push(value);
fNoiseParam += fNoiseStep;
}
for (var i = 0; i < 10; i++){
var rx = random(width);
trees[i] = makeTree(rx);
}
for (var i = 0; i < 10; i++){
var cx = random(width);
smoke[i] = makeSmoke(cx);
}
}
function draw() {
clickMonthJan();
clickMonthFeb();
clickMonthMar();
clickMonthApr();
clickMonthMay();
clickMonthJun();
clickMonthJul();
clickMonthAug();
clickMonthSep();
clickMonthOct();
clickMonthNov();
clickMonthDec();
backButton();
}
function makeCalendar() {
fill(0);
strokeWeight(1);
for (let i = 0; i < 3; i++) {
line(0, i*133.33 + 133, width, i*133.33 + 133);
line(i*125 + 125, 0, i*125 + 125, height);
}
var calPics = [imgJanCal, imgFebCal, imgMarCal, imgAprCal, imgMayCal, imgJunCal, imgJulCal, imgAugCal, imgSepCal, imgOctCal, imgNovCal, imgDecCal];
var xCo = [0.5, 125.5, 250.5, 375.5, 0, 125.5, 250.5, 375.5, 0.5, 125.5, 250.5, 375.5];
var yCo = [0, 0, 0, 0, 132.83, 132.83, 132.83, 132.83, 267.16, 267.16, 267.16, 267.16];
for (var i = 0; i < calPics.length; i++) {
image(calPics[i], xCo[i], yCo[i], 124.5, 132.83);
}
writeMonths();
}
function writeMonths() {
var monthText = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
var monthCode = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "0", " ", "="];
var monthX = [55, 180, 305, 430, 55, 180, 305, 430, 55, 180, 305, 430];
var monthY = [65, 65, 65, 65, 200, 200, 200, 200, 335, 335, 335, 335];
strokeWeight(1);
textFont('Times');
textSize(24);
textAlign(CENTER);
stroke(0);
fill(255);
for (var i = 0; i < monthText.length; i++) {
text(monthText[i], monthX[i], monthY[i]);
text(monthCode[i], monthX[i], monthY[i] + 30);
}
textSize(40);
text("-", 300, 363);
textSize(15);
textAlign(LEFT);
text("Press a key to begin", 3, 25); text("Press ESC to return", 380, 25);
}
function backButton() { if (keyCode === 27) {
clearBkrd();
makeCalendar();
v.diam = 25;
pCount = 0;
vpCount = 0;
}
}
function clearBkrd() { background(255);
}
function clickMonthJan() {
if (keyCode === 49) {
clearBkrd();
frameRate(30);
JanBackground();
USflag();
NKflag();
nuclear(width/2, height/2);
JanText(45, height-85);
backButton();
}
}
function JanBackground() {
image(imgJan2, 0, 0, width, height);
}
function starJan() {
var x1 = [340, 348, 364, 354, 356, 340, 324, 326, 315, 332]; var y1 = [44, 58, 62, 75, 92, 85, 92, 75, 62, 58];
var nPoints= x1.length;
beginShape();
fill('Red');
for (var i= 0; i< nPoints; i++) {
vertex(x1[i] + 35, y1[i] + 5);
}
endShape(CLOSE);
}
function USflag() fill('Red');
rect(25, 25, width/3, height/4);
for(let i = 0; i < 7; i++) { fill('white');
rect(25, 30 + (i * 13.5), width/3, 7);
}
fill(0, 0, 155);
rect(25, 25, 50, 50);
}
function NKflag() { fill('Blue');
rect(width-164, 25, width/3, height/4);
push();
fill('Red');
strokeWeight(5);
noStroke();
rect(width-163, 40, width/3 + 6, 70); stroke('White');
line(width, 40, width-161, 40);
line(width, 110, width-161, 110);
pop();
noStroke();
fill('White');
circle(width-125, 75, 53);
stroke(0);
push();
starJan();
pop();
}
function nuclear(x, y) { push();
translate(x, y);
let d = 80
let d1 = 10
stroke(0);
strokeWeight(3);
fill('yellow'); circle(0, 0, d);
fill('black');
circle(0, 0, d1);
let deg = 120;
let dx = 5;
let angle = 45;
rotate(radians(angle));
for (let i = 0; i < 3; i++) { rotate(radians(deg));
beginShape();
fill('black');
vertex(-7, -7);
vertex(-30, -10);
vertex(-10, -30);
endShape(CLOSE);
}
angle = angle + dx;
pop();
push();
rotate(radians(-20));
image(imgJan, 135, 185, 100, 100); pop();
}
function JanText(x, y) { push();
translate(x, y);
textSize(23);
fill(255);
text("United Shaysh of America VS. North Korea", 0, 0);
pop();
}
var rip =
function clickMonthFeb() {
if (keyCode === 50) {
clearBkrd();
frameRate(30);
drawPaper();
drawRip();
mendPaper();
backButton();
}
}
function drawPaper() { push();
background('grey');
image(imgFeb, 0, 0);
fill('white');
rectMode(CENTER);
rect(width/2+30, height/2, 200, 300);
rect(width/2+15, height/2, 200, 300);
rect(width/2, height/2, 200, 300);
textStyle(ITALIC);
textSize(22);
fill('black');
text("State of the Union", 160, 80);
fill('white');
text("Click and hold to rip!", width-205, 25);
text("Nancy Pelosi Simulator", 10, 25);
line(180, 110, 320, 110);
for (let i = 0; i < 20; i++) {
line(165, 120 + i*11, 335, 120 + i*11);
}
pop();
}
function drawRip() { push();
if (mouseIsPressed) {
background('grey');
image(imgFeb, 0, 0);
textStyle(ITALIC);
textSize(22);
fill('white');
text("Release mouse to mend...", 10, 25);
push();
rotate(radians(-30));
fill('white');
rectMode(CORNER);
rect(width/2-300, height/2-80, 100, 300);
for (let i = 0; i < 20; i++) {
line(-40, 190 + i*11, 40, 190 + i*11);
}
fill('black');
text("State of t", -50, 160);
rotate(radians(60));
fill('white');
rect(width/2+160, height/2-345, 100, 300);
for (let j = 0; j < 20; j++) {
line(width/2+175, height/2-280 + j*11, width/2+250, height/2-280 + j*11);
}
fill('black');
text("he Union", width/2+162, height/2-300);
pop();
pop();
rip = 1;
}
}
function mendPaper() { push();
if (rip == 1 & !mouseIsPressed) {
background('grey');
image(imgFeb, 0, 0);
fill('white');
rectMode(CENTER);
rect(width/2+30, height/2, 200, 300);
rect(width/2+15, height/2, 200, 300);
rect(width/2, height/2, 200, 300);
textStyle(ITALIC);
textSize(22);
fill('black');
text("State of the Union", 160, 80);
fill('white');
text("Click and hold to rip!", width-205, 25);
text("Nancy Pelosi Simulator", 10, 25);
fill('black');
line(180, 110, 320, 110);
for (let i = 0; i < 20; i++) {
line(165, 120 + i*11, 335, 120 + i*11);
}
fill(255, 248, 220);
rect(width/2-15, height/2, 30, 300);
pop();
}
}var viruses = [];
function clickMonthMar() {
if (keyCode === 51) {
clearBkrd();
backButton();
frameRate(15);
image(imgMar, 0, 0, 500, 400);
for (var i = 0; i < viruses.length; i++) {
var v = viruses[i];
v.stepFunction();
v.drawFunction();
if (v.diam > 450) {
background(0);
stroke(255, 0, 0);
strokeWeight(4);
push();
textSize(48);
translate(width/2, height/2)
rotate(radians(90));
text(":(", 0, 0);
pop();
stroke(0);
strokeWeight(2);
fill('white');
text("Sad", width/2, height/2 + 100);
}
}
}
}
function virusStep() {
this.age++;
this.x += this.dx;
this.y += this.dy;
if (this.x > width) { this.x = width - (this.x - width);
this.dx = -this.dx;
this.diam *= 1.25;
} else if (this.x < 0) { this.x = -this.x;
this.dx = -this.dx;
this.diam *= 1.25;
}
if (this.y > height) { this.y = height - (this.y - height);
this.dy = -this.dy;
this.diam *= 1.25;
} else if (this.y < 0) { this.y = -this.y;
this.dy = -this.dy;
this.diam *= 1.5;
}
}
function virusDraw() {
stroke('black') strokeWeight(2);
fill('red');
push();
translate(this.x, this.y);
circle(0, 0, this.diam);
strokeWeight(3) var angle = 45;
for (let i = 0; i < 8; i++) {
rotate(radians(angle));
beginShape();
vertex(this.diam/2 - 10, 0)
vertex(random(this.diam/2 + 4, this.diam/2 + 8), random(-2, 2));
endShape(CLOSE);
ellipse(random(this.diam/2 + 8, this.diam/2 + 6), random(1, 3), 11, 9);
}
pop();
}
function makeVirus(vx, vy, vdx, vdy) {
v = {x: vx, y: vy,
dx: vdx, dy: vdy,
age: 0,
diam: 25,
stepFunction: virusStep,
drawFunction: virusDraw
}
return v;
}
var tigers = [];
var deg = 10
var joe = 1;
function clickMonthApr() {
if (keyCode === 52) {
clearBkrd();
frameRate(12);
displayHorizon();
updateAndDisplayTigers();
removeTigersThatHaveSlippedOutOfView();
addNewTigersWithSomeRandomProbability();
backButton();
}
}
function updateAndDisplayTigers(){
for (var i = 0; i < tigers.length; i++){
tigers[i].move();
tigers[i].display();
}
}
function removeTigersThatHaveSlippedOutOfView(){
var tigersToKeep = [];
for (var i = 0; i < tigers.length; i++){
if (tigers[i].x + tigers[i].breadth > 0) {
tigersToKeep.push(tigers[i]);
}
}
tigers = tigersToKeep; }
function addNewTigersWithSomeRandomProbability() {
var newTigersLikelihood = 0.03;
if (random(0,1) < newTigersLikelihood) {
tigers.push(makeTigers(width));
}
}
function tigersMove() {
this.x += this.speed;
}
function tigersDisplay() {
push();
translate(this.x, height - floor(random(30, 40)));
image(aprImg, 0, -15, 80, 35);
pop();
}
function makeTigers(birthLocationX) {
var tgs = {x: birthLocationX,
breadth: 50,
speed: -1.0,
move: tigersMove,
display: tigersDisplay}
return tgs;
}
function displayHorizon(){
image(aprImg2, 0, 0, width, height);
push();
translate(60, 80);
imageMode(CENTER);
rotate(radians(deg));
for (let i = 0; i < joe; i++) {
image(aprImg3, 0, 0, 80, 80);
}
pop();
deg = deg + 10;
}
function clickMonthMay() {
if (keyCode === 53) {
clearBkrd();
frameRate(60);
drawBackdrop();
leader();
drawPodium();
backButton();
}
}
function leader() push();
var top = height/2;
var bottom = height;
var conY = constrain(mouseY, top, bottom);
imageMode(CENTER);
image(mayImg1, width/2, conY, 120, 180);
pop();
}
function drawPodium() push();
imageMode(CENTER);
image(mayImg2, 250, 400, 300, 250);
pop();
}
function drawBackdrop() push();
imageMode(CENTER);
image(mayImg3, width/2, height/2, 500, 400);
textSize(20);
fill('black');
text("N.K. Leader Simulator", 10, 30);
text("Moves with your mouse!", width-210, 30);
pop();
}
var moveJun = 1;
function clickMonthJun() {
if (keyCode === 54) {
clearBkrd();
frameRate(30);
drawChurch();
drawPres();
drawProtest();
fightBack();
backButton();
}
}
function drawChurch() push();
imageMode(CENTER);
image(imgJun1, width/2, height/2, 500, 400);
textSize(20);
fill('black');
text("Click and hold mouse to fight back!", 10, 25);
pop();
}
function drawPres() push();
var junX1 = width - 50;
var conX1 = constrain(junX1 - moveJun, 230, width + 60);
imageMode(CENTER);
image(imgJun2, conX1 , height-50, 120, 130);
pop();
}
function drawProtest() push();
var junX2 = 80;
var conX2 = constrain(junX2 - moveJun, -100, 230);
imageMode(CENTER);
image(imgJun3, conX2, height-50, 200, 150);
pop();
}
function fightBack() push();
moveJun ++;
print(moveJun);
if (mouseIsPressed) {
moveJun -= 2;
}
moveJun = constrain(moveJun, -150, 230);
pop();
}
var julXPoints = [];
var julYPoints = [];
var julClr = [];
function clickMonthJul() { if (keyCode === 55) {
clearBkrd();
frameRate(60);
imgJul.resize(width, height);
imgJul.loadPixels();
var x = random(width); var y = random(height);
var clr = imgJul.get(x, y);
stroke(clr);
strokeWeight(5);
noFill();
point(x, y);
julXPoints.push(x); julYPoints.push(y);
julClr.push(clr);
for (var i = 0; i < julXPoints.length; i++) {
stroke(julClr[i]);
point(julXPoints[i], julYPoints[i]);
}
backButton();
}
}
function clickMonthAug() { strokeWeight(1);
stroke(0);
if (keyCode === 56) {
clearBkrd();
background(0);
frameRate(30);
for (var i = 0; i < 3; i++) {
for(var j = 0; j < 4; j++){
star(i*200 + 25, j*100);
}
}
for (var a = 0; a < 2; a++) {
for (var b = 0; b < 4; b++) {
star(a*200 + 125, b*100 + 50);
}
}
spaceship(200, 150);
backButton();
}
}
function spaceship(x, y) {
push();
translate(x, y);
rotate(radians(30));
fill(255);
ellipse(25, 0, 50, 100); rect(0, 0, 50, 150);
stroke(255, 0, 0);
strokeWeight(3);
push();
rotate(radians(-90));
text("SpaceX", -120, 25);
pop();
stroke(0);
strokeWeight(1);
triangle(0, 75, 0, 150, -35, 150); triangle(50, 75, 50, 150, 85, 150);
push();
translate(-35, 150);
for (var i = 0; i < 3; i++) { fill(255, 175, 0);
triangle(i*40, 0, (i+1)*40, 0, (i*40 + random(15, 25)), random(95, 105));
}
pop();
pop();
}
function star(x, y) {
var sx = [0, 5.5, 16.5, 9.5, 10.5, 0, -10.5, -9.5, -16.5, -5.5];
var sy = [0, 9.5, 12.5, 21, 32, 27.5, 32, 21, 12.5, 10.5];
push();
translate(x, y);
fill(255, 255, 0);
var nPoints = sx.length;
beginShape();
for (var i = 0; i < nPoints; i++) {
vertex(sx[i] + random(-1, 1), sy[i] + random(-1, 1));
}
endShape(CLOSE);
pop();
}
var trees = [];
var smoke = [];
var mountain = [];
var fire = [];
var noiseParam = 0;var noiseStep = 0.01;
var fNoiseParam = 0;var fNoiseStep = 0.05;
function clickMonthSep() { if (keyCode === 57) {
clearBkrd();
text("Sep TEST", width/2, height/2);
backButton();
frameRate(10);
background(100);
updateAndDisplaySmoke();
removeSmokeThatHasSlippedOutOfView();
addNewSmokeWithSomeRandomProbability();
mountains();
makeFire();
fill(75);
rect(0, 335, width, 65);
updateAndDisplayTrees();
removeTreesThatHaveSlippedOutOfView();
addNewTreesWithSomeRandomProbability();
}
}
function updateAndDisplayTrees(){
for (var i = 0; i < trees.length; i++){
trees[i].move();
trees[i].display();
}
}
function removeTreesThatHaveSlippedOutOfView(){
var treesToKeep = [];
for (var i = 0; i < trees.length; i++){
if (trees[i].x + trees[i].breadth > 0) {
treesToKeep.push(trees[i]);
}
}
trees = treesToKeep;
}
function addNewTreesWithSomeRandomProbability() {
var newTreeLikelihood = 0.05;
if (random(0,1) < newTreeLikelihood) {
trees.push(makeTree(width));
}
}
function treeMove() {
this.x += this.speed;
}
function treeDisplay() {
var tHeight = 90;
strokeWeight(5);
stroke(0);
push();
translate(this.x, height - 40);
line(0, -tHeight, 0, 0);
line(0, -40, -22, -75);
line(0, -40, 22, -75);
line(0, -50, -15, -85);
line(0, -50, 15, -85);
line(0, -30, -30, -65);
line(0, -30, 30, -65);
stroke(200);
pop();
}
function makeTree(birthLocationX) {
var tr = {x: birthLocationX,
breadth: 50,
speed: -3.5,
move: treeMove,
display: treeDisplay}
return tr;
}
function updateAndDisplaySmoke(){
for (var i = 0; i < smoke.length; i++){
smoke[i].move();
smoke[i].display();
}
}
function removeSmokeThatHasSlippedOutOfView(){
var smokeToKeep = [];
for (var i = 0; i < smoke.length; i++){
if (smoke[i].x + smoke[i].breadth > 0) {
smokeToKeep.push(smoke[i]);
}
}
smoke = smokeToKeep;
}
function addNewSmokeWithSomeRandomProbability() {
var newSmokeLikelihood = 0.02;
if (random(0,1) < newSmokeLikelihood) {
smoke.push(makeSmoke(width));
}
}
function smokeMove() {
this.x += this.speed;
}
function smokeDisplay() {
fill(50);
noStroke();
push();
translate(this.x, this.y);
ellipse(0, this.y, 90, 15);
ellipse(0, this.y+10, 100, 15);
ellipse(0, this.y-10, 80, 15);
pop();
}
function makeSmoke(birthLocationX) {
var smk = {x: birthLocationX,
y: random(0, height/2),
breadth: 50,
speed: -3.,
move: smokeMove,
display: smokeDisplay}
return smk;
}
function mountains() {
mountain.shift();
var n = noise(noiseParam);
var value = map(n, 0, 1, 0, height);
mountain.push(value);
noiseParam += noiseStep;
fill(0); beginShape();
vertex(0, height);
for (var i = 0; i <= 100; i++) {
vertex(i*5, mountain[i]);
}
vertex(width, height);
endShape();
}
function makeFire() {
fire.shift();
var n = noise(fNoiseParam);
var value = map(n, 0, 1, 0, height);
fire.push(value);
fNoiseParam += fNoiseStep;
fill(255, 0, 0); beginShape();
vertex(0, height);
for (var i = 0; i <= 100; i++) {
vertex(i*5, fire[i]);
}
vertex(width, height);
endShape();
fill(255, 175, 0); beginShape();
vertex(0, height);
for (var j = 0; j <= 100; j++) {
vertex(j*5, fire[j] + 50);
}
vertex(width, height);
endShape();
fill(255, 255, 0); beginShape();
vertex(0, height);
for (var p = 0; p <= 100; p++) {
vertex(p*5, fire[p] + 100);
}
vertex(width, height);
endShape();
}
var hurricane = [];
var xMove = [];
var imgOct;
function clickMonthOct() {
if (keyCode === 48) {
clearBkrd();
frameRate(15);
translate(width, 0);
image(imgOct, -width-50, -107, 650, 560);
updateAndDisplayHurricane();
removeHurricanesThatHaveSlippedOutOfView();
addNewHurricanesWithSomeRandomProbability();
backButton();
}
}
function updateAndDisplayHurricane(){
for (var i = 0; i < hurricane.length; i++){
hurricane[i].move();
hurricane[i].display();
}
}
function removeHurricanesThatHaveSlippedOutOfView(){
var hurricanesToKeep = [];
for (var i = 0; i < hurricane.length; i++){
if (hurricane[i].x > -550 || hurricane[i].y > -50) {
hurricanesToKeep.push(hurricane[i]);
}
}
hurricane = hurricanesToKeep;
}
function addNewHurricanesWithSomeRandomProbability() {
var newHurricaneLikelihood = 0.025;
var newHY = random(height/3, height);
this.xMove = random(10);
this.yMove = random(10);
if (random(0,1) < newHurricaneLikelihood) {
hurricane.push(makeHurricane(newHY));
}
}
function hurricaneMove() {
this.x -= this.hxMove;
this.y -= this.hyMove;
this.spin += 10;
}
function hurricaneDisplay() {
push();
translate(this.x, this.y);
rotate(radians(this.spin));
noStroke();
fill(255, 0, 0);
ellipse(0, 0, 30, 30);
fill(230);
ellipse(0, 0, 10, 10);
push();
scale(0.7);
translate(-40, 5);
stroke(255, 0, 0);
strokeWeight(5);
noFill();
beginShape();
for (var i = 2; i <= 4; i += 0.1) {
var y1 = Math.pow(2.6, i);
vertex(i*25, -y1);
}
endShape();
pop();
push();
scale(0.7);
stroke(255, 0, 0);
strokeWeight(5);
noFill();
translate(40, -5);
rotate(radians(180));
beginShape();
for (var i = 2; i <= 4; i += 0.1) {
var y1 = Math.pow(2.6, i);
vertex(i*25, -y1);
}
endShape();
pop();
pop();
}
function makeHurricane(birthLocationY) {
var h = {x: 0, y: birthLocationY, hxMove: xMove, hyMove: 5, move: hurricaneMove, spin: 0, display: hurricaneDisplay}
return h;
}
var theta = 0;
var txp = 0;
var typ = 0;
var thetavp = 0;
var txvp = 0;
var tyvp = 0;var pCount = 0;
var vpCount = 0;
function clickMonthNov() { strokeWeight(1);
stroke(0);
textSize(14);
if (keyCode === 189) {
clearBkrd();
frameRate(15);
backButton();
image(imgNov, -150, -60, 800, 650);
stroke(255);
president(150, 200);
vicePresident(350, 200);
fill(255);
text("Who will be the first to 270?", 150, 20);
text("Click the mouse on the left to give Alec Baldwin electoral votes", 75, 45)
text("Click the mouse on the right to give Jim Carrey electoral votes", 75, 70);
text(pCount, 150, 120);
text(vpCount, 350, 120);
debate();
}
if (pCount >= 270) {
background(255, 0,0);
textSize(30);
stroke(0);
fill(0);
text("I did it! It was RIGGED but I won!", 20, height/2 - 15);
text("Very good for our Great Country", 25, height/2 + 15);
}
if (vpCount >= 270) {
background(0, 0, 255);
textSize(50);
stroke(255);
fill(255);
text("Will you shut up man!", 5, height/2);
}
}
function debate(){
if (mouseIsPressed) {
if (mouseX < width/2) { theta = 15;
txp = 150;
typ = -100
pCount = pCount + 5;
}
if (mouseX >= width/2) { thetavp = -15;
txvp = -150;
tyvp = 0;
vpCount = vpCount + 5;
}
}
}
function mouseReleased() {
if (theta === 15) { theta = 0;
txp = 0;
typ = 0;
}
if (thetavp === -15) { thetavp = 0;
txvp = 0;
tyvp = 0;
}
}
function president(x, y) {
push();
rotate(radians(theta));
translate(x + txp, y + typ);
noStroke();
fill(255, 175, 0);
push();
rotate(radians(75)); ellipse(17, -12, 4, 15);
rotate(radians(30));
ellipse(15, -17, 4, 15);
pop();
fill(255, 175, 0); ellipse(0, 0, 40, 50);
fill(255, 255, 0); ellipse(3.5, -20, 45, 15);
fill(255); ellipse(10, -2, 8, 8);
fill(0);
ellipse(10, -2, 4, 4);
stroke(0);
line(25, 17, 40, 17);
line(25, 9, 40, 1);
line(25, 25, 40, 33);
noStroke();
fill(255); rect(-15, 23, 32, 50);
fill(0, 0, 255); rect(-15, 23, 25, 50);
fill(255, 0, 0); rect(14, 23, 3, 30);
fill(0); ellipse(3, 133, 35, 15);
fill(0, 0, 255); rect(-15, 73, 27, 60);
push(); rotate(radians(-40));
fill(255, 175, 0);
ellipse(15, 40, 15, 10);
fill(0, 0, 255);
rect(-35, 35, 50, 10);
pop();
pop();
}
function vicePresident(x, y) {
push();
rotate(radians(thetavp));
translate(x + txvp, y + tyvp);
noStroke();
fill(250, 237, 203); ellipse(-2, 0, 40, 50);
fill(255); ellipse(0, -22, 35, 8);
fill(255); ellipse(-10, -4, 8, 8);
fill(0);
ellipse(-10, -4, 4, 4);
fill(255, 0, 0); ellipse(-12, 13, 8, 8);
stroke(0);
line(-25, 13, -40, 13);
line(-25, 8, -40, 0);
line(-25, 18, -40, 26);
noStroke();
fill(255); rect(-15, 23, 25, 50);
fill(0, 0, 255); rect(-8, 23, 18, 50);
fill(255, 0, 0); rect(-15, 23, 3, 30);
fill(0); ellipse(-7, 133, 35, 15);
fill(0, 0, 255); rect(-15, 73, 25, 60);
push(); rotate(radians(40));
fill(250, 237, 203);
ellipse(-18, 45, 10, 10);
fill(0, 0, 255);
rect(-18, 40, 50, 10);
pop();
pop()
}
var xpos = 0;
var xcoord = [35, 25, 55, 200, 240, 400, 470, 440, 455, 230, 280, 415, 100, 280];
var ycoord = [25, 100, 350, 120, 150, 75, 45, 175, 300, 320, 365, 340, 215, 50];
function clickMonthDec() {
if (keyCode === 187) {
clearBkrd();
backButton();
frameRate(5);
background(0);
var sec = second();
var min = minute();
var hr = hour();
var d = day();
background(0);
for (var i = 0; i < 14; i++) {
firework(xcoord[i], ycoord[i]);
}
push();
scale(0.5);
president(16*d, 40); pop();
decVirus(20*hr, 150); image(aprImg3, 8*min, 200, 80, 80); decHurricane(8*sec, 350);
}
}
function firework(x, y) {
var r = random(255);
var g = random(255);
var b = random(255);
push();
translate(x, y);
stroke(r, g, b);
for (var i = 0; i < 12; i++) { push();
rotate(radians(i*30));
line(xpos, 0, xpos + 15, 0);
pop();
}
if (xpos <= 25) { xpos += 1;
}
else if (xpos > 25) { xpos = 0;
}
pop();
}
function decVirus(x, y) { stroke('black') strokeWeight(2);
fill('red');
push();
translate(x, y);
circle(0, 0, 35);
strokeWeight(3) var angle = 45;
for (let i = 0; i < 8; i++) {
rotate(radians(angle));
beginShape();
vertex(35/2 - 10, 0)
vertex(random(35/2 + 4, 35/2 + 8), random(-2, 2));
endShape(CLOSE);
ellipse(random(35/2 + 8, 35/2 + 6), random(1, 3), 11, 9);
}
pop();
}
function decHurricane(x, y) { push();
translate(x, y);
noStroke();
fill(255, 0, 0);
ellipse(0, 0, 30, 30);
fill(230);
ellipse(0, 0, 10, 10);
push();
scale(0.7);
translate(-40, 5);
stroke(255, 0, 0);
strokeWeight(5);
noFill();
beginShape();
for (var i = 2; i <= 4; i += 0.1) {
var y1 = Math.pow(2.6, i);
vertex(i*25, -y1);
}
endShape();
pop();
push();
scale(0.7);
stroke(255, 0, 0);
strokeWeight(5);
noFill();
translate(40, -5);
rotate(radians(180));
beginShape();
for (var i = 2; i <= 4; i += 0.1) {
var y1 = Math.pow(2.6, i);
vertex(i*25, -y1);
}
endShape();
pop();
pop();
}
The purpose of our project is to create an interactive calendar that displays important events, memes/jokes,
and or popular culture references to every month in 2020. Each program on its own is not very substantial,
but we aimed to incorporate as many programing elements from the semester as possible. It is a 2020 themed variety show!
The user-interface is a grid displaying the months of the year with instructions on how to access each month.
We have each month bound to a key, “1” through “=,” representing all 12 months.
When a particular key is pressed, the set of functions for the month run until the user presses the “esc” key to return to the main calendar.
The plans for my months are as follows:
Jan – Reference to the tension between the U.S. and North Korea at the tail end of 2019.
Feb – Pelosi Simulator: ripping President Trump’s speech at the State of the Union.
Mar – Object-oriented corona virus representation bouncing around a world map until it covers the U.S.
Apr – Something about Tiger King indeed.
May – Kim Jong Un hiding behind a podium after his health speculations .
Jun – President Trump removing protesters from St. John’s Church in Washington D.C.
We sincerely hope that 2021 is a much better year. Enjoy!