Written by Chris Piech and Keith Schwarz
Example:
Half Green,
Target
Handouts:
Graphics Reference
Day4: ShortFilm.java
Did you know that animated movies like Toy Story, Up, and Frozen are made using computer programs? In this assignment you are going to use a program to create a short film.
Every movie has a beginning and an end. Sometimes it will start "Once Upon a Time...", sometimes it will start with a title, sometimes it will start with something sillier. At the end of the movie it sometimes says "The end."
Add a method to your program that will draw a message on the screen (on a black background) and leave the message for two seconds.
private void displayMessage(String message)
remove(yourObject);
Your movie must have one scene to start: A setting sun. draw the sky, the earth and a sun. Then, slowly animate the sun descending. The sky should take up the top half of the canvas, and the earth should take up the second half. The sun should start in the center of the sky. Considering the following images from the start of the program, and the program after a few seconds.
Write a method that takes some parameter, and returns the color of the sun. You should specify the parameter of this method: for example, the time (in number of frames since the beginning of the movie), or the y position of the sun, or anything else you think would be useful for getting the correct color of the sun.
private Color getSunColor(...)
Have the method return Color.YELLOW
, Color.ORANGE
, or Color.RED
based on how many iterations have passed. Use this method in your short film to change the color of the sun in your animation as time passes!
Do anything you want to make your story more captivating than just a setting sun. Can you tell a tale of love or action? Don't forget to use methods to make your life easier.
You can also add more objects to make your scene more captivating. How about a rainbow (or a double rainbow)? Do you have an idea about what sunsets have always been missing? How about the Charles bridge?