Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Mason Fisher
- 10/22/19
- Drawing a Town
- */
- import javafx.application.Application;
- import javafx.stage.Stage;
- import javafx.scene.paint.*;
- import javafx.scene.canvas.*;
- import javafx.animation.AnimationTimer;
- public class Town0 extends Application {
- @Override
- public void start(Stage myStage) throws Exception {
- GraphicsContext gc = JIGraphicsUtility.setUpGraphics(myStage, "Town", 700, 700);
- AnimationTimer timer = new AnimationTimer() {
- double x = 0;
- @Override
- public void handle(long now) {
- gc.setFill(Color.LIGHTSKYBLUE);
- gc.fillRect(0, 0, 700, 600);
- gc.setFill(Color.SADDLEBROWN);
- gc.fillRect(0, 390, 700, 110);
- gc.setFill(Color.CADETBLUE);
- gc.fillRect(45, 420, 60, 50);
- gc.fillRect(189, 420, 60, 50);
- gc.fillRect(359, 420, 60, 50);
- gc.fillRect(490, 420, 60, 50);
- gc.fillRect(630, 420, 60, 50);
- gc.setFill(Color.GRAY);
- gc.fillRect(0, 475, 700, 300);
- gc.setFill(Color.BLACK);
- gc.fillRect(150, 390, 10, 90);
- gc.fillRect(300, 390, 10, 90);
- gc.fillRect(450, 390, 10, 90);
- gc.fillRect(600, 390, 10, 90);
- gc.setFill(Color.WHITE);
- gc.fillRect(30, 580, 40, 20);
- gc.fillRect(150, 580, 40, 20);
- gc.fillRect(270, 580, 40, 20);
- gc.fillRect(390, 580, 40, 20);
- gc.fillRect(510, 580, 40, 20);
- gc.fillRect(630, 580, 40, 20);
- gc.fillRect(750, 580, 40, 20);
- //CLOUDS
- gc.setFill(Color.WHITESMOKE);
- gc.fillOval(230 + x, 100, 70, 50);
- gc.fillOval(240 + x, 110, 70, 50);
- gc.fillOval(220 + x, 110, 70, 50);
- gc.fillOval(530 + x, 100, 70, 50);
- gc.fillOval(540 + x, 110, 70, 50);
- gc.fillOval(520 + x, 110, 70, 50);
- gc.fillOval(030 + x, 100, 70, 50);
- gc.fillOval(040 + x, 110, 70, 50);
- gc.fillOval(020 + x, 110, 70, 50);
- gc.fillOval(270 + x, 150, 70, 50);
- gc.fillOval(280 + x, 160, 70, 50);
- gc.fillOval(280 + x, 160, 70, 50);
- //SUN
- gc.setFill(Color.YELLOW);
- gc.fillOval(420, 10, 100, 100);
- gc.strokeText("Walmart",50,415);
- gc.strokeText("711",180,415);
- gc.strokeText("Target",350,415);
- gc.strokeText("Taco Bell",500,415);
- x ++;
- }
- };
- timer.start();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement