get Color in Shape - Java 2D Graphics

Java examples for 2D Graphics:Color

Description

get Color in Shape

Demo Code


//package com.java2s;
import javafx.animation.FillTransition;
import javafx.animation.FillTransitionBuilder;
import javafx.animation.Transition;
import javafx.scene.paint.Color;
import javafx.scene.shape.Shape;
import javafx.util.Duration;

public class Main {
    public static Transition getColorinShape(Shape rect, Color fromColor,
            Color toColor) {//from   w w w  .  j  a v a 2 s  .c  om
        FillTransition st = FillTransitionBuilder.create()
                .duration(Duration.seconds(1)).shape(rect)
                .fromValue(fromColor).toValue(toColor).build();
        return st;
    }
}

Related Tutorials