Your browser does not support the canvas tag.

previous        Show / Hide Source        Download        next
/*****************************************
*File Name: Excalibur
*Creator: Emma Butson
*Date: September 21st 2016
*Description: Moving the mouse vertically moves the sword out of the stone.
*When the sword rises upward beams of light appear in the background
*a mouse click writes that line by Thomas Mallory that Disney also quotes
*Ideally the sword would begin in the stone upon launch but I digress
*****************************************/

//Set up size of screen
void setup () {
size(400,400);
}
//Background is dark grey
void draw () {
background(30);
rectMode(CORNER);
ellipseMode(CENTER);
noStroke();

//triangles represent light beams
//Triangles become more opaque the closer the mouse is to the top of the screen
fill(255,255,255,150-mouseY);
triangle(200,250,400,50,400,200);
triangle(200,250,0,50,0,200);

/**********************
SWORD
***********************/

// top of stone
fill(50);
quad(70,350,200,320,330,350,200,380);

//further half of the slot
fill(0);
rect(175,345,50,5);

// light squares Pommel
fill(233,162,80);
rect(190,mouseY/2-50,10,10);
rect(180,mouseY/2-40,10,10);
rect(200,mouseY/2-40,10,10);
rect(210,mouseY/2-40,10,10);

//pommel shine
fill(251,190,101);
rect(190,mouseY/2-40,10,10);
rect(200,mouseY/2-50,10,10);

//light squares on grip (left side)
fill(130,100,130);
rect(190,mouseY/2-30,10,50);

//light squares on grip (right side
fill(150,120,150);
rect(200,mouseY/2-30,10,50);

//dark squares on grip (right side)
fill(95,70,100);
rect(200,mouseY/2-30,10,20);
rect(200,mouseY/2+10,10,20);

//dark squares on grip (left side)
fill(75,50,90);
rect(190,mouseY/2+20,10,10);
rect(190,mouseY/2-20,10,20);

//light squares Guard
fill(253,206,128);
rect(140,mouseY/2+30,120,10);

//dark squares Guard
fill(242,158,114);
rect(150,mouseY/2+40,100,10);

//guard shadow
fill(80,15,30);
rect(180,mouseY/2+50,40,10);

//light half of the blade
fill(160,220,230);
rect(200,mouseY/2+60,20,190);

//tip of the light half of blade
rect(200,mouseY/2+250,10,20);

//vertical shadow along blade
fill(70,130,140);
rect(190,mouseY/2+60,10,210);

//left side of blade
fill(80,140,150);
rect(180,mouseY/2+60,10,190);

//shine on the blade right side of blade
//thought: can the shine stay still and transparent and move along blade during blade movement? 09/18/16
//the answer is no, not today 09/20/16
fill(255,250,230,150);
rect(210,mouseY/2+80,10,20);
rect(210,mouseY/2+140,10,20);
rect(200,mouseY/2+150,10,20);
rect(200,mouseY/2+90,10,20);

//shine on left side of blade
fill(255,250,230,50);
rect(190,mouseY/2+170,10,20);
rect(180,mouseY/2+180,10,20);
rect(190,mouseY/2+110,10,20);
rect(180,mouseY/2+120,10,20);

/************************
END SWORD
************************/

//stone cover
fill(50);
rect(70,350,260,50);

//closer side of slot
fill(0);
rect(175,350,50,5);

//front left side of stone
fill(25);
quad(70,350, 200,380, 200,400, 70, 400);

//front right side of stone
fill(75);
quad(200,380,330,350,330,400,200,400);
}

void mousePressed() {
println("Whoso pulleth out this sword of this stone and anvil, is rightwise King of all England");
}