Search in sources :

Example 1 with PerspectiveCamera

use of javafx.scene.PerspectiveCamera in project fxexperience2 by EricCanull.

the class FlipInXTransition method starting.

@Override
protected void starting() {
    super.starting();
    node.setRotationAxis(Rotate.X_AXIS);
    oldCamera = node.getScene().getCamera();
    node.getScene().setCamera(new PerspectiveCamera());
}
Also used : PerspectiveCamera(javafx.scene.PerspectiveCamera)

Example 2 with PerspectiveCamera

use of javafx.scene.PerspectiveCamera in project fxexperience2 by EricCanull.

the class FlipOutXTransition method starting.

@Override
protected void starting() {
    super.starting();
    node.setRotationAxis(Rotate.X_AXIS);
    oldCamera = node.getScene().getCamera();
    node.getScene().setCamera(new PerspectiveCamera());
}
Also used : PerspectiveCamera(javafx.scene.PerspectiveCamera)

Example 3 with PerspectiveCamera

use of javafx.scene.PerspectiveCamera in project bitsquare by bitsquare.

the class Notification method animateHide.

@Override
protected void animateHide(Runnable onFinishedHandler) {
    if (autoCloseTimer != null) {
        autoCloseTimer.stop();
        autoCloseTimer = null;
    }
    if (NotificationCenter.useAnimations) {
        double duration = getDuration(400);
        Interpolator interpolator = Interpolator.SPLINE(0.25, 0.1, 0.25, 1);
        gridPane.setRotationAxis(Rotate.X_AXIS);
        Camera camera = gridPane.getScene().getCamera();
        gridPane.getScene().setCamera(new PerspectiveCamera());
        Timeline timeline = new Timeline();
        ObservableList<KeyFrame> keyFrames = timeline.getKeyFrames();
        keyFrames.add(new KeyFrame(Duration.millis(0), new KeyValue(gridPane.rotateProperty(), 0, interpolator), new KeyValue(gridPane.opacityProperty(), 1, interpolator)));
        keyFrames.add(new KeyFrame(Duration.millis(duration), new KeyValue(gridPane.rotateProperty(), -90, interpolator), new KeyValue(gridPane.opacityProperty(), 0, interpolator)));
        timeline.setOnFinished(event -> {
            gridPane.setRotate(0);
            gridPane.setRotationAxis(Rotate.Z_AXIS);
            gridPane.getScene().setCamera(camera);
            onFinishedHandler.run();
        });
        timeline.play();
    } else {
        onFinishedHandler.run();
    }
}
Also used : Timeline(javafx.animation.Timeline) KeyValue(javafx.animation.KeyValue) KeyFrame(javafx.animation.KeyFrame) Interpolator(javafx.animation.Interpolator) Camera(javafx.scene.Camera) PerspectiveCamera(javafx.scene.PerspectiveCamera) PerspectiveCamera(javafx.scene.PerspectiveCamera)

Example 4 with PerspectiveCamera

use of javafx.scene.PerspectiveCamera in project bitsquare by bitsquare.

the class Overlay method animateHide.

protected void animateHide(Runnable onFinishedHandler) {
    Interpolator interpolator = Interpolator.SPLINE(0.25, 0.1, 0.25, 1);
    double duration = getDuration(200);
    Timeline timeline = new Timeline();
    ObservableList<KeyFrame> keyFrames = timeline.getKeyFrames();
    if (type.animationType == AnimationType.SlideDownFromCenterTop) {
        double endY = -gridPane.getHeight();
        keyFrames.add(new KeyFrame(Duration.millis(0), new KeyValue(gridPane.opacityProperty(), 1, interpolator), new KeyValue(gridPane.translateYProperty(), -10, interpolator)));
        keyFrames.add(new KeyFrame(Duration.millis(duration), new KeyValue(gridPane.opacityProperty(), 0, interpolator), new KeyValue(gridPane.translateYProperty(), endY, interpolator)));
        timeline.setOnFinished(e -> onFinishedHandler.run());
        timeline.play();
    } else if (type.animationType == AnimationType.ScaleFromCenter) {
        double endScale = 0.25;
        keyFrames.add(new KeyFrame(Duration.millis(0), new KeyValue(gridPane.opacityProperty(), 1, interpolator), new KeyValue(gridPane.scaleXProperty(), 1, interpolator), new KeyValue(gridPane.scaleYProperty(), 1, interpolator)));
        keyFrames.add(new KeyFrame(Duration.millis(duration), new KeyValue(gridPane.opacityProperty(), 0, interpolator), new KeyValue(gridPane.scaleXProperty(), endScale, interpolator), new KeyValue(gridPane.scaleYProperty(), endScale, interpolator)));
    } else if (type.animationType == AnimationType.ScaleYFromCenter) {
        gridPane.setRotationAxis(Rotate.X_AXIS);
        gridPane.getScene().setCamera(new PerspectiveCamera());
        keyFrames.add(new KeyFrame(Duration.millis(0), new KeyValue(gridPane.rotateProperty(), 0, interpolator), new KeyValue(gridPane.opacityProperty(), 1, interpolator)));
        keyFrames.add(new KeyFrame(Duration.millis(duration), new KeyValue(gridPane.rotateProperty(), -90, interpolator), new KeyValue(gridPane.opacityProperty(), 0, interpolator)));
    } else if (type.animationType == AnimationType.ScaleDownToCenter) {
        double endScale = 0.1;
        keyFrames.add(new KeyFrame(Duration.millis(0), new KeyValue(gridPane.opacityProperty(), 1, interpolator), new KeyValue(gridPane.scaleXProperty(), 1, interpolator), new KeyValue(gridPane.scaleYProperty(), 1, interpolator)));
        keyFrames.add(new KeyFrame(Duration.millis(duration), new KeyValue(gridPane.opacityProperty(), 0, interpolator), new KeyValue(gridPane.scaleXProperty(), endScale, interpolator), new KeyValue(gridPane.scaleYProperty(), endScale, interpolator)));
    } else if (type.animationType == AnimationType.FadeInAtCenter) {
        keyFrames.add(new KeyFrame(Duration.millis(0), new KeyValue(gridPane.opacityProperty(), 1, interpolator)));
        keyFrames.add(new KeyFrame(Duration.millis(duration), new KeyValue(gridPane.opacityProperty(), 0, interpolator)));
    }
    timeline.setOnFinished(e -> onFinishedHandler.run());
    timeline.play();
}
Also used : Timeline(javafx.animation.Timeline) KeyValue(javafx.animation.KeyValue) KeyFrame(javafx.animation.KeyFrame) Interpolator(javafx.animation.Interpolator) PerspectiveCamera(javafx.scene.PerspectiveCamera)

Example 5 with PerspectiveCamera

use of javafx.scene.PerspectiveCamera in project Board-Instrumentation-Framework by intel.

the class Demo method start.

@Override
public void start(Stage stage) {
    StackPane pane = new StackPane();
    pane.getChildren().addAll(control);
    Scene scene = new Scene(pane);
    scene.setCamera(new PerspectiveCamera(false));
    stage.setScene(scene);
    stage.show();
    timer.start();
}
Also used : PerspectiveCamera(javafx.scene.PerspectiveCamera) Scene(javafx.scene.Scene) StackPane(javafx.scene.layout.StackPane)

Aggregations

PerspectiveCamera (javafx.scene.PerspectiveCamera)51 Scene (javafx.scene.Scene)36 Group (javafx.scene.Group)31 KeyCode (javafx.scene.input.KeyCode)31 PointLight (javafx.scene.PointLight)28 Rotate (javafx.scene.transform.Rotate)25 MouseEvent (javafx.scene.input.MouseEvent)23 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)16 AnimationTimer (javafx.animation.AnimationTimer)14 KeyFrame (javafx.animation.KeyFrame)12 KeyValue (javafx.animation.KeyValue)12 Timeline (javafx.animation.Timeline)12 Point3D (org.fxyz.geometry.Point3D)11 AmbientLight (javafx.scene.AmbientLight)10 Translate (javafx.scene.transform.Translate)10 Color (javafx.scene.paint.Color)9 ArrayList (java.util.ArrayList)8 Interpolator (javafx.animation.Interpolator)7 OBJWriter (org.fxyz.utils.OBJWriter)7 PhongMaterial (javafx.scene.paint.PhongMaterial)6