flash JavaFX Node - Java JavaFX

Java examples for JavaFX:Node

Description

flash JavaFX Node

Demo Code


//package com.java2s;
import javafx.animation.KeyFrame;
import javafx.animation.KeyValue;
import javafx.animation.Timeline;

import javafx.scene.Node;

import javafx.util.Duration;

public class Main {
    public static void flash(Node node) {
        KeyFrame flashEnd = new KeyFrame(new Duration(200), new KeyValue(
                node.opacityProperty(), 0.0));
        KeyFrame flashStart = new KeyFrame(new Duration(400), new KeyValue(
                node.opacityProperty(), 1.0));

        new Timeline(flashEnd, flashStart).play();
    }/* w ww.  j a v a2s. c o  m*/
}

Related Tutorials