Java Code Examples for javafx.scene.Node#rotateProperty()

The following examples show how to use javafx.scene.Node#rotateProperty() . 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: FlipOutXTransition.java    From TweetwallFX with MIT License 6 votes vote down vote up
/**
 * Create new FlipOutXTransition
 *
 * @param node The node to affect
 */
public FlipOutXTransition(final Node node) {
    this.node = node;
    timeline = new Timeline(
            new KeyFrame(Duration.millis(0),
                    new KeyValue(node.rotateProperty(), 0, EASE),
                    new KeyValue(node.opacityProperty(), 1, EASE)
            ),
            new KeyFrame(Duration.millis(1000),
                    new KeyValue(node.rotateProperty(), -90, EASE),
                    new KeyValue(node.opacityProperty(), 0, EASE)
            )
    );
    setCycleDuration(Duration.seconds(1));
    setDelay(Duration.seconds(0.2));
    statusProperty().addListener((ObservableValue<? extends Status> ov, Status t, Status newStatus) -> {
        if (Status.RUNNING == newStatus) {
            starting();
        } else {
            stopping();
        }
    });
}
 
Example 2
Source File: FlipInXTransition.java    From TweetwallFX with MIT License 5 votes vote down vote up
/**
 * Create new FlipInXTransition
 *
 * @param node The node to affect
 */
public FlipInXTransition(final Node node) {
    this.node = node;
    this.node.setOpacity(0);
    timeline = new Timeline(
            new KeyFrame(Duration.millis(0),
                    new KeyValue(node.rotateProperty(), -90, EASE),
                    new KeyValue(node.opacityProperty(), 0, EASE)
            ),
            new KeyFrame(Duration.millis(400),
                    new KeyValue(node.rotateProperty(), 10, EASE)
            ),
            new KeyFrame(Duration.millis(700),
                    new KeyValue(node.rotateProperty(), -10, EASE)
            ),
            new KeyFrame(Duration.millis(1000),
                    new KeyValue(node.rotateProperty(), 0, EASE),
                    new KeyValue(node.opacityProperty(), 1, EASE)
            )
    );
    setCycleDuration(Duration.seconds(2));
    setDelay(Duration.seconds(0.2));
    statusProperty().addListener((ObservableValue<? extends Status> ov, Status t, Status newStatus) -> {
        if (Status.RUNNING == newStatus) {
            starting();
        } else {
            stopping();
        }
    });
}
 
Example 3
Source File: Animations.java    From pdfsam with GNU Affero General Public License v3.0 5 votes vote down vote up
/**
 * creates a shake animation. This is based on https://github.com/fxexperience/code/blob/master/FXExperienceControls/src/com/fxexperience/javafx/animation/TadaTransition.java
 * and http://daneden.github.io/animate.css/
 * 
 * @param node
 * @return
 */
public static Timeline shake(Node node) {
    Timeline timeline = new Timeline(new KeyFrame(Duration.millis(2500)),
            new KeyFrame(Duration.millis(0), new KeyValue(node.scaleXProperty(), 1, EASE_BOTH),
                    new KeyValue(node.scaleYProperty(), 1, EASE_BOTH),
                    new KeyValue(node.rotateProperty(), 0, EASE_BOTH)),
            new KeyFrame(Duration.millis(100), new KeyValue(node.scaleXProperty(), 0.9, EASE_BOTH),
                    new KeyValue(node.scaleYProperty(), 0.9, EASE_BOTH),
                    new KeyValue(node.rotateProperty(), -3, EASE_BOTH)),
            new KeyFrame(Duration.millis(200), new KeyValue(node.scaleXProperty(), 0.9, EASE_BOTH),
                    new KeyValue(node.scaleYProperty(), 0.9, EASE_BOTH),
                    new KeyValue(node.rotateProperty(), -3, EASE_BOTH)),
            new KeyFrame(Duration.millis(300), new KeyValue(node.scaleXProperty(), 1.1, EASE_BOTH),
                    new KeyValue(node.scaleYProperty(), 1.1, EASE_BOTH),
                    new KeyValue(node.rotateProperty(), 3, EASE_BOTH)),
            new KeyFrame(Duration.millis(400), new KeyValue(node.scaleXProperty(), 1.1, EASE_BOTH),
                    new KeyValue(node.scaleYProperty(), 1.1, EASE_BOTH),
                    new KeyValue(node.rotateProperty(), -3, EASE_BOTH)),
            new KeyFrame(Duration.millis(500), new KeyValue(node.scaleXProperty(), 1.1, EASE_BOTH),
                    new KeyValue(node.scaleYProperty(), 1.1, EASE_BOTH),
                    new KeyValue(node.rotateProperty(), 3, EASE_BOTH)),
            new KeyFrame(Duration.millis(600), new KeyValue(node.scaleXProperty(), 1.1, EASE_BOTH),
                    new KeyValue(node.scaleYProperty(), 1.1, EASE_BOTH),
                    new KeyValue(node.rotateProperty(), -3, EASE_BOTH)),
            new KeyFrame(Duration.millis(700), new KeyValue(node.scaleXProperty(), 1.1, EASE_BOTH),
                    new KeyValue(node.scaleYProperty(), 1.1, EASE_BOTH),
                    new KeyValue(node.rotateProperty(), 3, EASE_BOTH)),
            new KeyFrame(Duration.millis(800), new KeyValue(node.scaleXProperty(), 1.1, EASE_BOTH),
                    new KeyValue(node.scaleYProperty(), 1.1, EASE_BOTH),
                    new KeyValue(node.rotateProperty(), -3, EASE_BOTH)),
            new KeyFrame(Duration.millis(900), new KeyValue(node.scaleXProperty(), 1.1, EASE_BOTH),
                    new KeyValue(node.scaleYProperty(), 1.1, EASE_BOTH),
                    new KeyValue(node.rotateProperty(), 3, EASE_BOTH)),
            new KeyFrame(Duration.millis(1000), new KeyValue(node.scaleXProperty(), 1, EASE_BOTH),
                    new KeyValue(node.scaleYProperty(), 1, EASE_BOTH),
                    new KeyValue(node.rotateProperty(), 0, EASE_BOTH)));
    timeline.setCycleCount(Timeline.INDEFINITE);
    timeline.setDelay(Duration.millis(2000));
    return timeline;
}