/**
* Lab 5 - My E-Card
*
* An eCard drawn using the ACM Graphics Library. Make sure that it has the following
* elements:
*
* Your eCard can be about anything you like, but:
* it must be a picture and not just a random collection of elements
* it must be something that you can show your grandmother.
* it must include an animation of compound graphic elements (bouncing a circle is
* not enough)
*
* At a minimum, your drawing has to have the following elements:
* three Rectangle objects
* three Oval objects
* two Line objects
* two Label object
* at least three of these objects must be filled with some color
* the animation must be triggered by a mouseclick, in other words, the animation
* does not start until the user clicks the mouse
* the animation must make use of the pause method
*
* @author
* section:
*/

import java.awt.*;

import acm.graphics.*;
import acm.program.*;

// Freda O. Idoko
// Section B

public class MyECard extends GraphicsProgram {

public void run ()
{
Color summer = new Color(176 ,196, 222);
this.setSize(800, 600);
this.setBackground(summer);

GOval sun = new GOval(-25, -25, 100, 100);
sun.setFilled(true);
sun.setFillColor(Color.yellow);
this.add(sun);

// CODE FOR E-CARD.

// constructing a landscape
GRect pasture = new GRect(0, 350, 800, 250);
pasture.setFilled(true);
Color sand = new Color(228-230-110);
pasture.setColor(sand);
this.add(pasture);

GOval hill = new GOval(200,300,500,200);
hill.setFilled(true);
hill.setColor(sand); this.add(hill);

GOval hill1 = new GOval(50,320,250,200);
hill1.setFilled(true);
hill1.setColor(sand); this.add(hill1);

GOval hill2 = new GOval(600,320,250,200);
hill2.setFilled(true);
hill2.setColor(sand); this.add(hill2);

//Constructing Giftboxes
GRect gift = new GRect (50,400,100,100);
gift.setFilled(true);
gift.setColor(Color.BLUE);
this.add(gift);

GRect gift2 = new GRect (150,400,100,100);
gift2.setFilled(true);
gift2.setColor(Color.yellow);
this.add(gift2);


GRect gift3 = new GRect (100,300,100,100);
gift3.setFilled(true);
gift3.setColor(Color.red);
this.add(gift3);

//Constructin boundaries for gift boxes
GLine boxline = new GLine (100,300,100,400); this.add(boxline);
GLine boxline1 = new GLine (200,300,200,400); this.add(boxline1);
GLine boxline2 = new GLine (50,400,250,400); this.add(boxline2);
GLine boxline3 = new GLine (100,300,200,300); this.add(boxline3);
GLine boxline4 = new GLine (50,400,50,500); this.add(boxline4);
GLine boxline5 = new GLine (50,500,250,500); this.add(boxline5);
GLine boxline6 = new GLine (150,400,150,500); this.add(boxline6);
GLine boxline7 = new GLine (250,400,250,500); this.add(boxline7);

//Contructing ribbon for giftboxes

GRect ribbon1 = new GRect (140,301,20,98); ribbon1.setFilled(true); ribbon1.setFillColor(Color.white); this.add(ribbon1);
GRect ribbon2 = new GRect (90,401,20,98); ribbon2.setFilled(true); ribbon2.setColor(Color.gray); this.add(ribbon2);
GRect ribbon3 = new GRect (190,401,20,98); ribbon3.setFilled(true); ribbon3.setColor(Color.black); this.add(ribbon3);
GRect ribbon4 = new GRect (51,440,98,20); ribbon4.setFilled(true); ribbon4.setColor(Color.gray); this.add(ribbon4);
GRect ribbon5 = new GRect (151,440,98,20); ribbon5.setFilled(true); ribbon5.setColor(Color.black); this.add(ribbon5);
GRect ribbon6 = new GRect (101,340,98,20); ribbon6.setFilled(true); ribbon6.setColor(Color.white); this.add(ribbon6);
GOval bow = new GOval (125,250,50,50); bow.setFilled(true); bow.setColor(Color.black); this.add(bow);

//Constructing balloons
GOval balloon = new GOval (127.5,18,45,80); balloon.setFilled(true); balloon.setColor(Color.pink); this.add(balloon);
GOval balloon1 = new GOval (77.5,90,35,60); balloon1.setFilled(true); balloon1.setColor(Color.blue); this.add(balloon1);
GOval balloon2 = new GOval (52.5,160,25,40); balloon2.setFilled(true); balloon2.setColor(Color.CYAN); this.add(balloon2);
GOval balloon3 = new GOval (174.5,90,35,60); balloon3.setFilled(true); balloon3.setColor(Color.red); this.add(balloon3);
GOval balloon4 = new GOval (221.5,160,25,40); balloon4.setFilled(true); balloon4.setColor(Color.orange); this.add(balloon4);


//Drawing balloon strings
//for left side
GLine string1 = new GLine (150,250,150,100); this.add(string1);
GLine string3 = new GLine (150,250,100,150); this.add(string3);
GLine string4 = new GLine (150,250,75,200); this.add(string4);


//for right side
GLine stringe3 = new GLine (150,250,200,150); this.add(stringe3);
GLine stringe4 = new GLine (150,250,225,200); this.add(stringe4);


// labels that start animation
GLabel label = new GLabel("Hey isn't it your Birthday today?",400,150);
label.setColor(Color.black);
this.add(label);

GLabel label1 = new GLabel("Click Mouse Here:", 150,275 );
label1.setColor(Color.white);
this.add(label1);
this.waitForClick();
this.remove(label);
this.remove(label1);

//moving Balloons
for (int i = 0; i < 25; i++){
bow.move(10,-4);
balloon.move(0,-2);
balloon1.move(4,-4);
balloon2.move(8,-4);
balloon3.move(10,-4);
balloon4.move(12,-4);
string1.move(0,20);
string3.move(0,20);
string4.move(0,20);
stringe3.move(0,20);
stringe4.move(0,20);
pause(1);
}

//e-card message pop-up
// labels after animation
pause(200);
label.setLabel("I hope you have an explosive Birthday!!");
this.add(label);


//Its raining balloons

for (int i = 0; i < 25; i++){
bow.move(0,8);
balloon.move(0,8);
balloon1.move(0,8);
balloon2.move(0,8);
balloon3.move(0,8);
balloon4.move(0,8);
pause(35);
}




GLabel message = new GLabel("Nothing's hotter than that!!", 450, 400);
message.setColor(Color.red);
this.add(message);



}

private void getTransparency(Color summer) {
// TODO Auto-generated method stub

}
}