Skip to content

Commit

Permalink
fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
samypr100 committed Jun 8, 2024
1 parent d357fda commit b1304a7
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions src/test/java/edu/jhuapl/trinity/javafx/javafx3D/LookAtTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@

import javafx.animation.KeyFrame;
import javafx.animation.KeyValue;
import javafx.animation.ParallelTransition;
import javafx.animation.Timeline;
import javafx.animation.TranslateTransition;
import javafx.application.Application;
import javafx.geometry.Insets;
import javafx.geometry.Point3D;
Expand Down Expand Up @@ -97,7 +95,7 @@ public void start(Stage primaryStage) throws Exception {
camera.setTranslateZ(newZ);
});
subScene.setOnKeyPressed(me -> {
if(me.isControlDown() && me.getCode()==KeyCode.R) {
if (me.isControlDown() && me.getCode() == KeyCode.R) {
resetCamera(me.isShiftDown());
}
});
Expand Down Expand Up @@ -144,7 +142,7 @@ public void start(Stage primaryStage) throws Exception {
sphereX.getTranslateX(),
sphereX.getTranslateY(),
sphereX.getTranslateZ());
if(e.isControlDown()) {
if (e.isControlDown()) {
orbitAt(camera, cameraTransform, lookAtPoint3D, e.isShiftDown());
} else
lookAt(pointyGroup, currentPoint3D, lookAtPoint3D, false);
Expand All @@ -162,7 +160,7 @@ public void start(Stage primaryStage) throws Exception {
sphereY.getTranslateX(),
sphereY.getTranslateY(),
sphereY.getTranslateZ());
if(e.isControlDown()) {
if (e.isControlDown()) {
orbitAt(camera, cameraTransform, lookAtPoint3D, e.isShiftDown());
} else
lookAt(pointyGroup, currentPoint3D, lookAtPoint3D, false);
Expand All @@ -181,7 +179,7 @@ public void start(Stage primaryStage) throws Exception {
sphereZ.getTranslateX(),
sphereZ.getTranslateY(),
sphereZ.getTranslateZ());
if(e.isControlDown()) {
if (e.isControlDown()) {
orbitAt(camera, cameraTransform, lookAtPoint3D, e.isShiftDown());
} else
lookAt(pointyGroup, currentPoint3D, lookAtPoint3D, false);
Expand All @@ -203,15 +201,17 @@ public void start(Stage primaryStage) throws Exception {
primaryStage.show();

}

public void resetCamera(boolean animate) {
// cameraTransform.setPivot(0, 0, 0);
cameraTransform.setTranslate(0, 0, 0);
orbitAt(camera, cameraTransform, Point3D.ZERO, animate);
}
public static void orbitAt(Camera camera, CameraTransformer cameraTransform, Point3D at, boolean animate){

public static void orbitAt(Camera camera, CameraTransformer cameraTransform, Point3D at, boolean animate) {
double currentZ = camera.getTranslateZ();
if(!animate) {

if (!animate) {
cameraTransform.setPivot(at.getX(), at.getY(), at.getZ());
cameraTransform.setTranslate(at.getX(), at.getY(), at.getZ());
cameraTransform.setPivot(at.getX(), at.getY(), at.getZ());
Expand All @@ -220,14 +220,14 @@ public static void orbitAt(Camera camera, CameraTransformer cameraTransform, Poi
double time = 1.0;

Timeline timeline = new Timeline(
new KeyFrame(Duration.seconds(time),
new KeyFrame(Duration.seconds(time),
new KeyValue(cameraTransform.translateXProperty(), at.getX()),
new KeyValue(cameraTransform.translateYProperty(), at.getY()),
new KeyValue(cameraTransform.translateZProperty(), at.getZ())
)
// ,new KeyFrame(Duration.seconds(time),
// ,new KeyFrame(Duration.seconds(time),
// new KeyValue(camera.translateZProperty(), currentZ)
// )
// )
);
cameraTransform.setPivot(at.getX(), at.getY(), at.getZ());
timeline.play();
Expand Down

0 comments on commit b1304a7

Please sign in to comment.