/* built with Studio Sketchpad:
* https://sketchpad.cc
*
* observe the evolution of this sketch:
* https://studio.sketchpad.cc/sp/pad/view/ro.N6iyRLvt0Ro/rev.12380
*
* authors:
* Benjamin Y
* Scienceby
* license (unless otherwise specified):
* creative commons attribution-share alike 3.0 license.
* https://creativecommons.org/licenses/by-sa/3.0/
*/
// Pressing Control-R will render this sketch.
// 10, 35, 60, 85 are position xy
// Scienceby
// scieneby
int i = 0;
String textx = "Periodic Table\n for the\n Elements";
int elnum = 0;
int periodnum = 1;
int groupnum = 1;
boolean atomiclabel = true;
boolean atomiclabelturn = true;
void setup() { // this is run once.
// set the background color
background(255);
// canvas size (Variable aren't evaluated. Integers only, please.)
size(500, 500);
// smooth edges
smooth();
// limit the number of frames per second
frameRate(30);
// set the width of the line.
strokeWeight(1);
// set stroke
//noStroke();
}
void draw() { // this is run repeatedly.
background(245);
fill(0);
textSize(9);
text("1A", 15, 10);
text("2A", 25+15, 10);
text("3B", 50+15, 10);
text("4B", 75+15, 10);
text("5B", 100+15, 10);
text("6B", 125+15, 10);
text("7B", 150+15, 10);
text("8B", 175+15, 10);
text("8B", 200+15, 10);
text("8B", 225+15, 10);
text("1B", 250+15, 10);
text("2B", 275+15, 10);
text("3A", 300+15, 10);
text("4A", 325+15, 10);
text("5A", 350+15, 10);
text("6A", 375+15, 10);
text("7A", 400+15, 10);
text("O", 425+15, 10);
text("1", 0, 25);
text("2", 0, 25+25);
text("3", 0, 50+25);
text("4", 0, 75+25);
text("5", 0, 100+25);
text("6", 0, 125+25);
text("7", 0, 150+25);
text("8", 0, 175+25);
text("9", 0, 200+25);
textSize(11);
text("s", 50, 30);
text("d", 150, 80);
text("p", 370, 30);
text("f", 140, 240);
if(atomiclabel) {
text(elnum, 10, 400);
}
textSize(14);
fill(255);//153);
rect(10, 10, 25, 25); // HYDROGEN
fill(255, 0, 0);// Alkali
rect(10, 35, 25, 25);
rect(10, 60, 25, 25);
rect(10, 85, 25, 25);
rect(10, 110, 25, 25);
rect(10, 135, 25, 25);
rect(10, 160, 25, 25);
text('Alkali Metals', 300, 350);
fill(255, 128, 0);// Alkaline earth
rect(35, 35, 25, 25);
rect(35, 60, 25, 25);
rect(35, 85, 25, 25);
rect(35, 110, 25, 25);
rect(35, 135, 25, 25);
rect(35, 160, 25, 25);
text('Alkaline Earth Metals', 300, 370);
fill(0, 204, 0);// Transition
rect(60, 85, 25, 25);
rect(60, 110, 25, 25);
rect(85, 85, 25, 25);
rect(85, 110, 25, 25);
rect(85, 135, 25, 25);
rect(110, 85, 25, 25);
rect(110, 110, 25, 25);
rect(110, 135, 25, 25);
rect(135, 85, 25, 25);
rect(135, 110, 25, 25);
rect(135, 135, 25, 25);
rect(160, 85, 25, 25);
rect(160, 110, 25, 25);
rect(160, 135, 25, 25);
rect(185, 85, 25, 25);
rect(185, 110, 25, 25);
rect(185, 135, 25, 25);
rect(210, 85, 25, 25);
rect(210, 110, 25, 25);
rect(210, 135, 25, 25);
rect(235, 85, 25, 25);
rect(235, 110, 25, 25);
rect(235, 135, 25, 25);
rect(260, 85, 25, 25);
rect(260, 110, 25, 25);
rect(260, 135, 25, 25);
rect(285, 85, 25, 25);
rect(285, 110, 25, 25);
rect(285, 135, 25, 25);
text('Transition Metals', 300, 390);
fill(128, 128, 0);// Metalloids
rect(310, 35, 25, 25);
rect(335, 60, 25, 25);
rect(335, 85, 25, 25);
rect(360, 85, 25, 25);
rect(360, 110, 25, 25);
rect(385, 110, 25, 25);
//rect(385, 135, 25, 25);
text('Metalloids', 300, 410);
fill(255, 204, 51);// Poor metals
rect(310, 60, 25, 25);
rect(310, 85, 25, 25);
rect(310, 110, 25, 25);
rect(310, 135, 25, 25);
rect(335, 110, 25, 25);
rect(335, 135, 25, 25);
rect(360, 135, 25, 25);
rect(385, 135, 25, 25);
text('Poor Metals', 300, 430);
fill(0, 128, 0);// Other nonmetals
rect(335, 35, 25, 25);
rect(360, 35, 25, 25);
rect(360, 60, 25, 25);
rect(385, 35, 25, 25);
rect(385, 60, 25, 25);
rect(385, 85, 25, 25);
text('Other Nonmetals', 300, 450);
fill(255, 128, 255);// Halogens
rect(410, 35, 25, 25);
rect(410, 60, 25, 25);
rect(410, 85, 25, 25);
rect(410, 110, 25, 25);
rect(410, 135, 25, 25);
text('Halogens', 300, 470);
fill(128, 0, 255);// Noble Gases
rect(435, 10, 25, 25);
rect(435, 35, 25, 25);
rect(435, 60, 25, 25);
rect(435, 85, 25, 25);
rect(435, 110, 25, 25);
rect(435, 135, 25, 25);
text('Noble Gases', 300, 490);
fill(204, 153, 255);// Lanthenides
rect(50, 250, 25, 25);
rect(75, 250, 25, 25);
rect(100, 250, 25, 25);
rect(125, 250, 25, 25);
rect(150, 250, 25, 25);// PROMETHIUM
rect(175, 250, 25, 25);
rect(200, 250, 25, 25);
rect(225, 250, 25, 25);// GADOLINIUM 8
rect(250, 250, 25, 25); //9
rect(275, 250, 25, 25);
rect(300, 250, 25, 25); //11
rect(325, 250, 25, 25);
rect(350, 250, 25, 25); // 13
rect(375, 250, 25, 25);
rect(400, 250, 25, 25);
fill(153, 25, 255);// Actinides
rect(50, 275, 25, 25);
rect(75, 275, 25, 25);
rect(100, 275, 25, 25);
rect(125, 275, 25, 25);
rect(150, 275, 25, 25);// PROMETHIUM
rect(175, 275, 25, 25);
rect(200, 275, 25, 25);
rect(225, 275, 25, 25);// GADOLINIUM 8
rect(250, 275, 25, 25); //9
rect(275, 275, 25, 25);
rect(300, 275, 25, 25); //11
rect(325, 275, 25, 25);
rect(350, 275, 25, 25); // 13
rect(375, 275, 25, 25);
rect(400, 275, 25, 25);
fill(204);// Superactinides
rect(50, 300, 25, 25);
rect(75, 300, 25, 25);
rect(100, 300, 25, 25);
rect(125, 300, 25, 25);
rect(150, 300, 25, 25);// PROMETHIUM
rect(175, 300, 25, 25);
rect(200, 300, 25, 25);
rect(225, 300, 25, 25);// GADOLINIUM 8
rect(250, 300, 25, 25); //9
rect(275, 300, 25, 25);
rect(300, 300, 25, 25); //11
rect(325, 300, 25, 25);
rect(350, 300, 25, 25); // 13
rect(375, 300, 25, 25);
rect(400, 300, 25, 25);
fill(128, 128, 255);
rect(85, 160, 25, 25);
rect(110, 160, 25, 25);
rect(135, 160, 25, 25);
rect(160, 160, 25, 25);
rect(185, 160, 25, 25);
rect(210, 160, 25, 25);
rect(235, 160, 25, 25);
rect(260, 160, 25, 25);
rect(285, 160, 25, 25);
rect(310, 160, 25, 25);
rect(335, 160, 25, 25);
rect(360, 160, 25, 25);
rect(385, 160, 25, 25);
rect(410, 160, 25, 25);
rect(435, 160, 25, 25);
fill(204);// Uue-Ubn, Uqu-Uhq
rect(10, 185, 25, 25);
rect(35, 185, 25, 25);
rect(10, 210, 25, 25);
rect(35, 210, 25, 25);
rect(85, 185, 25, 25);
rect(110, 185, 25, 25);
rect(135, 185, 25, 25);
rect(160, 185, 25, 25);
rect(185, 185, 25, 25);
rect(210, 185, 25, 25);
rect(235, 185, 25, 25);
rect(260, 185, 25, 25);
rect(285, 185, 25, 25);
rect(310, 210, 25, 25);
rect(335, 210, 25, 25);
rect(360, 210, 25, 25);
rect(385, 210, 25, 25);
rect(410, 210, 25, 25);
rect(435, 210, 25, 25);
// RADIOACTIVE
fill(255, 255, 0, 41);
rect(10, 160, 460-10, 25);
rect(10, 185, 310-10, 25);
rect(10, 210, 50, 25);
rect(310, 210, 460-310, 25);
rect(50, 275, 425-50, 50);
rect(160, 110, 25, 25);
rect(150, 250, 25, 25);
fill(0);
textSize(14)
text("H", 10+5, 35-5);
fill(255);
text("Li", 10+5, 60-5);
text("Na", 10+5, 85-5);
text("K", 10+5, 110-5);
text("Rb", 10+5, 135-5);
text("Cs", 10+5, 160-5);
text("Fr", 10+5, 185-5);
fill(0);
text("Be", 35+5, 60-5);
text("Mg", 35+5, 85-5);
text("Ca", 35+5, 110-5);
text("Sr", 35+5, 135-5);
text("Ba", 35+5, 160-5);
text("Ra", 35+5, 185-5);
text("Sc", 60+5, 110-5);
text("Y", 60+5, 135-5);
text("Ti", 85+5, 110-5);
text("Zr", 85+5, 135-5);
text("Hf", 85+5, 160-5);
text("Rf", 85+5, 185-5);
text("V", 110+5, 110-5);
text("Nb", 110+5, 135-5);
text("Ta", 110+5, 160-5);
text("Db", 110+5, 185-5);
text("Cr", 135+5, 110-5);
text("Mo", 135+5, 135-5);
text("W", 135+5, 160-5);
text("Sg", 135+5, 185-5);
text("Mn", 160+5, 110-5);
text("Tc", 160+5, 135-5);
text("Re", 160+5, 160-5);
text("Bh", 160+5, 185-5);
text("Fe", 185+5, 110-5);
text("Ru", 185+5, 135-5);
text("Os", 185+5, 160-5);
text("Hs", 185+5, 185-5);
text("Co", 210+5, 110-5);
text("Rh", 210+5, 135-5);
text("Ir", 210+5, 160-5);
text("Mt", 210+5, 185-5);
text("Ni", 235+5, 110-5);
text("Pd", 235+5, 135-5);
text("Pt", 235+5, 160-5);
text("Ds", 235+5, 185-5);
text("Cu", 260+5, 110-5);
text("Ag", 260+5, 135-5);
text("Au", 260+5, 160-5);
text("Rg", 260+5, 185-5);
text("Zn", 285+5, 110-5);
text("Cd", 285+5, 135-5);
text("Hg", 285+5, 160-5);
text("Cn", 285+5, 185-5);
fill(255);// Metalloids
text("B", 310+5, 60-5);
text("Si", 335+5, 85-5);
text("Ge", 335+5, 110-5);
text("As", 360+5, 110-5);
text("Sb", 360+5, 135-5);
text("Te", 385+5, 135-5);
// nonmetals
text("C", 335+5, 60-5);
text("N", 360+5, 60-5);
text("P", 360+5, 85-5);
text("O", 385+5, 60-5);
text("S", 385+5, 85-5);
text("Se", 385+5, 110-5);
fill(0);
text("Al", 310+5, 85-5);
text("Ga", 310+5, 110-5);
text("In", 310+5, 135-5);
text("Tl", 310+5, 160-5);
text("Uut", 310-1, 185-5);
text("Sn", 335+5, 135-5);
text("Pb", 335+5, 160-5);
text("Fl", 335+5, 185-5);
text("Bi", 360+5, 160-5);
text("Uup", 360-1, 185-5);
text("Po", 385+5, 160-5);
text("Lv", 385+5, 185-5);
// Halogens
text("F", 410+5, 60-5);
text("Cl", 410+5, 85-5);
text("Br", 410+5, 110-5);
text("I", 410+5, 135-5);
text("At", 410+5, 160-5);
text("Uus", 410-1, 185-5);
fill(255);
// Noble Gases
text("He", 435+5, 35-5);
text("Ne", 435+5, 60-5);
text("Ar", 435+5, 85-5);
text("Kr", 435+5, 110-5);
text("Xe", 435+5, 135-5);
text("Rn", 435+5, 160-5);
fill(0);
text("Uuo", 435-1, 185-5);
fill(0);
// Lanthenides
text("La", 50+5, 275-5);
text("Ce", 75+5, 275-5);
text("Pr", 100+5, 275-5);
text("Nd", 125+5, 275-5);
text("Pm", 150+5, 275-5);
text("Sm", 175+5, 275-5);
text("Eu", 200+5, 275-5);
text("Gd", 225+5, 275-5);
text("Tb", 250+5, 275-5);
text("Dy", 275+5, 275-5);
text("Ho", 300+5, 275-5);
text("Er", 325+5, 275-5);
text("Tm", 350+5, 275-5);
text("Yb", 375+5, 275-5);
text("Lu", 400+5, 275-5);
fill(255);
text("Ac", 50+5, 300-5);
text("Th", 75+5, 300-5);
text("Pa", 100+5, 300-5);
text("U", 125+5, 300-5);
text("Np", 150+5, 300-5);
text("Pu", 175+5, 300-5);
text("Am", 200+5, 300-5);
text("Cm", 225+5, 300-5);
text("Bk", 250+5, 300-5);
text("Cf", 275+5, 300-5);
text("Es", 300+5, 300-5);
text("Fm", 325+5, 300-5);
text("Md", 350+5, 300-5);
text("No", 375+5, 300-5);
text("Lr", 400+5, 300-5);
strokeWeight(2);
stroke(255, 0, 0);
line(310, 60, 335, 60);
line(335, 60, 335, 85);
line(335, 85, 360, 85);
line(360, 85, 360, 110);
line(360, 110, 385, 110);
line(385, 110, 385, 135);
strokeWeight(1);
noStroke();
fill(255, 255, 255, 75);
switch(elnum) {
case 1:
textx = 'Hydrogen,\n #1\n Weight: 1.00794';
rect(10, 0, 25, height);
rect(0, 10, width, 25);
break;
case 2:
textx = 'Helium,\n #2\n Weight: 4.002602';
rect(435, 0, 25, height);
rect(0, 10, width, 25);
break;
case 3:
textx = 'Lithium,\n #3\n Weight: 6.941';
rect(10, 0, 25, height);
rect(0, 35, width, 25);
break;
case 4:
textx = 'Beryllium,\n #4\n Weight: 9.0121831';
rect(35, 0, 25, height);
rect(0, 35, width, 25);
break;
case 5:
textx = 'Boron,\n #5\n Weight: 10.81';
rect(310, 0, 25, height);
rect(0, 35, width, 25);
break;
case 6:
textx = 'Carbon,\n #6\n Weight: 12.011';
rect(335, 0, 25, height);
rect(0, 35, width, 25);
break;
case 7:
textx = 'Nitrogen,\n #7\n Weight: 14.007';
rect(360, 0, 25, height);
rect(0, 35, width, 25);
break;
case 8:
textx = 'Oxygen,\n #8\n Weight: 15.999';
rect(385, 0, 25, height);
rect(0, 35, width, 25);
break;
case 9:
textx = 'Flourine,\n #9\n Weight: 18.998403163';
rect(410, 0, 25, height);
rect(0, 35, width, 25);
break;
case 10:
textx = 'Neon,\n #10\n Weight: 20.1797';
rect(435, 0, 25, height);
rect(0, 35, width, 25);
break;
case 11:
textx = 'Sodium,\n #11\n Weight: 22.98976928';
rect(10, 0, 25, height);
rect(0, 60, width, 25);
break;
case 12:
textx = 'Magnesium,\n #12\n Weight: 24.305';
rect(35, 0, 25, height);
rect(0, 60, width, 25);
break;
case 13:
textx = 'Aluminium,\n #13\n Weight: 26.9815385';
rect(310, 0, 25, height);
rect(0, 60, width, 25);
break;
case 14:
textx = 'Silicon,\n #14\n Weight: 28.085';
rect(335, 0, 25, height);
rect(0, 60, width, 25);
break;
case 15:
textx = 'Phosphorus,\n #15\n Weight: 30.973761998';
rect(360, 0, 25, height);
rect(0, 60, width, 25);
break;
case 16:
textx = 'Sulfur,\n #16\n Weight: 32.06';
rect(385, 0, 25, height);
rect(0, 60, width, 25);
break;
case 17:
textx = 'Chlorine,\n #17\n Weight: 35.45';
rect(410, 0, 25, height);
rect(0, 60, width, 25);
break;
case 18:
textx = 'Argon,\n #18\n Weight: 39.948';
rect(435, 0, 25, height);
rect(0, 60, width, 25);
break;
case 19:
textx = 'Potassium,\n #19\n Weight: 39.0983';
rect(10, 0, 25, height);
rect(0, 85, width, 25);
break;
case 20:
textx = 'Calcium,\n #20\n Weight: 40.078';
rect(35, 0, 25, height);
rect(0, 85, width, 25);
break;
case 21:
textx = 'Scandium,\n #21\n Weight: 44.955908';
rect(60, 0, 25, height);
rect(0, 85, width, 25);
break;
case 22:
textx = 'Titanium,\n #22\n Weight: 47.867';
rect(85, 0, 25, height);
rect(0, 85, width, 25);
break;
case 23:
textx = 'Vanadium,\n #23\n Weight: 50.9415';
rect(110, 0, 25, height);
rect(0, 85, width, 25);
break;
case 24:
textx = 'Chromium,\n #24\n Weight: 51.9961';
rect(135, 0, 25, height);
rect(0, 85, width, 25);
break;
case 25:
textx = 'Manganese,\n #25\n Weight: 54.938044';
rect(160, 0, 25, height);
rect(0, 85, width, 25);
break;
case 26:
textx = 'Iron,\n #26\n Weight: 55.545';
rect(185, 0, 25, height);
rect(0, 85, width, 25);
break;
case 27:
textx = 'Cobalt,\n #27\n Weight: 58.933194';
rect(210, 0, 25, height);
rect(0, 85, width, 25);
break;
case 28:
textx = 'Nickel,\n #28\n Weight: 58.6934';
rect(235, 0, 25, height);
rect(0, 85, width, 25);
break;
case 29:
textx = 'Copper,\n #29\n Weight: 63.546';
rect(260, 0, 25, height);
rect(0, 85, width, 25);
break;
case 30:
textx = 'Zinc,\n #30\n Weight: 65.38';
rect(285, 0, 25, height);
rect(0, 85, width, 25);
break;
case 31:
textx = 'Gallium,\n #31\n Weight: 69.723';
rect(310, 0, 25, height);
rect(0, 85, width, 25);
break;
case 32:
textx = 'Germanium,\n #32\n Weight: 72.63';
rect(335, 0, 25, height);
rect(0, 85, width, 25);
break;
case 33:
textx = 'Arsenic,\n #33\n Weight: 74.921595';
rect(360, 0, 25, height);
rect(0, 85, width, 25);
break;
case 34:
textx = 'Selenium,\n #34\n Weight: 78.971';
rect(385, 0, 25, height);
rect(0, 85, width, 25);
break;
case 35:
textx = 'Bromine,\n #35\n Weight: 79.904';
rect(410, 0, 25, height);
rect(0, 85, width, 25);
break;
case 36:
textx = 'Krypton,\n #36\n Weight: 83.798';
rect(435, 0, 25, height);
rect(0, 85, width, 25);
break;
case 37:
textx = 'Rubidium,\n #37\n Weight: 85.4678';
rect(10, 0, 25, height);
rect(0, 110, width, 25);
break;
case 38:
textx = 'Strontium,\n #38\n Weight: 87.62';
rect(35, 0, 25, height);
rect(0, 110, width, 25);
break;
case 39:
textx = 'Yttrium,\n #39\n Weight: 88.90584';
rect(60, 0, 25, height);
rect(0, 110, width, 25);
break;
case 40:
textx = 'Zirconium,\n #40\n Weight: 91.224';
rect(85, 0, 25, height);
rect(0, 110, width, 25);
break;
case 41:
textx = 'Niobium,\n #41\n Weight: 92.90637';
rect(110, 0, 25, height);
rect(0, 110, width, 25);
break;
case 42:
textx = 'Molybdenum,\n #42\n Weight: 95.95';
rect(135, 0, 25, height);
rect(0, 110, width, 25);
break;
case 43:
textx = 'Technetium,\n #43\n Weight: 98.9072';
rect(160, 0, 25, height);
rect(0, 110, width, 25);
break;
case 44:
textx = 'Ruthenium,\n #44\n Weight: 101.07';
rect(185, 0, 25, height);
rect(0, 110, width, 25);
break;
case 45:
textx = 'Rhodium,\n #45\n Weight: 102.90550';
rect(210, 0, 25, height);
rect(0, 110, width, 25);
break;
case 46:
textx = 'Palladium,\n #46\n Weight: 106.42';
rect(235, 0, 25, height);
rect(0, 110, width, 25);
break;
case 47:
textx = 'Silver,\n #47\n Weight: 107.8682';
rect(260, 0, 25, height);
rect(0, 110, width, 25);
break;
case 48:
textx = 'Cadmium,\n #48\n Weight: 112.414';
rect(285, 0, 25, height);
rect(0, 110, width, 25);
break;
case 49:
textx = 'Indium,\n #49\n Weight: 114.818';
rect(310, 0, 25, height);
rect(0, 110, width, 25);
break;
case 50:
textx = 'Tin,\n #50\n Weight: 118.710';
rect(335, 0, 25, height);
rect(0, 110, width, 25);
break;
case 51:
textx = 'Antimony,\n #51\n Weight: 121.760';
rect(360, 0, 25, height);
rect(0, 110, width, 25);
break;
case 52:
textx = 'Tellurium,\n #52\n Weight: 127.60';
rect(385, 0, 25, height);
rect(0, 110, width, 25);
break;
case 53:
textx = 'Iodine,\n #53\n Weight: 126.90447';
rect(410, 0, 25, height);
rect(0, 110, width, 25);
break;
case 54:
textx = 'Xenon,\n #54\n Weight: 131.293';
rect(435, 0, 25, height);
rect(0, 110, width, 25);
break;
case 55:
textx = 'Caesium,\n #55\n Weight: 132.90545196';
rect(10, 0, 25, height);
rect(0, 135, width, 25);
break;
case 56:
textx = 'Barium,\n #56\n Weight: 137.327';
rect(35, 0, 25, height);
rect(0, 135, width, 25);
break;
case 57:
textx = 'Lanthanum,\n #57\n Weight: 138.90547';
rect(50, 0, 25, height);
rect(0, 250, width, 25);
break;
case 58:
textx = 'Cerium,\n #58\n Weight: 140.116';
rect(75, 0, 25, height);
rect(0, 250, width, 25);
break;
case 59:
textx = 'Praseodymium,\n #59\n Weight: 140.90766';
rect(100, 0, 25, height);
rect(0, 250, width, 25);
break;
case 60:
textx = 'Neodymium,\n #60\n Weight: 140.90766';
rect(125, 0, 25, height);
rect(0, 250, width, 25);
break;
case 61:
textx = 'Promethium,\n #61\n Weight: 144.9127';
rect(150, 0, 25, height);
rect(0, 250, width, 25);
break;
case 62:
textx = 'Samarium,\n #62\n Weight: 150.36';
rect(175, 0, 25, height);
rect(0, 250, width, 25);
break;
case 63:
textx = 'Europium,\n #63\n Weight: 151.964';
rect(200, 0, 25, height);
rect(0, 250, width, 25);
break;
case 64:
textx = 'Gadolinium,\n #64\n Weight: 157.25';
rect(225, 0, 25, height);
rect(0, 250, width, 25);
break;
case 65:
textx = 'Terbium,\n #65\n Weight: 158.92535';
rect(250, 0, 25, height);
rect(0, 250, width, 25);
break;
case 66:
textx = 'Dysprosium,\n #66\n Weight: 162.500';
rect(275, 0, 25, height);
rect(0, 250, width, 25);
break;
case 67:
textx = 'Holmium,\n #67\n Weight: 164.93033';
rect(300, 0, 25, height);
rect(0, 250, width, 25);
break;
case 68:
textx = 'Erbium,\n #68\n Weight: 167.259';
rect(325, 0, 25, height);
rect(0, 250, width, 25);
break;
case 69:
textx = 'Thulium,\n #69\n Weight: 168.93422';
rect(350, 0, 25, height);
rect(0, 250, width, 25);
break;
case 70:
textx = 'Ytterbium,\n #70\n Weight: 173.054';
rect(375, 0, 25, height);
rect(0, 250, width, 25);
break;
case 71:
textx = 'Lutetium,\n #71\n Weight: 174.9668';
rect(400, 0, 25, height);
rect(0, 250, width, 25);
break;
case 72:
textx = 'Hafnium,\n #72\n Weight: 178.49';
rect(85, 0, 25, height);
rect(0, 135, width, 25);
break;
case 73:
textx = 'Tantalum,\n #73\n Weight: 180.94788';
rect(110, 0, 25, height);
rect(0, 135, width, 25);
break;
case 74:
textx = 'Tungsten,\n #74\n Weight: 183.84';
rect(135, 0, 25, height);
rect(0, 135, width, 25);
break;
case 75:
textx = 'Rhenium,\n #75\n Weight: 186.207';
rect(160, 0, 25, height);
rect(0, 135, width, 25);
break;
case 76:
textx = 'Osmium,\n #76\n Weight: 190.23';
rect(185, 0, 25, height);
rect(0, 135, width, 25);
break;
case 77:
textx = 'Iridium,\n #77\n Weight: 192.217';
rect(210, 0, 25, height);
rect(0, 135, width, 25);
break;
case 78:
textx = 'Platinum,\n #78\n Weight: 195.084';
rect(235, 0, 25, height);
rect(0, 135, width, 25);
break;
case 79:
textx = 'Gold,\n #79\n Weight: 196.966569';
rect(260, 0, 25, height);
rect(0, 135, width, 25);
break;
case 80:
textx = 'Mercury,\n #80\n Weight: 200.59';
rect(285, 0, 25, height);
rect(0, 135, width, 25);
break;
case 81:
textx = 'Thallium,\n #81\n Weight: 204.38';
rect(310, 0, 25, height);
rect(0, 135, width, 25);
break;
case 82:
textx = 'Lead,\n #82\n Weight: 207.2';
rect(335, 0, 25, height);
rect(0, 135, width, 25);
break;
case 83:
textx = 'Bismuth,\n #83\n Weight: 208.98037';
rect(360, 0, 25, height);
rect(0, 135, width, 25);
break;
case 84:
textx = 'Polonium,\n #84\n Weight: 208.9824';
rect(385, 0, 25, height);
rect(0, 135, width, 25);
break;
case 85:
textx = 'Astatine,\n #85\n Weight: 209.9871';
rect(410, 0, 25, height);
rect(0, 135, width, 25);
break;
case 86:
textx = 'Radon,\n #86\n Weight: 222.0176';
rect(435, 0, 25, height);
rect(0, 10, width, 25);
break;
case 87:
textx = 'Francium,\n #87\n Weight: 223.0197';
rect(10, 0, 25, height);
rect(0, 160, width, 25);
break;
case 88:
textx = 'Radium,\n #88\n Weight: 226.0254';
rect(35, 0, 25, height);
rect(0, 160, width, 25);
break;
case 89:
textx = 'Actinium,\n #89\n Weight: 227.0278';
rect(50, 0, 25, height);
rect(0, 275, width, 25);
break;
case 90:
textx = 'Thorium,\n #90\n Weight: 232.0381';
rect(75, 0, 25, height);
rect(0, 275, width, 25);
break;
case 91:
textx = 'Protactinium,\n #91\n Weight: 231.03588';
rect(100, 0, 25, height);
rect(0, 275, width, 25);
break;
case 92:
textx = 'Uranium,\n #92\n Weight: 238.02891';
rect(125, 0, 25, height);
rect(0, 275, width, 25);
break;
case 93:
textx = 'Neptunium,\n #93\n Weight: 237.0482';
rect(150, 0, 25, height);
rect(0, 275, width, 25);
break;
case 94:
textx = 'Plutonium,\n #94\n Weight: 244.0642';
rect(175, 0, 25, height);
rect(0, 275, width, 25);
break;
case 95:
textx = 'Americium,\n #95\n Weight: 243.0614';
rect(200, 0, 25, height);
rect(0, 275, width, 25);
break;
case 96:
textx = 'Curium,\n #96\n Weight: 247.0703';
rect(225, 0, 25, height);
rect(0, 275, width, 25);
break;
case 97:
textx = 'Berkelium,\n #97\n Weight: 247.0703';
rect(250, 0, 25, height);
rect(0, 275, width, 25);
break;
case 98:
textx = 'Californium,\n #98\n Weight: 251.0796';
rect(275, 0, 25, height);
rect(0, 275, width, 25);
break;
case 99:
textx = 'Einsteinium,\n #99\n Weight: 252.083';
rect(300, 0, 25, height);
rect(0, 275, width, 25);
break;
case 100:
textx = 'Fermium,\n #100\n Weight: 257.0951';
rect(325, 0, 25, height);
rect(0, 275, width, 25);
break;
case 101:
textx = 'Mendeleevium,\n #101\n Weight: 258.10';
rect(350, 0, 25, height);
rect(0, 275, width, 25);
break;
case 102:
textx = 'Nobelium,\n #102\n Weight: 259.1009';
rect(375, 0, 25, height);
rect(0, 275, width, 25);
break;
case 103:
textx = 'Lawrencium,\n #103\n Weight: 262.11';
rect(400, 0, 25, height);
rect(0, 275, width, 25);
break;
case 104:
textx = 'Rutherfordium,\n #104\n Weight: 261.11';
rect(85, 0, 25, height);
rect(0, 160, width, 25);
break;
case 105:
textx = 'Dubnium,\n #105\n Weight: 262.114';
rect(110, 0, 25, height);
rect(0, 160, width, 25);
break;
case 106:
textx = 'Seaborgium,\n #106\n Weight: 263.118';
rect(135, 0, 25, height);
rect(0, 160, width, 25);
break;
case 107:
textx = 'Bohrium,\n #107\n Weight: 262.12';
rect(160, 0, 25, height);
rect(0, 160, width, 25);
break;
case 108:
textx = 'Hassium,\n #108\n Weight: (270)';
rect(185, 0, 25, height);
rect(0, 160, width, 25);
break;
case 109:
textx = 'Meintnerium,\n #109\n Weight: (276)';
rect(210, 0, 25, height);
rect(0, 160, width, 25);
break;
case 110:
textx = 'Darmstadtium,\n #110\n Weight: (281)';
rect(235, 0, 25, height);
rect(0, 160, width, 25);
break;
case 111:
textx = 'Roentgenium,\n #112\n Weight: (280)';
rect(260, 0, 25, height);
rect(0, 160, width, 25);
break;
case 112:
textx = 'Copernicium,\n #112\n Weight: (285)';
rect(285, 0, 25, height);
rect(0, 160, width, 25);
break;
case 113:
textx = 'Ununtrium,\n #113\n Weight: (284)';
rect(310, 0, 25, height);
rect(0, 160, width, 25);
break;
case 114:
textx = 'Flerovium,\n #114\n Weight: (289)';
rect(335, 0, 25, height);
rect(0, 160, width, 25);
break;
case 115:
textx = 'Ununpentium,\n #115\n Weight: (288)';
rect(360, 0, 25, height);
rect(0, 160, width, 25);
break;
case 116:
textx = 'Livermorium,\n #116\n Weight: (293)';
rect(385, 0, 25, height);
rect(0, 160, width, 25);
break;
case 117:
textx = 'Ununseptium,\n #117\n Weight: (294)';
rect(410, 0, 25, height);
rect(0, 160, width, 25);
break;
case 118:
textx = 'Ununoctium,\n #118\n Weight: (294)';
rect(435, 0, 25, height);
rect(0, 160, width, 25);
break;
//default:
// textx = 'Periodic Table of the\n Elements 1 to 118, V1.9.6';
// break;
}
fill(0);
textSize(36);
text(textx, 35, 400);
if ((mouseX < 35 && mouseX >= 10) && (mouseY < 35 && mouseY >= 10)) {
elnum = 1;
}
else if ((mouseX < 460 && mouseX >= 435) && (mouseY < 35 && mouseY >= 10)) {
elnum = 2;
}
else if ((mouseX < 35 && mouseX >= 10) && (mouseY < 60 && mouseY >= 35)) {
elnum = 3;
}
else if ((mouseX < 60 && mouseX >= 35) && (mouseY < 60 && mouseY >= 35)) {
elnum = 4;
}
else if ((mouseX < 335 && mouseX >= 310) && (mouseY < 60 && mouseY >= 35)) {
elnum = 5;
}
else if ((mouseX < 360 && mouseX >= 335) && (mouseY < 60 && mouseY >= 35)) {
elnum = 6;
}
else if ((mouseX < 385 && mouseX >= 360) && (mouseY < 60 && mouseY >= 35)) {
elnum = 7;
}
else if ((mouseX < 410 && mouseX >= 385) && (mouseY < 60 && mouseY >= 35)) {
elnum = 8;
}
else if ((mouseX < 435 && mouseX >= 410) && (mouseY < 60 && mouseY >= 35)) {
elnum = 9;
}
else if ((mouseX < 460 && mouseX >= 435) && (mouseY < 60 && mouseY >= 35)) {
elnum = 10;
}
else if ((mouseX < 35 && mouseX >= 10) && (mouseY < 85 && mouseY >= 60)) {
elnum = 11;
}
else if ((mouseX < 60 && mouseX >= 35) && (mouseY < 85 && mouseY >= 60)) {
elnum = 12;
}
else if ((mouseX < 335 && mouseX >= 310) && (mouseY < 85 && mouseY >= 60)) {
elnum = 13;
}
else if ((mouseX < 360 && mouseX >= 335) && (mouseY < 85 && mouseY >= 60)) {
elnum = 14;
}
else if ((mouseX < 385 && mouseX >= 360) && (mouseY < 85 && mouseY >= 60)) {
elnum = 15;
}
else if ((mouseX < 410 && mouseX >= 385) && (mouseY < 85 && mouseY >= 60)) {
elnum = 16;
}
else if ((mouseX < 435 && mouseX >= 410) && (mouseY < 85 && mouseY >= 60)) {
elnum = 17;
}
else if ((mouseX < 460 && mouseX >= 435) && (mouseY < 85 && mouseY >= 60)) {
elnum = 18;
}
else if ((mouseX < 35 && mouseX >= 10) && (mouseY < 110 && mouseY >= 85)) {
elnum = 19;
}
else if ((mouseX < 60 && mouseX >= 35) && (mouseY < 110 && mouseY >= 85)) {
elnum = 20;
}
else if ((mouseX < 85 && mouseX >= 60) && (mouseY < 110 && mouseY >= 85)) {
elnum = 21;
}
else if ((mouseX < 110 && mouseX >= 85) && (mouseY < 110 && mouseY >= 85)) {
elnum = 22;
}
else if ((mouseX < 135 && mouseX >= 110) && (mouseY < 110 && mouseY >= 85)) {
elnum = 23;
}
else if ((mouseX < 160 && mouseX >= 135) && (mouseY < 110 && mouseY >= 85)) {
elnum = 24;
}
else if ((mouseX < 185 && mouseX >= 160) && (mouseY < 110 && mouseY >= 85)) {
elnum = 25;
}
else if ((mouseX < 210 && mouseX >= 185) && (mouseY < 110 && mouseY >= 85)) {
elnum = 26;
}
else if ((mouseX < 235 && mouseX >= 210) && (mouseY < 110 && mouseY >= 85)) {
elnum = 27;
}
else if ((mouseX < 260 && mouseX >= 235) && (mouseY < 110 && mouseY >= 85)) {
elnum = 28;
}
else if ((mouseX < 285 && mouseX >= 260) && (mouseY < 110 && mouseY >= 85)) {
elnum = 29;
}
else if ((mouseX < 310 && mouseX >= 285) && (mouseY < 110 && mouseY >= 85)) {
elnum = 30;
}
else if ((mouseX < 335 && mouseX >= 310) && (mouseY < 110 && mouseY >= 85)) {
elnum = 31;
} else if ((mouseX < 360 && mouseX >= 335) && (mouseY < 110 && mouseY >= 85)) {
elnum = 32;
}
else if ((mouseX < 385 && mouseX >= 360) && (mouseY < 110 && mouseY >= 85)) {
elnum = 33;
}
else if ((mouseX < 410 && mouseX >= 385) && (mouseY < 110 && mouseY >= 85)) {
elnum = 34;
}
else if ((mouseX < 435 && mouseX >= 410) && (mouseY < 110 && mouseY >= 85)) {
elnum = 35;
}
else if ((mouseX < 460 && mouseX >= 435) && (mouseY < 110 && mouseY >= 85)) {
elnum = 36;
}
else if ((mouseX < 35 && mouseX >= 10) && (mouseY < 135 && mouseY >= 110)) {
elnum = 37;
}
else if ((mouseX < 60 && mouseX >= 35) && (mouseY < 135 && mouseY >= 110)) {
elnum = 38;
}
else if ((mouseX < 85 && mouseX >= 60) && (mouseY < 135 && mouseY >= 110)) {
elnum = 39;
}
else if ((mouseX < 110 && mouseX >= 85) && (mouseY < 135 && mouseY >= 110)) {
elnum = 40;
}
else if ((mouseX < 135 && mouseX >= 110) && (mouseY < 135 && mouseY >= 110)) {
elnum = 41;
}
else if ((mouseX < 160 && mouseX >= 135) && (mouseY < 135 && mouseY >= 110)) {
elnum = 42;
}
else if ((mouseX < 185 && mouseX >= 160) && (mouseY < 135 && mouseY >= 110)) {
elnum = 43;
}
else if ((mouseX < 210 && mouseX >= 185) && (mouseY < 135 && mouseY >= 110)) {
elnum = 44;
}
else if ((mouseX < 235 && mouseX >= 210) && (mouseY < 135 && mouseY >= 110)) {
elnum = 45;
}
else if ((mouseX < 260 && mouseX >= 235) && (mouseY < 135 && mouseY >= 110)) {
elnum = 46;
}
else if ((mouseX < 285 && mouseX >= 260) && (mouseY < 135 && mouseY >= 110)) {
elnum = 47;
}
else if ((mouseX < 310 && mouseX >= 285) && (mouseY < 135 && mouseY >= 110)) {
elnum = 48;
}
else if ((mouseX < 335 && mouseX >= 310) && (mouseY < 135 && mouseY >= 110)) {
elnum = 49;
} else if ((mouseX < 360 && mouseX >= 335) && (mouseY < 135 && mouseY >= 110)) {
elnum = 50;
}
else if ((mouseX < 385 && mouseX >= 360) && (mouseY < 135 && mouseY >= 110)) {
elnum = 51;
}
else if ((mouseX < 410 && mouseX >= 385) && (mouseY < 135 && mouseY >= 110)) {
elnum = 52;
}
else if ((mouseX < 435 && mouseX >= 410) && (mouseY < 135 && mouseY >= 110)) {
elnum = 53;
}
else if ((mouseX < 460 && mouseX >= 435) && (mouseY < 135 && mouseY >= 110)) {
elnum = 54;
}
else if ((mouseX < 35 && mouseX >= 10) && (mouseY < 160 && mouseY >= 135)) {
elnum = 55;
}
else if ((mouseX < 60 && mouseX >= 35) && (mouseY < 160 && mouseY >= 135)) {
elnum = 56;
}
else if ((mouseX < 75 && mouseX >= 50) && (mouseY < 275 && mouseY >= 250)) {
elnum = 57;
}
else if ((mouseX < 100 && mouseX >= 75) && (mouseY < 275 && mouseY >= 250)) {
elnum = 58;
}
else if ((mouseX < 125 && mouseX >= 100) && (mouseY < 275 && mouseY >= 250)) {
elnum = 59;
}
else if ((mouseX < 150 && mouseX >= 125) && (mouseY < 275 && mouseY >= 250)) {
elnum = 60;
}
else if ((mouseX < 175 && mouseX >= 150) && (mouseY < 275 && mouseY >= 250)) {
elnum = 61;
}
else if ((mouseX < 200 && mouseX >= 175) && (mouseY < 275 && mouseY >= 250)) {
elnum = 62;
}
else if ((mouseX < 225 && mouseX >= 200) && (mouseY < 275 && mouseY >= 250)) {
elnum = 63;
}
else if ((mouseX < 250 && mouseX >= 225) && (mouseY < 275 && mouseY >= 250)) {
elnum = 64;
}
else if ((mouseX < 275 && mouseX >= 250) && (mouseY < 275 && mouseY >= 250)) {
elnum = 65;
}
else if ((mouseX < 300 && mouseX >= 275) && (mouseY < 275 && mouseY >= 250)) {
elnum = 66;
}
else if ((mouseX < 325 && mouseX >= 300) && (mouseY < 275 && mouseY >= 250)) {
elnum = 67;
}
else if ((mouseX < 350 && mouseX >= 325) && (mouseY < 275 && mouseY >= 250)) {
elnum = 68;
}
else if ((mouseX < 375 && mouseX >= 350) && (mouseY < 275 && mouseY >= 250)) {
elnum = 69;
}
else if ((mouseX < 400 && mouseX >= 375) && (mouseY < 275 && mouseY >= 250)) {
elnum = 70;
}
else if ((mouseX < 425 && mouseX >= 400) && (mouseY < 275 && mouseY >= 250)) {
elnum = 71;
}
else if ((mouseX < 110 && mouseX >= 85) && (mouseY < 160 && mouseY >= 135)) {
elnum = 72;
}
else if ((mouseX < 135 && mouseX >= 110) && (mouseY < 160 && mouseY >= 110)) {
elnum = 73;
}
else if ((mouseX < 160 && mouseX >= 135) && (mouseY < 160 && mouseY >= 135 )){
elnum = 74;
}
else if ((mouseX < 185 && mouseX >= 160) && (mouseY < 160 && mouseY >= 135)) {
elnum = 75;
}
else if ((mouseX < 210 && mouseX >= 185) && (mouseY < 160 && mouseY >= 135)) {
elnum = 76;
}
else if ((mouseX < 235 && mouseX >= 210) && (mouseY < 160 && mouseY >= 135)) {
elnum = 77;
}
else if ((mouseX < 260 && mouseX >= 235) && (mouseY < 160 && mouseY >= 135)) {
elnum = 78;
}
else if ((mouseX < 285 && mouseX >= 260) && (mouseY < 160 && mouseY >= 135)) {
elnum = 79;
}
else if ((mouseX < 310 && mouseX >= 285) && (mouseY < 160 && mouseY >= 135)) {
elnum = 80;
}
else if ((mouseX < 335 && mouseX >= 310) && (mouseY < 160 && mouseY >= 135)) {
elnum = 81;
} else if ((mouseX < 360 && mouseX >= 335) && (mouseY < 160 && mouseY >= 135)) {
elnum = 82;
}
else if ((mouseX < 385 && mouseX >= 360) && (mouseY < 160 && mouseY >= 135)) {
elnum = 83;
}
else if ((mouseX < 410 && mouseX >= 385) && (mouseY < 160 && mouseY >= 135)) {
elnum = 84;
}
else if ((mouseX < 435 && mouseX >= 410) && (mouseY < 160 && mouseY >= 135)) {
elnum = 85;
}
else if ((mouseX < 460 && mouseX >= 435) && (mouseY < 160 && mouseY >= 135)) {
elnum = 86;
}
else if ((mouseX < 35 && mouseX >= 10) && (mouseY < 185 && mouseY >= 160)) {
elnum = 87;
}
else if ((mouseX < 60 && mouseX >= 35) && (mouseY < 185 && mouseY >= 160)) {
elnum = 88;
}
else if ((mouseX < 75 && mouseX >= 50) && (mouseY < 300 && mouseY >= 275)) {
elnum = 89;
}
else if ((mouseX < 100 && mouseX >= 75) && (mouseY < 300 && mouseY >= 275)) {
elnum = 90;
}
else if ((mouseX < 125 && mouseX >= 100) && (mouseY < 300 && mouseY >= 275)) {
elnum = 91;
}
else if ((mouseX < 150 && mouseX >= 125) && (mouseY < 300 && mouseY >= 275)) {
elnum = 92;
}
else if ((mouseX < 175 && mouseX >= 150) && (mouseY < 300 && mouseY >= 275)) {
elnum = 93;
}
else if ((mouseX < 200 && mouseX >= 175) && (mouseY < 300 && mouseY >= 275)) {
elnum = 94;
}
else if ((mouseX < 225 && mouseX >= 200) && (mouseY < 300 && mouseY >= 275)) {
elnum = 95;
}
else if ((mouseX < 250 && mouseX >= 225) && (mouseY < 300 && mouseY >= 275)) {
elnum = 96;
}
else if ((mouseX < 275 && mouseX >= 250) && (mouseY < 300 && mouseY >= 275)) {
elnum = 97;
}
else if ((mouseX < 300 && mouseX >= 275) && (mouseY < 300 && mouseY >= 275)) {
elnum = 98;
}
else if ((mouseX < 325 && mouseX >= 300) && (mouseY < 300 && mouseY >= 275)) {
elnum = 99;
}
else if ((mouseX < 350 && mouseX >= 325) && (mouseY < 300 && mouseY >= 275)) {
elnum = 100;
}
else if ((mouseX < 375 && mouseX >= 350) && (mouseY < 300 && mouseY >= 275)) {
elnum = 101;
}
else if ((mouseX < 400 && mouseX >= 375) && (mouseY < 300 && mouseY >= 275)) {
elnum = 102;
}
else if ((mouseX < 425 && mouseX >= 400) && (mouseY < 300 && mouseY >= 275)) {
elnum = 103;
}
else if ((mouseX < 110 && mouseX >= 85) && (mouseY < 185 && mouseY >= 160)) {
elnum = 104;
}
else if ((mouseX < 135 && mouseX >= 110) && (mouseY < 185 && mouseY >= 160)) {
elnum = 105;
}
else if ((mouseX < 160 && mouseX >= 135) && (mouseY < 185 && mouseY >= 160)) {
elnum = 106;
}
else if ((mouseX < 185 && mouseX >= 160) && (mouseY < 185 && mouseY >= 160)) {
elnum = 107;
}
else if ((mouseX < 210 && mouseX >= 185) && (mouseY < 185 && mouseY >= 160)) {
elnum = 108;
}
else if ((mouseX < 235 && mouseX >= 210) && (mouseY < 185 && mouseY >= 160)) {
elnum = 109;
}
else if ((mouseX < 260 && mouseX >= 235) && (mouseY < 185 && mouseY >= 160)) {
elnum = 110;
}
else if ((mouseX < 285 && mouseX >= 260) && (mouseY < 185 && mouseY >= 160)) {
elnum = 111;
}
else if ((mouseX < 310 && mouseX >= 285) && (mouseY < 185 && mouseY >= 160)) {
elnum = 112;
}
else if ((mouseX < 335 && mouseX >= 310) && (mouseY < 185 && mouseY >= 160)) {
elnum = 113;
}
else if ((mouseX < 360 && mouseX >= 335) && (mouseY < 185 && mouseY >= 160)) {
elnum = 114;
}
else if ((mouseX < 385 && mouseX >= 360) && (mouseY < 185 && mouseY >= 160)) {
elnum = 115;
}
else if ((mouseX < 410 && mouseX >= 385) && (mouseY < 185 && mouseY >= 160)) {
elnum = 116;
}
else if ((mouseX < 435 && mouseX >= 410) && (mouseY < 185 && mouseY >= 160)) {
elnum = 117;
}
else if ((mouseX < 460 && mouseX >= 435) && (mouseY < 185 && mouseY >= 160)) {
elnum = 118;
}
else {
elnum = 0;
}
// GROUPNUM
fill(255, 255, 255, 100);
rect(10+groupnum*25, 0, 25, height);
}
void MousePressed() {/*
if ((mouseX < 35 && mouseX > 10) && (mouseY < 35 && mouseY > 10)) {
elnum = 1;
}
else if ((mouseX < 35 && mouseX > 10) && (mouseY < 60 && mouseY > 35)) {
elnum = 3;
}
else {
elnum = 0;
*/
}
void keyPressed() {
switch(key) {
case 'q':
case 'Q':
if(atomiclabelturn) {
if(atomiclabel) {
atomiclabel = false;
} else {
atomiclabel = true;
}
// toggle atomiclabels
}
break;
case CODED:
switch(keyCode) {
case LEFT:
if(!groupnum == 1) {
groupnum -= 1;
}
break;
case RIGHT:
if(!groupnum == 18) {
groupnum += 1;
}
break;
}
}
}