get JavaFX Rotate Transition - Java JavaFX

Java examples for JavaFX:Animation

Description

get JavaFX Rotate Transition

Demo Code


//package com.java2s;

import javafx.animation.RotateTransition;

import javafx.scene.Group;
import javafx.util.Duration;

public class Main {
    private static RotateTransition getRotateTransition(
            final int numberIndex, final Group group) {
        RotateTransition transition = new RotateTransition(
                Duration.millis((8 - numberIndex) * 300), group);
        transition.setCycleCount(1);//www  . j  av  a 2s .c om
        transition.setFromAngle(360 - (numberIndex * numberIndex * 15));
        transition.setToAngle(-360);
        transition.setByAngle(0);

        return transition;
    }
}

Related Tutorials