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

The following examples show how to use javafx.animation.TranslateTransition#playFromStart() . 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: RenderEngine.java    From strangefx with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public void animate() {
    final Qubit3D node = qubits.get(counter++ % qubits.size());
    TranslateTransition tt = new TranslateTransition(Duration.seconds(5), node);
    node.resetStep();
    tt.setFromX(0);
    tt.setByX(nSteps * stepSize);
    tt.playFromStart();
}
 
Example 4
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();
}