Java Code Examples for javafx.animation.TranslateTransition#setInterpolator()

The following examples show how to use javafx.animation.TranslateTransition#setInterpolator() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AndroidKeyboardService.java    From attach with GNU General Public License v3.0 7 votes vote down vote up
private static void adjustPosition(Node node, Parent parent, double kh) {
    if (node == null || node.getScene() == null || node.getScene().getWindow() == null) {
        return;
    }
    double tTot = node.getScene().getHeight();
    double ty = node.getLocalToSceneTransform().getTy() + node.getBoundsInParent().getHeight() + 2;
    double y = 1;
    Parent root = parent == null ? node.getScene().getRoot() : parent;
    if (ty > tTot - kh) {
        y = tTot - ty - kh;
    } else if (kh == 0 && root.getTranslateY() != 0) {
        y = 0;
    }
    if (y <= 0) {
        if (debug) {
            LOG.log(Level.INFO, String.format("Moving %s %.2f pixels", root, y));
        }
        final TranslateTransition transition = new TranslateTransition(Duration.millis(100), root);
        transition.setFromY(root.getTranslateY());
        transition.setToY(y);
        transition.setInterpolator(Interpolator.EASE_OUT);
        transition.playFromStart();
    }
}
 
Example 2
Source File: IOSKeyboardService.java    From attach with GNU General Public License v3.0 6 votes vote down vote up
private static void adjustPosition(Node node, Parent parent, double kh) {
    if (node == null || node.getScene() == null || node.getScene().getWindow() == null) {
        return;
    }
    double tTot = node.getScene().getHeight();
    double ty = node.getLocalToSceneTransform().getTy() + node.getBoundsInParent().getHeight() + 2;
    double y = 1;
    Parent root = parent == null ? node.getScene().getRoot() : parent;
    if (ty > tTot - kh) {
        y = tTot - ty - kh;
    } else if (kh == 0 && root.getTranslateY() != 0) {
        y = 0;
    }
    if (y <= 0) {
        if (debug) {
            LOG.log(Level.INFO, String.format("Moving %s %.2f pixels", root, y));
        }
        final TranslateTransition transition = new TranslateTransition(Duration.millis(100), root);
        transition.setFromY(root.getTranslateY());
        transition.setToY(y);
        transition.setInterpolator(Interpolator.EASE_OUT);
        transition.playFromStart();
    }
}
 
Example 3
Source File: ThreeDOM.java    From scenic-view with GNU General Public License v3.0 6 votes vote down vote up
private Tile3D nodeToTile3D(SVNode node2D, double factor2d3d, double depth) {

        Tile3D tile = new Tile3D(currentRoot2D, factor2d3d, node2D, depth, THICKNESS, this, iThreeDOM);

        if (initialParallelTransition != null && depth > 1) {
            TranslateTransition translateTransition = new TranslateTransition(Duration.seconds(2));
            translateTransition.setInterpolator(Interpolator.EASE_OUT);
            translateTransition.setNode(tile);
            // Take into account slider's value
            translateTransition.setToZ(-depth * spaceSlider.getValue());
            initialParallelTransition.getChildren().add(translateTransition);
        } else {
            tile.setTranslateZ(-depth * spaceSlider.getValue());
        }

        return tile;
    }
 
Example 4
Source File: MainController.java    From green_android with GNU General Public License v3.0 5 votes vote down vote up
public void readyToGoAnimation() {
    // Buttons slide in and clickable address appears simultaneously.
    TranslateTransition arrive = new TranslateTransition(Duration.millis(1200), controlsBox);
    arrive.setInterpolator(new ElasticInterpolator(EasingMode.EASE_OUT, 1, 2));
    arrive.setToY(0.0);
    FadeTransition reveal = new FadeTransition(Duration.millis(1200), addressControl);
    reveal.setToValue(1.0);
    ParallelTransition group = new ParallelTransition(arrive, reveal);
    group.setDelay(NotificationBarPane.ANIM_OUT_DURATION);
    group.setCycleCount(1);
    group.play();
}
 
Example 5
Source File: SlidingListTile.java    From gluon-samples with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
/**
 * Reset position of tile with smooth transition
 */
public void resetTilePosition() {
    TranslateTransition transition = new TranslateTransition(Duration.millis(300), tile);
    transition.setInterpolator(Interpolator.EASE_OUT);
    transition.setFromX(tile.getTranslateX());
    transition.setToX(0);
    transition.playFromStart();
}
 
Example 6
Source File: MainController.java    From GreenBits with GNU General Public License v3.0 5 votes vote down vote up
public void readyToGoAnimation() {
    // Buttons slide in and clickable address appears simultaneously.
    TranslateTransition arrive = new TranslateTransition(Duration.millis(1200), controlsBox);
    arrive.setInterpolator(new ElasticInterpolator(EasingMode.EASE_OUT, 1, 2));
    arrive.setToY(0.0);
    FadeTransition reveal = new FadeTransition(Duration.millis(1200), addressControl);
    reveal.setToValue(1.0);
    ParallelTransition group = new ParallelTransition(arrive, reveal);
    group.setDelay(NotificationBarPane.ANIM_OUT_DURATION);
    group.setCycleCount(1);
    group.play();
}
 
Example 7
Source File: BackgroundController.java    From examples-javafx-repos1 with Apache License 2.0 5 votes vote down vote up
@FXML
public void initialize() {
	
	TranslateTransition translateTransition =
            new TranslateTransition(Duration.millis(10000), background1);
	translateTransition.setFromX(0);
	translateTransition.setToX(-1 * BACKGROUND_WIDTH);
	translateTransition.setInterpolator(Interpolator.LINEAR);

	TranslateTransition translateTransition2 =
           new TranslateTransition(Duration.millis(10000), background2);
	translateTransition2.setFromX(0);
	translateTransition2.setToX(-1 * BACKGROUND_WIDTH);
	translateTransition2.setInterpolator(Interpolator.LINEAR);

	parallelTransition = 
		new ParallelTransition( translateTransition, translateTransition2 );
	parallelTransition.setCycleCount(Animation.INDEFINITE);

	//
	// Sets the label of the Button based on the animation state
	//
	parallelTransition.statusProperty().addListener((obs, oldValue, newValue) -> {
		if( newValue == Animation.Status.RUNNING ) {
			btnControl.setText( "||" );
		} else {
			btnControl.setText( ">" );
		}
	});
}
 
Example 8
Source File: MainNode.java    From helloiot with GNU General Public License v3.0 4 votes vote down vote up
public void initialize() {

        if (appexitbutton) {
            exitbutton.setVisible(true);
            exitbutton.setGraphic(IconBuilder.create(IconFontGlyph.FA_SOLID_POWER_OFF, 18.0).styleClass("icon-fill").build());
            exitbutton.setOnAction(ev -> {
                rootpane.getScene().getWindow().hide();
            });
        } else {
            exitbutton.setVisible(false);
            headerbox.getChildren().remove(exitbutton);
            exitbutton = null;
        }
        menubutton.setGraphic(IconBuilder.create(IconFontGlyph.FA_SOLID_BARS, 18.0).styleClass("icon-fill").build());
        menubutton.setDisable(true);
        
        timeindicator = new TimeIndicator(resources.getString("clock.pattern"));
        indicators.getChildren().add(timeindicator.getNode());
        
        listpagesgray.setBackground(new Background(new BackgroundFill(Color.gray(0.5, 0.75), CornerRadii.EMPTY, Insets.EMPTY)));
        FadeTransition ft = new FadeTransition(Duration.millis(300), scrollpages);
        ft.setFromValue(0.0);
        ft.setToValue(1.0);
        ft.setInterpolator(Interpolator.LINEAR);
        FadeTransition ft2 = new FadeTransition(Duration.millis(300), listpagesgray);
        ft2.setFromValue(0.0);
        ft2.setToValue(1.0);
        ft2.setInterpolator(Interpolator.LINEAR);
        TranslateTransition tt = new TranslateTransition(Duration.millis(300), scrollpages);
        tt.setFromX(-scrollpages.prefWidth(0));
        tt.setToX(0.0);
        tt.setInterpolator(Interpolator.EASE_BOTH);
        TranslateTransition tt2 = new TranslateTransition(Duration.millis(300), appcontainer);
        tt2.setFromX(0.0);
        tt2.setToX(scrollpages.prefWidth(0));
        tt2.setInterpolator(Interpolator.EASE_BOTH);
        
        listpagestransition = new ParallelTransition(ft, ft2, tt, tt2);
        listpagestransition.setRate(-1.0);
        listpagestransition.setOnFinished((ActionEvent actionEvent) -> {
            if (listpagestransition.getCurrentTime().equals(Duration.ZERO)) {
                scrollpages.setVisible(false);
                listpagesgray.setVisible(false);
            }
        });
    }
 
Example 9
Source File: ImprovedBackgroundController.java    From examples-javafx-repos1 with Apache License 2.0 4 votes vote down vote up
@FXML
public void initialize() {
	
	TranslateTransition background1Transition =
            new TranslateTransition(Duration.millis(8000), background1);
	background1Transition.setFromX(0);
	background1Transition.setToX(-1 * BACKGROUND_WIDTH);
	background1Transition.setInterpolator(Interpolator.LINEAR);

	TranslateTransition background2Transition =
           new TranslateTransition(Duration.millis(8000), background2);
	background2Transition.setFromX(0);
	background2Transition.setToX(-1 * BACKGROUND_WIDTH);
	background2Transition.setInterpolator(Interpolator.LINEAR);

	ParallelTransition backgroundWrapper = new ParallelTransition(
			background1Transition, background2Transition
			);
	backgroundWrapper.setCycleCount(Animation.INDEFINITE);
	
	TranslateTransition clouds1Transition =
            new TranslateTransition(Duration.millis(20000), clouds1);
	clouds1Transition.setFromX(0);
	clouds1Transition.setToX(-1 * BACKGROUND_WIDTH);
	clouds1Transition.setInterpolator(Interpolator.LINEAR);

	TranslateTransition clouds2Transition =
           new TranslateTransition(Duration.millis(20000), clouds2);
	clouds2Transition.setFromX(0);
	clouds2Transition.setToX(-1 * BACKGROUND_WIDTH);
	clouds2Transition.setInterpolator(Interpolator.LINEAR);

	ParallelTransition cloudsWrapper = new ParallelTransition(
			clouds1Transition, clouds2Transition
			);
	cloudsWrapper.setCycleCount(Animation.INDEFINITE);
	
	parallelTransition = 
		new ParallelTransition( backgroundWrapper,
								cloudsWrapper );

	parallelTransition.setCycleCount(Animation.INDEFINITE);

	//
	// Sets the label of the Button based on the animation state
	//
	parallelTransition.statusProperty().addListener((obs, oldValue, newValue) -> {
		if( newValue == Animation.Status.RUNNING ) {
			btnControl.setText( "||" );
		} else {
			btnControl.setText( ">" );
		}
	});
}