unfold JavaFX Node - Java JavaFX

Java examples for JavaFX:Node

Description

unfold JavaFX Node

Demo Code


//package com.java2s;

import javafx.animation.RotateTransition;
import javafx.animation.Transition;
import javafx.geometry.Point3D;
import javafx.scene.Node;
import javafx.util.Duration;

public class Main {
    public static final Point3D DEF_FOLD = new Point3D(2, -1, 0);

    public static Transition unfold(Node n, Duration d) {
        return unfold(n, d, DEF_FOLD);
    }/*from w  w w . ja v  a 2 s .co m*/

    public static Transition unfold(Node n, Duration d, Point3D axis) {
        Point3D past = n.getRotationAxis();
        n.setRotationAxis(axis);
        n.setRotate(90);
        n.setRotationAxis(past);
        RotateTransition rt = new RotateTransition(d, n);
        rt.setAxis(axis);
        rt.setFromAngle(90);
        rt.setToAngle(0);
        rt.play();
        return rt;
    }
}

Related Tutorials