Example usage for javafx.animation ScaleTransition setFromY

List of usage examples for javafx.animation ScaleTransition setFromY

Introduction

In this page you can find the example usage for javafx.animation ScaleTransition setFromY.

Prototype

public final void setFromY(double value) 

Source Link

Usage

From source file:org.noroomattheinn.visibletesla.LocationController.java

private Animation animateBlip() {
    final Circle core = new Circle(572, 360, 5);
    final Circle blip = new Circle(572, 360, 5);
    final Circle outline = new Circle(572, 360, 5);
    Duration blipTime = Duration.seconds(1.5);
    Duration interBlipTime = Duration.seconds(0.5);

    core.setFill(Color.BLUE);/* w  w  w .  j  av a 2  s.  c o  m*/
    blip.setFill(Color.LIGHTBLUE);
    outline.setFill(Color.TRANSPARENT);
    outline.setStroke(Color.DARKBLUE);
    outline.setStrokeWidth(0.25);

    root.getChildren().addAll(blip, core, outline);

    FadeTransition fadeBlip = new FadeTransition(blipTime, blip);
    fadeBlip.setFromValue(0.8);
    fadeBlip.setToValue(0.0);

    ScaleTransition scaleBlip = new ScaleTransition(blipTime, blip);
    scaleBlip.setFromX(1);
    scaleBlip.setToX(4);
    scaleBlip.setFromY(1);
    scaleBlip.setToY(4);

    FadeTransition fadeOutline = new FadeTransition(blipTime, outline);
    fadeOutline.setFromValue(1.0);
    fadeOutline.setToValue(0.0);

    ScaleTransition scaleOutline = new ScaleTransition(blipTime, outline);
    scaleOutline.setFromX(1);
    scaleOutline.setToX(4);
    scaleOutline.setFromY(1);
    scaleOutline.setToY(4);

    SequentialTransition sequence = new SequentialTransition(
            new ParallelTransition(fadeBlip, scaleBlip, scaleOutline, fadeOutline),
            new PauseTransition(interBlipTime));
    sequence.setCycleCount(Timeline.INDEFINITE);
    sequence.setOnFinished(new EventHandler<ActionEvent>() {
        @Override
        public void handle(ActionEvent t) {
            core.setVisible(false);
            blip.setVisible(false);
            outline.setVisible(false);
        }
    });

    sequence.play();
    return sequence;
}