/*Touch the Stars
Creator: Saneliso Dube
Into to Media Computation
Sept 17 2018
Instructor: Nicolas Hesler
How to Use:
rocket ship works as a cursor, travel the milkyway as you please
click to see the pictures in the stars
press any key to see a nice message
*/
void setup() {
//Set Canvas Size
size(400, 400);
//remove cursor for smoother feel
noCursor();
}
void draw() {
//set initial frame rate
frameRate(60);
//set darker background colour
background(13, 6, 40);
//create colour change effect
//lighter colour
fill(33, 41, 92, mouseY+85);
rect(0, 0, 400, 400);
//create clean shape aesthetic
noStroke();
//the sun - fades as you get further away
fill(249, 227, 127, mouseY-150);
ellipse(200, 400, 450, 20);
//Background Stars and Constellations
//sin + cos makes the stars srink making a twinke effect at different frame speeds
//sin/cos code adapted from Steven_Universe_Temple-2017
//star colour
fill(229, 233, 236);
//Cepheus
ellipse(80, 120, (cos(20+frameCount/16.65)*5), (cos(20+frameCount/16.65)*5));
ellipse(50, 130, (sin(20+frameCount/16.65)*5), (sin(20+frameCount/16.65)*5));
ellipse(70, 145, (sin(20+frameCount/20.04)*5), (sin(20+frameCount/20.04)*5));
ellipse(30, 150, (cos(20+frameCount/20.04)*5), (cos(20+frameCount/20.04)*5));
ellipse(50, 170, (sin(20+frameCount/20.65)*5), (sin(20+frameCount/20.65)*5));
//Coma Berencies
ellipse(340, 280, (cos(20+frameCount/20.65)*5), (cos(20+frameCount/20.65)*5));
ellipse(310, 310, (sin(20+frameCount/16.65)*5), (sin(20+frameCount/16.65)*5));
ellipse(335, 340, (cos(20+frameCount/16.65)*5), (cos(20+frameCount/16.65)*5));
//ursa major
ellipse(390, 80, (cos(20+frameCount/22.33)*5), (cos(20+frameCount/22.33)*5));
ellipse(385, 90, (sin(20+frameCount/22.33)*5), (sin(20+frameCount/22.33)*5));
ellipse(370, 95, (cos(20+frameCount/14.33)*5), (cos(20+frameCount/14.33)*5));
ellipse(360, 80, (sin(20+frameCount/14.33)*5), (sin(20+frameCount/14.33)*5));
ellipse(350, 90, (sin(20+frameCount/23.65)*5), (sin(20+frameCount/23.65)*5));
ellipse(345, 110, (cos(20+frameCount/23.65)*5), (cos(20+frameCount/23.65)*5));
ellipse(340, 140, (sin(20+frameCount/18.65)*5), (sin(20+frameCount/18.65)*5));
ellipse(330, 170, (cos(20+frameCount/18.65)*5), (cos(20+frameCount/18.65)*5));
ellipse(310, 190, (cos(20+frameCount/16.65)*5), (cos(20+frameCount/16.65)*5));
ellipse(305, 200, (sin(20+frameCount/16.65)*5), (sin(20+frameCount/16.65)*5));
ellipse(360, 145, (sin(20+frameCount/20.04)*5), (sin(20+frameCount/20.04)*5));
ellipse(350, 170, (cos(20+frameCount/20.04)*5), (cos(20+frameCount/20.04)*5));
ellipse(370, 180, (sin(20+frameCount/20.65)*5), (sin(20+frameCount/20.65)*5));
ellipse(390, 200, (cos(20+frameCount/20.65)*5), (cos(20+frameCount/20.65)*5));
ellipse(390, 160, (sin(20+frameCount/16.65)*5), (sin(20+frameCount/16.65)*5));
ellipse(380, 175, (cos(20+frameCount/16.65)*5), (cos(20+frameCount/16.65)*5));
//Corona Borealis
ellipse(180, 280, (sin(20+frameCount/20.04)*5), (sin(20+frameCount/20.04)*5));
ellipse(190, 295, (cos(20+frameCount/20.04)*5), (cos(20+frameCount/20.04)*5));
ellipse(200, 300, (sin(20+frameCount/20.65)*5), (sin(20+frameCount/20.65)*5));
ellipse(210, 295, (cos(20+frameCount/20.65)*5), (cos(20+frameCount/20.65)*5));
ellipse(215, 285, (cos(20+frameCount/22.33)*5), (cos(20+frameCount/22.33)*5));
ellipse(220, 270, (sin(20+frameCount/22.33)*5), (sin(20+frameCount/22.33)*5));
//random stars
ellipse(140, 340, (cos(20+frameCount/14.33)*5), (cos(20+frameCount/14.33)*5));
ellipse(260, 360, (sin(20+frameCount/14.33)*5), (sin(20+frameCount/14.33)*5));
ellipse(240, 160, (sin(20+frameCount/23.65)*5), (sin(20+frameCount/23.65)*5));
ellipse(270, 40, (cos(20+frameCount/23.65)*5), (cos(20+frameCount/23.65)*5));
ellipse(200, 180, (sin(20+frameCount/18.65)*5), (sin(20+frameCount/18.65)*5));
//Background Planets
//pluto
fill(204, 221, 226);
ellipse(20-mouseX/7, 20-mouseY/7, 30, 30);
//mars
fill(255, 120, 90);
ellipse(340-mouseX/7.6, 240-mouseY/7.6, 40, 40);
//uranus
fill(204, 250, 244);
ellipse(180-mouseX/8.8, 40-mouseY/8.8, 60, 60);
//earth
fill(17, 106, 114);
ellipse(60-mouseX/8.2, 360-mouseY/8.2, 50, 50);
//neptune
fill(23, 137, 252);
ellipse(360-mouseX/8.8, 20-mouseY/8.8, 60, 60);
//Rocket Ship
//rocket boosters
//set fire colour
fill(226, 132, 19);
triangle(mouseX, mouseY+40, mouseX-10, mouseY+30, mouseX+10, mouseY+30);
//set main colour
fill(236, 238, 255);
//rocket tip
ellipse(mouseX, mouseY-20, 20, 40);
//rocket booster
triangle(mouseX, mouseY+10, mouseX-10, mouseY+30, mouseX+10, mouseY+30);
//rocket body
rect(mouseX-10, mouseY-20, 20, 40);
//rocket wings
triangle(mouseX, mouseY-20, mouseX-30, mouseY+20, mouseX+30, mouseY+20);
//window
fill(151, 200, 235);
ellipse(mouseX, mouseY-20, 10, 10);
//Top Planets
//mercury
fill(178, 179, 196);
ellipse(240-mouseX/7.6, 380-mouseY/7.6, 40, 40);
//Jupiter
fill(210, 216, 210);
ellipse(100-mouseX/10, 180-mouseY/10, 80, 80);
//Saturn
fill(212, 170, 125);
ellipse(300-mouseX/9.4, 90-mouseY/9.4, 60, 60);
//saturn's ring
stroke(188, 186, 175);
line(250-mouseX/9.4, 90-mouseY/9.4, 350-mouseX/9.4, 90-mouseY/9.4);
//keep the aesthetic
noStroke();
//top stars
fill(229, 233, 236);
//Cassiopia
ellipse(120, 40, (cos(20+frameCount/18.65)*5), (cos(20+frameCount/18.65)*5));
ellipse(100, 35, (cos(20+frameCount/16.65)*5), (cos(20+frameCount/16.65)*5));
ellipse(90, 50, (sin(20+frameCount/16.65)*5), (sin(20+frameCount/16.65)*5));
ellipse(70, 50, (sin(20+frameCount/20.04)*5), (sin(20+frameCount/20.04)*5));
ellipse(60, 65, (cos(20+frameCount/20.04)*5), (cos(20+frameCount/20.04)*5));
//Cygnus
ellipse(80, 240, (sin(20+frameCount/20.65)*5), (sin(20+frameCount/20.65)*5));
ellipse(70, 260, (cos(20+frameCount/20.65)*5), (cos(20+frameCount/20.65)*5));
ellipse(50, 265, (cos(20+frameCount/22.33)*5), (cos(20+frameCount/22.33)*5));
ellipse(90, 265, (sin(20+frameCount/22.33)*5), (sin(20+frameCount/22.33)*5));
ellipse(65, 280, (cos(20+frameCount/14.33)*5), (cos(20+frameCount/14.33)*5));
ellipse(65, 300, (sin(20+frameCount/14.33)*5), (sin(20+frameCount/14.33)*5));
//Ursa Minor
ellipse(220, 80, (cos(20+frameCount/23.65)*5), (cos(20+frameCount/23.65)*5));
ellipse(210, 90, (sin(20+frameCount/23.65)*5), (sin(20+frameCount/23.65)*5));
ellipse(205, 100, (cos(20+frameCount/18.65)*5), (cos(20+frameCount/18.65)*5));
ellipse(205, 120, (sin(20+frameCount/18.65)*5), (sin(20+frameCount/18.65)*5));
ellipse(220, 110, (cos(20+frameCount/16.65)*5), (cos(20+frameCount/16.65)*5));
ellipse(220, 140, (sin(20+frameCount/16.65)*5), (sin(20+frameCount/16.65)*5));
ellipse(230, 130, (sin(20+frameCount/20.04)*5), (sin(20+frameCount/20.04)*5));
//Random Stars
ellipse(60, 10, (cos(20+frameCount/20.04)*5), (cos(20+frameCount/20.04)*5));
ellipse(370, 30, (sin(20+frameCount/20.65)*5), (sin(20+frameCount/20.65)*5));
ellipse(160, 120, (cos(20+frameCount/20.65)*5), (cos(20+frameCount/20.65)*5));
ellipse(20, 280, (cos(20+frameCount/22.33)*5), (cos(20+frameCount/22.33)*5));
ellipse(200, 390, (sin(20+frameCount/22.33)*5), (sin(20+frameCount/22.33)*5));
ellipse(260, 230, (cos(20+frameCount/14.33)*5), (cos(20+frameCount/14.33)*5));
}
void mousePressed() {
//Reset Stars so that constellations can be seen properly
//star colour
fill(229, 233, 236);
//Cepheus
ellipse(80, 120, 5, 5);
ellipse(50, 130, 5, 5);
ellipse(70, 145, 5, 5);
ellipse(30, 150, 5, 5);
ellipse(50, 170, 5, 5);
//Coma Berencies
ellipse(340, 280, 5, 5);
ellipse(310, 310, 5, 5);
ellipse(335, 340, 5, 5);
//ursa major
ellipse(390, 80, 5, 5);
ellipse(385, 90, 5, 5);
ellipse(370, 95, 5, 5);
ellipse(360, 80, 5, 5);
ellipse(350, 90, 5, 5);
ellipse(345, 110, 5, 5);
ellipse(340, 140, 5, 5);
ellipse(330, 170, 5, 5);
ellipse(310, 190, 5, 5);
ellipse(305, 200, 5, 5);
ellipse(360, 145, 5, 5);
ellipse(350, 170, 5, 5);
ellipse(370, 180, 5, 5);
ellipse(390, 200, 5, 5);
ellipse(390, 160, 5, 5);
ellipse(380, 175, 5, 5);
//Corona Borealis
ellipse(180, 280, 5, 5);
ellipse(190, 295, 5, 5);
ellipse(200, 300, 5, 5);
ellipse(210, 295, 5, 5);
ellipse(215, 285, 5, 5);
ellipse(220, 270, 5, 5);
//random stars
ellipse(140, 340, 5, 5);
ellipse(260, 360, 5, 5);
ellipse(240, 160, 5, 5);
ellipse(270, 40, 5, 5);
ellipse(200, 180, 5, 5);
//Cassiopia
ellipse(120, 40, 5, 5);
ellipse(100, 35, 5, 5);
ellipse(90, 50, 5, 5);
ellipse(70, 50, 5, 5);
ellipse(60, 65, 5, 5);
//Cygnus
ellipse(80, 240, 5, 5);
ellipse(70, 260, 5, 5);
ellipse(50, 265, 5, 5);
ellipse(90, 265, 5, 5);
ellipse(65, 280, 5, 5);
ellipse(65, 300, 5, 5);
//Ursa Minor
ellipse(220, 80, 5, 5);
ellipse(210, 90, 5, 5);
ellipse(205, 100, 5, 5);
ellipse(205, 120, 5, 5);
ellipse(220, 110, 5, 5);
ellipse(220, 140, 5, 5);
ellipse(230, 130, 5, 5);
//Random Stars
ellipse(60, 10, 5, 5);
ellipse(370, 30, 5, 5);
ellipse(160, 120, 5, 5);
ellipse(20, 280, 5, 5);
ellipse(200, 390, 5, 5);
ellipse(260, 230, 5, 5);
//Connect the Constellations when clicked
//set frame rate so that link lines can be seen for .5 of a second
frameRate(1);
stroke(229, 233, 236);
//Cassiopia
line(120, 40, 100, 35);
line(100, 35, 90, 50);
line(90, 50, 70, 50);
line(70, 50, 60, 65);
//Cepheus
line(80, 120, 50, 130);
line(50, 130, 30, 150);
line(30, 150, 50, 170);
line(50, 170, 70, 145);
line(70, 145, 80, 120);
line(50, 130, 70, 145);
//Cygnus
line(80, 240, 70, 260);
line(70, 260, 65, 280);
line(65, 280, 65, 300);
line(50, 265, 70, 260);
line(70, 260, 90, 265);
//ursa minor
line(220, 80, 210, 90);
line(210, 90, 205, 100);
line(205, 100, 205, 120);
line(205, 120, 220, 140);
line(220, 140, 230, 130);
line(230, 130, 220, 110);
line(220, 110, 205, 120);
//ursa major
line(390, 80, 385, 90);
line(385, 90, 370, 95);
line(370, 95, 360, 80);
line(360, 80, 350, 90);
line(350, 90, 345, 110);
line(345, 110, 340, 140);
line(340, 140, 330, 170);
line(330, 170, 310, 190);
line(310, 190, 305, 200);
line(330, 170, 350, 170);
line(350, 170, 370, 180);
line(370, 180, 390, 200);
line(390, 160, 380, 175);
line(380, 175, 370, 180);
line(350, 170, 360, 145);
line(360, 145, 340, 140);
//Coma Berencies
line(340, 280, 310, 310);
line(310, 310, 335, 340);
//Corona Borealis
line(180, 280, 190, 295);
line(190, 295, 200, 300);
line(200, 300, 210, 295);
line(210, 295, 215, 285);
line(215, 285, 220, 270);
}
void keyPressed() {
println("You're a sky full of Stars");
}