You are on page 1of 6

TUGAS

GRAFIKA KOMPUTER 2

DI SUSUN OLEH

NAMA : MUH. NUR RAHMAT SALEH


NIM : 105841105119
KELAS : INFORMATIKA 6B

PRODI INFORMATIKA
FAKULTAS TEKNIK
UNIVERSITAS MUHAMMADIYAH MAKASSAR
2022
/*

* To change this license header, choose License Headers in Project Properties.

* To change this template file, choose Tools | Templates

* and open the template in the editor.

*/

package java6;

import javafx.animation.FadeTransition;

import javafx.animation.FillTransition;

import javafx.application.Application;

import javafx.scene.Group;

import javafx.scene.Scene;

import javafx.stage.Stage;

import javafx.scene.shape.Cylinder;

import javafx.scene.shape.CullFace;

import javafx.scene.shape.Rectangle;

import javafx.scene.shape.Polygon;

import javafx.scene.paint.Color;

import javafx.scene.paint.PhongMaterial;

import javafx.scene.text.Font;

import javafx.scene.text.FontWeight;

import javafx.scene.text.Text;

import javafx.util.Duration;

/**

* @author ACER
*/

public class Java6 extends Application {

@Override

public void start(Stage primaryStage) {

PhongMaterial material1 = new PhongMaterial();

material1.setDiffuseColor(Color.WHITE);

Cylinder cyl1 = new Cylinder();

cyl1.setHeight(150.0f);

cyl1.setRadius(30.0f);

cyl1.setTranslateX(150);

cyl1.setTranslateY(225);

cyl1.setMaterial(material1);

Cylinder cyl2 = new Cylinder();

cyl2.setHeight(100.0f);

cyl2.setRadius(80.0f);

cyl2.setTranslateX(300);

cyl2.setTranslateY(250);

cyl2.setMaterial(material1);

Cylinder cyl3 = new Cylinder();

cyl3.setHeight(150.0f);

cyl3.setRadius(30.0f);

cyl3.setTranslateX(450);

cyl3.setTranslateY(225);

cyl3.setMaterial(material1);

Polygon p1 = new Polygon();

p1.getPoints().addAll(new Double[]{

100.0,150.0,

150.0,100.0,
200.0,150.0

});

p1.setFill(Color.GREEN);

Polygon p2 = new Polygon();

p2.getPoints().addAll(new Double[]{

400.0,150.0,

450.0,100.0,

500.0,150.0

});

p2.setFill(Color.GREEN);

Polygon p3 = new Polygon();

p3.getPoints().addAll(new Double[]{

210.0,200.0,

300.0,150.0,

390.0,200.0

});

p3.setFill(Color.GREEN);

Rectangle r = new Rectangle();

r.setX(110);

r.setY(300);

r.setWidth(80.0);

r.setHeight(30.0);

r.setFill(Color.BLACK);

Rectangle r1 = new Rectangle();

r1.setX(410);

r1.setY(300);

r1.setWidth(80.0);
r1.setHeight(30.0);

r1.setFill(Color.BLACK);

Rectangle r2 = new Rectangle();

r2.setX(210);

r2.setY(300);

r2.setWidth(180.0);

r2.setHeight(30.0);

r2.setFill(Color.BLACK);

Text t = new Text();

t.setText("\n_______________________"

+ "\n Selamat Hari Raya Idul Fitri "

+ "\n_______________________");

t.setFont(Font.font("verdana",FontWeight.BOLD, 25));

t.setFill(Color.BLACK);

t.setX(90);

t.setY(2);

FillTransition fill = new FillTransition();

fill.setCycleCount(1000);

fill.setDuration(Duration.millis(7000));

fill.setFromValue(Color.GREEN);

fill.setToValue(Color.AQUA);

fill.setShape(t);

fill.play();

Group root = new Group(cyl1,cyl2,cyl3,p1,p2,p3,r,r1,r2,t);

Scene scene = new Scene(root, 600, 400);

primaryStage.setTitle("Hello World!");
primaryStage.setScene(scene);

primaryStage.show();

/**

* @param args the command line arguments

*/

public static void main(String[] args) {

launch(args);

HASIL

You might also like