Your browser does not support the canvas tag.

previous        Show / Hide Source        Download        next
//Eclipse by Jessie Lo 
//Interactive Drawing Assignment 

//Inspired by: 
//  Eclipse sighting 2017
//  Various student work
//  Pokemon Sun & Moon

//Premise:
//  Cute Sun and Moon spirtes that change via the time of day!!
//  By clicking the mousepad, sprites change from the Sun to the Moon. Moving the mouse will change the time of day from Night to Morning 

////////////////////////////////////////////////////////////////////////////////////////////

void setup() {
  size (400, 400);
}

//Background
void draw() {
  background(0);

  //Colour of turns lighter when mouse reaches to the bottom
  fill(119, 114, 173, (mouseY)/1.5);
  rect (0, 0, 400, 400);

  ////Stars (small) 
  fill(255);  
  ellipse( 5, 5, 3, 3);  
  ellipse(5, 100, 4, 5);
  ellipse(5, 300, 3, 3);
  ellipse(5, 395, 4, 3);
  ellipse(60, 248, 2, 4);
  ellipse(60, 70, 3, 3);
  ellipse(80, 350, 4, 3);
  ellipse(100, 20, 2, 2);
  ellipse(130, 290, 2, 3);
  ellipse(130, 140, 3, 3);
  ellipse(140, 50, 3, 2);
  ellipse(168, 78, 3, 3);
  ellipse(231, 370, 1, 4); 
  ellipse(234, 300, 3, 4);  
  ellipse(200, 180, 4, 3);
  ellipse(280, 43, 2, 3);
  ellipse(287, 225, 2, 3);
  ellipse(287, 300, 3, 2);
  ellipse(360, 300, 1, 4);
  ellipse(360, 110, 2, 4);  
  ellipse(370, 25, 3, 3);
  ellipse(370, 225, 3, 3);
  ellipse(370, 225, 2, 3);
  ellipse(380, 370, 3, 4); 

  //Big Stars 

  //Light Blue Glow
  fill(167, 225, 255);
  noStroke();
  ellipseMode(CENTER);
  ellipse(320, 140, sin(frameCount*0.010)*5, 50);
  ellipse(320, 140, 50, sin(frameCount*0.010)*5);
  ellipse(20, 40, sin(frameCount*0.010)*5, 50);
  ellipse(20, 40, 50, sin(frameCount*0.010)*5);
  ellipse(20, 340, sin(frameCount*0.010)*5, 50);
  ellipse(20, 340, 50, sin(frameCount*0.010)*5);

  //Stars + White Glow
  fill(255);
  ellipse(320, 140, sin(frameCount*0.010)*5, 30);
  ellipse(320, 140, 30, sin(frameCount*0.010)*5);
  ellipse(80, 190, sin(frameCount*0.010)*5, 30);
  ellipse(80, 190, 30, sin(frameCount*0.010)*5);
  ellipse(220, 380, sin(frameCount*0.010)*5, 30);
  ellipse(220, 380, 30, sin(frameCount*0.010)*5);
  ellipse(20, 40, sin(frameCount*0.010)*5, 30);
  ellipse(20, 40, 30, sin(frameCount*0.010)*5);
  ellipse(20, 340, sin(frameCount*0.010)*5, 30);
  ellipse(20, 340, 30, sin(frameCount*0.010)*5);
  ellipse(380, 20, sin(frameCount*0.010)*5, 30);
  ellipse(380, 20, 30, sin(frameCount*0.010)*5);
  ellipse(380, 320, sin(frameCount*0.010)*5, 30);
  ellipse(380, 320, 30, sin(frameCount*0.010)*5);

  //Moon (Sun will sit on it)
  fill(239);
  ellipse(230, 278, 150, 150);

  //ellipse(mouseX/230, 278, 150, 150);

  //Craters on Moon
  noStroke();
  fill(169);
  ellipse(235, 340, 15, 7);
  ellipse(230, 256, 25, 9);
  ellipse(190, 310, 45, 25);
  ellipse(275, 287, 27, 14);
  ellipse(200, 220, 23, 7);

  ////////////////////////////////////////////////////////////////////////////////////////////

  //Character: Sun

  //Body
  noStroke();
  fill(255, 244, 118);
  rect(175, 100, 30, 120, 15);
  //Shadow
  fill(222, 213, 121);
  rect(175, 140, 30, 20, 5);
  ellipse(189, 193, 30, 62);
  ellipse(200, 200, 30, 30);

  //Arms

  fill(255, 244, 118);
  ellipse(174, 175, 26, 42);

  fill(255, 244, 118);
  ellipse(210, 165, 25, 28);
  ellipse(207, 167, 25, 31);
  ellipse(203, 178, 15, 20);

  //Shadow
  fill(222, 213, 121);
  ellipse(177, 176, 17, 39);
  ellipse(200, 180, 20, 13);


  //Legs
  //stroke(0);
  fill(222, 213, 121);
  ellipse(174, 213, 25, 30);
  ellipse(187, 216, 22, 15);
  ellipse(169, 216, 23, 27);

  //Toe
  fill(255, 244, 118);
  ellipse(202, 214, 10, 15);
  //Shadow
  fill(222, 213, 121);
  ellipse(199, 210, 10, 7);
  //Full leg
  fill(255, 244, 118);
  ellipse(189, 193, 30, 49);
  ellipse(186, 187, 26, 45);
  ellipse(195, 220, 22, 7);

  //Head

  fill(255, 244, 118);
  ellipse(180, 100, 100, 100);

  //Eyelashes 
  noStroke();
  fill(255, 178, 10);
  ellipse(153, 102, 10, 5);
  ellipse(202, 97, 10, 5);

  //Pupils
  fill(255, 178, 10, 169);
  stroke(255, 178, 10, 190);
  ellipse(158, 107, 8, 13);
  ellipse(198, 103, 8, 13);

  //Sun spot 
  noStroke();
  fill(255, 178, 10, 169);
  ellipse(170, 80, 20, 20);
  fill(255, 178, 10);
  ellipse(170, 80, 10, 10);

  //Lips
  stroke(0); 
  fill(245);
  ellipse(185, 135, 10, 10);

  ////////////////////////////////////////////////////////////////////////////////////////////

  //By holding the mouse, the Moon sprite will show up
  if (mousePressed) {

    //Sun (Moon will sit on it)
    noStroke(); 
    fill(255, 239, 62, 169);
    ellipse(230, 278, 200, 200);
    fill(255, 239, 62);
    ellipse(230, 278, 150, 150);

    //Moon
    //Body
    noStroke();
    fill(120, 121, 162);
    rect(175, 100, 30, 120, 15);
    //Shadow
    fill(87, 88, 116);
    rect(175, 140, 30, 20, 5);
    ellipse(189, 193, 30, 62);
    ellipse(200, 200, 30, 30);


    //Arms

    fill(120, 121, 162);
    ellipse(174, 175, 26, 42);

    fill(120, 121, 162);
    ellipse(210, 165, 25, 28);
    ellipse(207, 167, 25, 31);
    ellipse(203, 178, 15, 20);

    //Shadow
    fill(87, 88, 116);
    ellipse(177, 176, 17, 39);
    ellipse(200, 180, 20, 13);

    //Legs
    //stroke(0);
    fill(87, 88, 116);
    ellipse(174, 213, 25, 30);
    ellipse(187, 216, 22, 15);
    ellipse(169, 216, 23, 27);

    //Toe
    fill(120, 121, 162);
    ellipse(202, 214, 10, 15);
    //Shadow
    fill(87, 88, 116);
    ellipse(199, 210, 10, 7);
    //Full leg
    fill(120, 121, 162);
    ellipse(189, 193, 30, 49);
    ellipse(186, 187, 26, 45);
    ellipse(195, 220, 22, 7);

    //Head

    fill(120, 121, 162);
    ellipse(180, 100, 100, 100);

    //Hair
    noStroke();
    fill(35, 37, 82);

    ellipse(150, 62, 47, 44);
    ellipse(180, 70, 75, 43);
    ellipse(218, 89, 40, 60);
    ellipse(215, 60, 47, 44);
    rect(115, 63, 85, 30, 28, 20, 2, 2);

    //Ear + Earring
    stroke(35, 37, 82);
    fill(120, 121, 162);
    ellipse(213, 117, 15, 15);
    stroke(0);
    fill(35, 37, 82);
    ellipse(215, 123, 7, 7);

    //Eyes
    fill(35, 37, 82); 
    noStroke();
    ellipse(188, 109, 7, 12);
    ellipse(138, 109, 7, 12);
    rect(175, 100, 15, 5, 20, 20, 2, 20); 
    rect(125, 100, 15, 5, 20, 20, 2, 20); 

    //Lips
    fill(255);
    rect(155, 130, 10, 10, 20, 20, 2, 20);

  }

}