xxxxxxxxxx
102
/*
* Project 1
* Lost and Found
* Author: Jason Brill
* Partner: Xintong Wang
*/
/*
* Setup
*/
function setup() {
createCanvas(400, 400);
smooth(); // anti-alias
noLoop(); // otherwise blendMode freaks out
}
/*
* Draws an SD Card
*/
const drawSDCard = () => {
vertex(30, 20);
vertex(180,20);
vertex(180, 200);
vertex(20, 200);
vertex(20, 120);
vertex(30, 110);
vertex(30, 100);
vertex(20, 100);
vertex(20, 90);
vertex(30, 70);
}
/*
* Draw
*/
function draw() {
background(220);
noStroke();
fill(51);
push();
beginShape();
let sd1 = drawSDCard();
translate(0, 0);
endShape(CLOSE);
// Memory Graphics
fill(207,181,59);
rect(38, 25, 12, 32, 1);
rect(56, 25, 12, 32, 1);
rect(74, 25, 12, 32, 1);
rect(92, 23, 12, 34, 1);
rect(110, 25, 12, 32, 1);
rect(128, 23, 12, 34, 1);
rect(146, 25, 12, 32, 1);
rect(164, 25, 12, 32, 1);
fill(204, 204, 204);
// Serial No.
textSize(12);
text('BN163255080D', 65, 185);
pop();
push(); // push, draw, rotate 2nd sd card
beginShape();
let sd2 = drawSDCard();
blendMode(OVERLAY);
translate(300, 400);
rotate(radians(-270));
scale(-1.0,1.0);
endShape(CLOSE);
fill(157, 11, 11);
rect(105, 20, 75, 180);
rotate(radians(-270));
scale(-1.0,1.0);
fill(250);
push(); // push arc so nofill doesnt' affect text below
noFill();
stroke(255);
strokeWeight(2);
color(255);
arc(-172, -55, 20, 20, HALF_PI, TWO_PI);
pop();
textSize(13)
text('10', -180, -50);
textSize(15)
text('64', -180, -80);
textSize(12)
text('GB', -157, -80);
textSize(18);
text('SanDisk', -180, -150);
textStyle(ITALIC);
text('Ultra', -180, -130);
pop();
}