fold JavaFX Node - Java JavaFX

Java examples for JavaFX:Node

Description

fold 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 fold(Node n, Duration d) {
        return fold(n, d, DEF_FOLD);
    }//from   w ww .  j  a  va 2 s  . c  om

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

Related Tutorials