Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package javafxapplication5;
- import javafx.animation.RotateTransition;
- import javafx.application.Application;
- import javafx.scene.Group;
- import javafx.scene.PerspectiveCamera;
- import javafx.scene.Scene;
- import javafx.scene.SceneAntialiasing;
- import javafx.scene.image.Image;
- import javafx.scene.paint.Color;
- import javafx.scene.paint.PhongMaterial;
- import javafx.scene.shape.Cylinder;
- import javafx.scene.shape.Sphere;
- import javafx.scene.transform.Rotate;
- import javafx.stage.Stage;
- import javafx.util.Duration;
- public class JavaFXApplication5 extends Application {
- @Override
- public void start(Stage primaryStage) {
- PhongMaterial mat1 = new PhongMaterial();
- //mat1.setDiffuseColor(Color.CYAN);
- mat1.setDiffuseMap(new Image(getClass().getResource("dif.jpg").toExternalForm()));
- mat1.setBumpMap(new Image(getClass().getResource("bumg.jpg").toExternalForm()));
- mat1.setSpecularMap(new Image(getClass().getResource("specular.jpg").toExternalForm()));
- Sphere sphere = new Sphere((1080/2)-20);
- sphere.setTranslateX(1920/2);
- sphere.setTranslateY(1080/2);
- sphere.setMaterial(mat1);
- /* Cylinder cylinder = new Cylinder(300,100);
- cylinder.setTranslateX(600);
- cylinder.setTranslateY(400);*/
- RotateTransition rotTrans = new RotateTransition();
- rotTrans.setDuration(Duration.millis(25000));
- rotTrans.setNode(sphere);
- rotTrans.setByAngle(360);
- rotTrans.setAxis(Rotate.Y_AXIS);
- rotTrans.setCycleCount(-1);
- rotTrans.setAutoReverse(false);
- /* Rotate rx = new Rotate(0,0,0,0, Rotate.X_AXIS);
- Rotate ry = new Rotate(0,0,0,0, Rotate.Y_AXIS);
- Rotate rz = new Rotate(0,0,0,0, Rotate.Z_AXIS);
- rx.setAngle(45);
- ry.setAngle(30);
- rz.setAngle(50);
- cylinder.getTransforms().addAll(rz,ry,rz);*/
- Group root = new Group(sphere);
- //root.setTranslateZ(500);
- Scene scene = new Scene(root, 1920, 1080, true, SceneAntialiasing.BALANCED);
- scene.setFill(Color.BLACK);
- scene.setCamera(new PerspectiveCamera());
- primaryStage.setTitle("TRZYFEEDEFIX");
- primaryStage.setScene(scene);
- primaryStage.show();
- rotTrans.play();
- }
- public static void main(String[] args) {
- launch(args);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement