Example usage for javafx.animation Interpolator LINEAR

List of usage examples for javafx.animation Interpolator LINEAR

Introduction

In this page you can find the example usage for javafx.animation Interpolator LINEAR.

Prototype

Interpolator LINEAR

To view the source code for javafx.animation Interpolator LINEAR.

Click Source Link

Document

Built-in interpolator that provides linear time interpolation.

Usage

From source file:Main.java

@Override
public void start(Stage stage) {

    String message = "Earthrise at Christmas: " + "[Forty] years ago this Christmas, a turbulent world "
            + "looked to the heavens for a unique view of our home "
            + "planet. This photo of Earthrise over the lunar horizon "
            + "was taken by the Apollo 8 crew in December 1968, showing "
            + "Earth for the first time as it appears from deep space. "
            + "Astronauts Frank Borman, Jim Lovell and William Anders "
            + "had become the first humans to leave Earth orbit, "
            + "entering lunar orbit on Christmas Eve. In a historic live "
            + "broadcast that night, the crew took turns reading from "
            + "the Book of Genesis, closing with a holiday wish from "
            + "Commander Borman: \"We close with good night, good luck, "
            + "a Merry Christmas, and God bless all of you -- all of " + "you on the good Earth.\"";

    // Reference to the Text
    Text textRef = TextBuilder.create().layoutY(100).textOrigin(VPos.TOP).textAlignment(TextAlignment.JUSTIFY)
            .wrappingWidth(400).text(message).fill(Color.rgb(187, 195, 107))
            .font(Font.font("SansSerif", FontWeight.BOLD, 24)).build();

    // Provides the animated scrolling behavior for the text
    TranslateTransition transTransition = TranslateTransitionBuilder.create().duration(new Duration(75000))
            .node(textRef).toY(-820).interpolator(Interpolator.LINEAR).cycleCount(Timeline.INDEFINITE).build();

    Scene scene = SceneBuilder//from   ww w. j  a  va  2 s  .  co  m
            .create().width(516).height(
                    387)
            .root(GroupBuilder.create().children(
                    ImageViewBuilder.create().image(new Image("http://projavafx.com/images/earthrise.jpg"))
                            .build(),
                    ScrollPaneBuilder.create().layoutX(50).layoutY(180).prefWidth(440).prefHeight(85)
                            .hbarPolicy(ScrollBarPolicy.NEVER).vbarPolicy(ScrollBarPolicy.NEVER).pannable(true)
                            .content(textRef).style("-fx-background-color: transparent;").build())
                    .build())
            .build();

    stage.setScene(scene);
    stage.setTitle("Hello Earthrise");
    stage.show();

    // Start the text animation
    transTransition.play();
}

From source file:com.loyalty.controllers.DashboardController.java

private void animate() {
    Toolkit tk = Toolkit.getDefaultToolkit();
    Dimension screenDimension = tk.getScreenSize();
    TranslateTransition transition = new TranslateTransition(new Duration(30000), lbl_promotion);
    transition.setInterpolator(Interpolator.LINEAR);
    transition.setCycleCount(Timeline.INDEFINITE);
    transition.setFromX(screenDimension.getWidth());
    transition.setToX(-screenDimension.getWidth());
    transition.play();/*from   w w  w .j  av a2s  .c o  m*/
}

From source file:org.pdfsam.ui.selection.LoadingStatusIndicator.java

public LoadingStatusIndicator(PdfDocumentDescriptorProvider descriptorProvider, String ownerModule) {
    requireNotNull(descriptorProvider,/*from  ww w .jav a  2  s  .  co m*/
            "Cannot create LoadingStatusIndicator with a null PdfDocumentDescriptorProvider");
    this.ownerModule = defaultString(ownerModule);
    this.popup = new PasswordFieldPopup(getOwnerModule());
    this.descriptorProvider = descriptorProvider;
    this.addEventFilter(MouseEvent.MOUSE_CLICKED, (e) -> {
        if (loadingStatus.get() == ENCRYPTED) {
            showPasswordRequest();
        } else if (loadingStatus.get() == WITH_ERRORS) {
            eventStudio().broadcast(new ShowStageRequest(), "LogStage");
        }
    });
    loadingStatus.addListener((o, oldVal, newVal) -> updateIndicator(newVal));
    this.getStyleClass().addAll("encryption-status");
    this.icon.setText("");
    icon.setTextAlignment(TextAlignment.CENTER);
    icon.setAlignment(Pos.CENTER);
    this.setGraphic(icon);
    rotate.setByAngle(360);
    rotate.setCycleCount(Animation.INDEFINITE);
    rotate.setInterpolator(Interpolator.LINEAR);
}