-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Harsh Kumar <harsh19043@iiitd.ac.in>
- Loading branch information
Showing
5 changed files
with
93 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package obstacles; | ||
|
||
import javafx.animation.Interpolator; | ||
import javafx.animation.RotateTransition; | ||
import javafx.fxml.FXML; | ||
import javafx.fxml.Initializable; | ||
import javafx.scene.Node; | ||
import javafx.scene.layout.Pane; | ||
import javafx.scene.transform.Rotate; | ||
import javafx.util.Duration; | ||
|
||
import java.net.URL; | ||
import java.util.ArrayList; | ||
import java.util.ResourceBundle; | ||
|
||
public class ObstaclesController implements Initializable { | ||
static int defaultRotatingDuration = 4000; | ||
|
||
ArrayList<RotateTransition> rotatingElements; | ||
@FXML | ||
Pane circle; | ||
|
||
private void addRotatingNode(Node node, int timeInMillis, boolean clockwise) { | ||
RotateTransition rt = new RotateTransition(); | ||
rt.setAxis(Rotate.Z_AXIS); | ||
rt.setByAngle((clockwise) ? 360 : -360); | ||
rt.setCycleCount(1000); | ||
rt.setInterpolator(Interpolator.LINEAR); | ||
rt.setDuration(Duration.millis(timeInMillis)); | ||
rt.setNode(node); | ||
rt.play(); | ||
} | ||
|
||
private void addRotatingNode(Node node) { | ||
addRotatingNode(node, defaultRotatingDuration, true); | ||
} | ||
|
||
@Override | ||
public void initialize(URL url, ResourceBundle resourceBundle) { | ||
rotatingElements = new ArrayList<>(); | ||
addRotatingNode(circle); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
|
||
<?import java.net.*?> | ||
<?import javafx.scene.layout.*?> | ||
<?import javafx.scene.shape.*?> | ||
|
||
<Pane xmlns:fx="http://javafx.com/fxml/1" fx:id="circle" prefHeight="350" prefWidth="350" | ||
xmlns="http://javafx.com/javafx/11.0.1" fx:controller="obstacles.ObstaclesController"> | ||
|
||
<stylesheets> | ||
<URL value="@../style/style.css"/> | ||
</stylesheets> | ||
<Arc focusTraversable="true" layoutX="175.0" layoutY="175.0" length="90.0" radiusX="175.0" radiusY="175.0" | ||
startAngle="0.0" styleClass="fill-yellow" type="ROUND"/> | ||
<Arc focusTraversable="true" layoutX="175.0" layoutY="175.0" length="90.0" radiusX="175.0" radiusY="175.0" | ||
startAngle="90.0" styleClass="fill-blue" type="ROUND"/> | ||
<Arc focusTraversable="true" layoutX="175.0" layoutY="175.0" length="90.0" radiusX="175.0" radiusY="175.0" | ||
startAngle="180.0" styleClass="fill-pink" type="ROUND"/> | ||
<Arc focusTraversable="true" layoutX="175.0" layoutY="175.0" length="90.0" radiusX="175.0" radiusY="175.0" | ||
startAngle="270.0" styleClass="fill-purple" type="ROUND"/> | ||
<Circle fill="WHITE" layoutX="175.0" layoutY="175.0" radius="147.0" stroke="BLACK" strokeType="INSIDE" | ||
styleClass="fill-soft-black"/> | ||
</Pane> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters