progress with the rotation system but still not finished , it works tho
	
		
			
	
		
	
	
		
	
		
			All checks were successful
		
		
	
	
		
			
				
	
				continuous-integration/drone/push Build is passing
				
			
		
		
	
	
				
					
				
			
		
			All checks were successful
		
		
	
	continuous-integration/drone/push Build is passing
				
			This commit is contained in:
		@ -1,10 +1,17 @@
 | 
			
		||||
package application;  
 | 
			
		||||
import javafx.application.Application;
 | 
			
		||||
import javafx.event.Event;
 | 
			
		||||
import javafx.event.EventHandler;
 | 
			
		||||
import javafx.scene.Group;  
 | 
			
		||||
import javafx.scene.Scene;  
 | 
			
		||||
import javafx.scene.Scene;
 | 
			
		||||
import javafx.scene.input.KeyEvent;
 | 
			
		||||
import javafx.scene.input.KeyCode;
 | 
			
		||||
import javafx.scene.paint.Color;  
 | 
			
		||||
import javafx.scene.shape.Polygon;  
 | 
			
		||||
import javafx.scene.shape.Polygon;
 | 
			
		||||
import javafx.scene.transform.Rotate;
 | 
			
		||||
import javafx.animation.RotateTransition;
 | 
			
		||||
import javafx.stage.Stage;
 | 
			
		||||
import javafx.util.Duration;
 | 
			
		||||
public class Piece extends Application{
 | 
			
		||||
	
 | 
			
		||||
	public void start(Stage primaryStage) throws Exception {
 | 
			
		||||
@ -17,16 +24,55 @@ public class Piece extends Application{
 | 
			
		||||
				 100.0,200.0,
 | 
			
		||||
				 100.0,100.0,
 | 
			
		||||
				 0.0,100.0});
 | 
			
		||||
		
 | 
			
		||||
		Group root = new Group();  
 | 
			
		||||
        root.getChildren().addAll(piece1);  
 | 
			
		||||
        Scene scene = new Scene(root,490,450,Color.WHEAT);  
 | 
			
		||||
        primaryStage.setScene(scene);  
 | 
			
		||||
        primaryStage.setTitle("piece 1");  
 | 
			
		||||
        primaryStage.show(); 
 | 
			
		||||
		
 | 
			
		||||
		
 | 
			
		||||
		 
 | 
			
		||||
		 piece1.setFill(Color.LIMEGREEN);
 | 
			
		||||
		 piece1.setStroke(Color.BLACK);
 | 
			
		||||
		 piece1.setStrokeWidth(3);
 | 
			
		||||
		 		 
 | 
			
		||||
		 
 | 
			
		||||
		//Instantiating RotateTransition class to create the animation (rotation to the right)
 | 
			
		||||
		 RotateTransition rotaterght = new RotateTransition();
 | 
			
		||||
		//setting attributes for the RotateTransition  
 | 
			
		||||
		 rotaterght.setByAngle(90);
 | 
			
		||||
		 rotaterght.autoReverseProperty();
 | 
			
		||||
		 rotaterght.setDuration(Duration.millis(1000));
 | 
			
		||||
		 rotaterght.setNode(piece1);
 | 
			
		||||
		 rotaterght.setAxis(Rotate.Z_AXIS);
 | 
			
		||||
		 
 | 
			
		||||
		//Instantiating RotateTransition class to create the animation (rotation to the left)
 | 
			
		||||
		 RotateTransition rotatelft = new RotateTransition();
 | 
			
		||||
			//setting attributes for the RotateTransition  
 | 
			
		||||
		 rotatelft.setByAngle(-90);
 | 
			
		||||
		 rotatelft.autoReverseProperty();
 | 
			
		||||
		 rotatelft.setDuration(Duration.millis(1000));
 | 
			
		||||
		 rotatelft.setNode(piece1);
 | 
			
		||||
		 rotatelft.setAxis(Rotate.Z_AXIS);
 | 
			
		||||
		 
 | 
			
		||||
		 
 | 
			
		||||
		 
 | 
			
		||||
		 scene.setOnKeyPressed(new EventHandler<KeyEvent>() {
 | 
			
		||||
			 
 | 
			
		||||
			 public void handle(KeyEvent event) {// 'event' means corresponds to clicking on the clipboard
 | 
			
		||||
				 switch (event.getCode()) {// 'getCode' gets the code of the key pressed on the clipboard
 | 
			
		||||
				 case RIGHT: rotaterght.play();   break;
 | 
			
		||||
				 case LEFT: rotatelft.play();  break;
 | 
			
		||||
				 default: System.out.println("this case hasn't been taken in charge yet");
 | 
			
		||||
				 
 | 
			
		||||
				 }
 | 
			
		||||
			 }
 | 
			
		||||
		 });
 | 
			
		||||
		 
 | 
			
		||||
		
 | 
			
		||||
		 
 | 
			
		||||
		 Group root = new Group();  
 | 
			
		||||
         root.getChildren().addAll(piece1);  
 | 
			
		||||
         Scene scene = new Scene(root,490,450,Color.WHEAT);  
 | 
			
		||||
         primaryStage.setScene(scene);  
 | 
			
		||||
         primaryStage.setTitle("piece 1");  
 | 
			
		||||
         primaryStage.show(); 
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	public static void main(String[] args) {  
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user