javafx.animation.ParallelTransition Java Examples

The following examples show how to use javafx.animation.ParallelTransition. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: HighLowTileSkin.java    From OEE-Designer with MIT License 6 votes vote down vote up
@Override protected void handleCurrentValue(final double VALUE) {
    double deviation = calculateDeviation(VALUE);
    updateState(deviation);
    valueText.setText(String.format(locale, formatString, VALUE));
    deviationText.setText(String.format(locale, "%." + tile.getTickLabelDecimals() + "f", deviation));

    RotateTransition rotateTransition = new RotateTransition(Duration.millis(200), triangle);
    rotateTransition.setFromAngle(triangle.getRotate());
    rotateTransition.setToAngle(state.angle);

    FillTransition fillIndicatorTransition = new FillTransition(Duration.millis(200), triangle);
    fillIndicatorTransition.setFromValue((Color) triangle.getFill());
    fillIndicatorTransition.setToValue(state.color);

    FillTransition fillReferenceTransition = new FillTransition(Duration.millis(200), deviationText);
    fillReferenceTransition.setFromValue((Color) triangle.getFill());
    fillReferenceTransition.setToValue(state.color);

    FillTransition fillReferenceUnitTransition = new FillTransition(Duration.millis(200), deviationUnitText);
    fillReferenceUnitTransition.setFromValue((Color) triangle.getFill());
    fillReferenceUnitTransition.setToValue(state.color);

    ParallelTransition parallelTransition = new ParallelTransition(rotateTransition, fillIndicatorTransition, fillReferenceTransition, fillReferenceUnitTransition);
    parallelTransition.play();
}
 
Example #2
Source File: Futurist.java    From RadialFx with GNU Lesser General Public License v3.0 6 votes vote down vote up
private void animate() {
final Animation frame3Transition = new Timeline(new KeyFrame(
	Duration.ZERO,
		new KeyValue(frame3.rotateProperty(), 0)),
	new KeyFrame(Duration.millis(6700), new KeyValue(frame3.rotateProperty(), 360)));
frame3Transition.setCycleCount(Animation.INDEFINITE);

final Animation frame4Transition = new Timeline(new KeyFrame(
	Duration.ZERO,
		new KeyValue(frame4.rotateProperty(), 0)),
	new KeyFrame(Duration.millis(12000), new KeyValue(frame4.rotateProperty(), 360)));
frame4Transition.setCycleCount(Animation.INDEFINITE);

final Animation frame5Transition = new Timeline(new KeyFrame(
	Duration.ZERO,
		new KeyValue(frame5.rotateProperty(), 0)),
	new KeyFrame(Duration.millis(9000), new KeyValue(frame5.rotateProperty(), -360)));
frame5Transition.setCycleCount(Animation.INDEFINITE);


final ParallelTransition parallelTransition = new ParallelTransition(frame3Transition, frame4Transition, frame5Transition);
parallelTransition.play();
   }
 
Example #3
Source File: LaunchScreeenController.java    From FakeImageDetection with GNU General Public License v3.0 6 votes vote down vote up
private void animate() {
    TranslateTransition tt = new TranslateTransition(Duration.millis(duration), load_image_button);
    TranslateTransition tLogo = new TranslateTransition(Duration.millis(duration), christopher);
    TranslateTransition tDesc = new TranslateTransition(Duration.millis(duration), description);

    ScaleTransition st = new ScaleTransition(Duration.millis(duration), load_image_button);
    st.setToX(3);
    st.setToY(3);

    tt.setByY(-180f);

    tLogo.setToY(50);
    tDesc.setToY(500);
    buttonParallelTransition = new ParallelTransition(load_image_button, st, tt, tLogo, tDesc);

    buttonParallelTransition.play();
    buttonParallelTransition.setOnFinished((e) -> {
        load_image_button.setOpacity(1);
    });
}
 
Example #4
Source File: CloudFadeOutStep.java    From TweetwallFX with MIT License 6 votes vote down vote up
@Override
public void doStep(final MachineContext context) {
    WordleSkin wordleSkin = (WordleSkin) context.get("WordleSkin");

    List<Transition> fadeOutTransitions = new ArrayList<>();

    Duration defaultDuration = Duration.seconds(1.5);

    // kill the remaining words from the cloud
    wordleSkin.word2TextMap.entrySet().forEach(entry -> {
        Text textNode = entry.getValue();
        FadeTransition ft = new FadeTransition(defaultDuration, textNode);
        ft.setToValue(0);
        ft.setOnFinished(event
                -> wordleSkin.getPane().getChildren().remove(textNode));
        fadeOutTransitions.add(ft);
    });
    wordleSkin.word2TextMap.clear();

    ParallelTransition fadeLOuts = new ParallelTransition();

    fadeLOuts.getChildren().addAll(fadeOutTransitions);
    fadeLOuts.setOnFinished(e -> context.proceed());
    fadeLOuts.play();
}
 
Example #5
Source File: ThreeDOM.java    From scenic-view with GNU General Public License v3.0 6 votes vote down vote up
void init3D(boolean animate) {
    maxDepth = 0;
    if (animate) {
        initialParallelTransition = new ParallelTransition();
        initialParallelTransition.setDelay(Duration.seconds(1));
        initialParallelTransition.setInterpolator(Interpolator.EASE_OUT);
    } else {
        initialParallelTransition = null;
    }

    from2Dto3D(currentRoot2D, root3D, 0);

    slider.setMax(maxDepth);
    slider.setValue(maxDepth);
    if (animate) {
        if (rotateTransition != null) {
            initialParallelTransition.getChildren().add(rotateTransition);
        }
    }
}
 
Example #6
Source File: NodeFadeOutStep.java    From TweetwallFX with MIT License 5 votes vote down vote up
@Override
public void doStep(final StepEngine.MachineContext context) {
    final WordleSkin wordleSkin = (WordleSkin) context.get("WordleSkin");
    final Set<Node> nodes = wordleSkin.getNode().lookupAll(config.getNodeSelector());

    final ParallelTransition fadeOutAll = new ParallelTransition();
    nodes.forEach(node ->  {
        fadeOutAll.getChildren().add(new FlipOutXTransition(node));
    });
    fadeOutAll.setOnFinished(e -> {
        wordleSkin.getPane().getChildren().removeAll(nodes);
        context.proceed();
    });
    fadeOutAll.play();
}
 
Example #7
Source File: GaugeSkin.java    From Enzo with Apache License 2.0 5 votes vote down vote up
private void fadeBackToInteractive() {
    FadeTransition fadeUnitOut = new FadeTransition(Duration.millis(425), unit);
    fadeUnitOut.setFromValue(1.0);
    fadeUnitOut.setToValue(0.0);
    FadeTransition fadeValueOut = new FadeTransition(Duration.millis(425), value);
    fadeValueOut.setFromValue(1.0);
    fadeValueOut.setToValue(0.0);

    PauseTransition pause = new PauseTransition(Duration.millis(50));

    FadeTransition fadeUnitIn = new FadeTransition(Duration.millis(425), unit);
    fadeUnitIn.setFromValue(0.0);
    fadeUnitIn.setToValue(1.0);
    FadeTransition fadeValueIn = new FadeTransition(Duration.millis(425), value);
    fadeValueIn.setFromValue(0.0);
    fadeValueIn.setToValue(1.0);
    ParallelTransition parallelIn = new ParallelTransition(fadeUnitIn, fadeValueIn);

    ParallelTransition parallelOut = new ParallelTransition(fadeUnitOut, fadeValueOut);
    parallelOut.setOnFinished(event -> {
        unit.setText("Interactive");
        value.setText("");
        resizeText();
    });

    SequentialTransition sequence = new SequentialTransition(parallelOut, pause, parallelIn);
    sequence.play();
}
 
Example #8
Source File: RadialBargraphSkin.java    From Enzo with Apache License 2.0 5 votes vote down vote up
private void fadeBackToInteractive() {
    FadeTransition fadeUnitOut = new FadeTransition(Duration.millis(425), unit);
    fadeUnitOut.setFromValue(1.0);
    fadeUnitOut.setToValue(0.0);
    FadeTransition fadeValueOut = new FadeTransition(Duration.millis(425), value);
    fadeValueOut.setFromValue(1.0);
    fadeValueOut.setToValue(0.0);

    PauseTransition pause = new PauseTransition(Duration.millis(50));

    FadeTransition fadeUnitIn = new FadeTransition(Duration.millis(425), unit);
    fadeUnitIn.setFromValue(0.0);
    fadeUnitIn.setToValue(1.0);
    FadeTransition fadeValueIn = new FadeTransition(Duration.millis(425), value);
    fadeValueIn.setFromValue(0.0);
    fadeValueIn.setToValue(1.0);
    ParallelTransition parallelIn = new ParallelTransition(fadeUnitIn, fadeValueIn);

    ParallelTransition parallelOut = new ParallelTransition(fadeUnitOut, fadeValueOut);
    parallelOut.setOnFinished(event -> {
        unit.setText("Interactive");
        value.setText("");
        resizeText();
    });

    SequentialTransition sequence = new SequentialTransition(parallelOut, pause, parallelIn);
    sequence.play();
}
 
Example #9
Source File: HeatControlSkin.java    From Enzo with Apache License 2.0 5 votes vote down vote up
private void fadeBack() {
    FadeTransition fadeInfoTextOut = new FadeTransition(Duration.millis(425), infoText);
    fadeInfoTextOut.setFromValue(1.0);
    fadeInfoTextOut.setToValue(0.0);
    
    FadeTransition fadeValueOut = new FadeTransition(Duration.millis(425), value);
    fadeValueOut.setFromValue(1.0);
    fadeValueOut.setToValue(0.0);

    PauseTransition pause = new PauseTransition(Duration.millis(50));

    FadeTransition fadeInfoTextIn = new FadeTransition(Duration.millis(425), infoText);
    fadeInfoTextIn.setFromValue(0.0);
    fadeInfoTextIn.setToValue(1.0);
    
    FadeTransition fadeValueIn = new FadeTransition(Duration.millis(425), value);
    fadeValueIn.setFromValue(0.0);
    fadeValueIn.setToValue(1.0);                
    
    ParallelTransition parallelIn = new ParallelTransition(fadeInfoTextIn, fadeValueIn);

    ParallelTransition parallelOut = new ParallelTransition(fadeInfoTextOut, fadeValueOut);
    parallelOut.setOnFinished(event -> {
        double currentValue = (valueIndicatorRotate.getAngle() + getSkinnable().getStartAngle() - 180) / angleStep + getSkinnable().getMinValue();
        value.setText(String.format(Locale.US, "%." + getSkinnable().getDecimals() + "f", currentValue));
        value.setTranslateX((size - value.getLayoutBounds().getWidth()) * 0.5);
        if (getSkinnable().getTarget() < getSkinnable().getValue()) {
            getSkinnable().setInfoText("COOLING");
        } else if (getSkinnable().getTarget() > getSkinnable().getValue()) {
            getSkinnable().setInfoText("HEATING");
        }
        
        resizeText();
        drawTickMarks(ticks);
        userAction = false;
    });

    SequentialTransition sequence = new SequentialTransition(parallelOut, pause, parallelIn);
    sequence.play();
}
 
Example #10
Source File: MKXMenuApp.java    From FXTutorials with MIT License 5 votes vote down vote up
private Node createLeftContent() {
    final Text inbox = new Text("You have " + messages + " new message(-s)");
    inbox.setFill(Color.WHITE);

    bgThread.scheduleAtFixedRate(() -> {
        Platform.runLater(() -> {
            TranslateTransition tt = new TranslateTransition(Duration.seconds(0.5), inbox);
            tt.setToY(150);

            FadeTransition ft = new FadeTransition(Duration.seconds(0.5), inbox);
            ft.setToValue(0);

            ParallelTransition pt = new ParallelTransition(tt, ft);
            pt.setOnFinished(e -> {
                inbox.setTranslateY(-150);
                inbox.setText("You have " + ++messages + " new message(-s)");

                TranslateTransition tt2 = new TranslateTransition(Duration.seconds(0.5), inbox);
                tt2.setToY(0);

                FadeTransition ft2 = new FadeTransition(Duration.seconds(0.5), inbox);
                ft2.setToValue(1);

                ParallelTransition pt2 = new ParallelTransition(tt2, ft2);
                pt2.play();
            });
            pt.play();
        });
    }, 2, 5, TimeUnit.SECONDS);

    return inbox;
}
 
Example #11
Source File: ImageMosaicStep.java    From TweetwallFX with MIT License 5 votes vote down vote up
private Transition createReverseHighlightAndZoomTransition(final int column, final int row) {
    ImageView randomView = rects[column][row];
    randomView.toFront();
    ParallelTransition firstParallelTransition = new ParallelTransition();
    ParallelTransition secondParallelTransition = new ParallelTransition();

    for (int i = 0; i < 6; i++) {
        for (int j = 0; j < 5; j++) {
            if ((i == column) && (j == row)) {
                continue;
            }
            FadeTransition ft = new FadeTransition(Duration.seconds(1), rects[i][j]);
            ft.setFromValue(0.3);
            ft.setToValue(1.0);
            firstParallelTransition.getChildren().add(ft);
        }
    }

    double width = pane.getWidth() / 6.0 - 10;
    double height = pane.getHeight() / 5.0 - 8;

    final SizeTransition zoomBox = new SizeTransition(Duration.seconds(2.5), randomView.fitWidthProperty(), randomView.fitHeightProperty())
            .withWidth(randomView.getLayoutBounds().getWidth(), width)
            .withHeight(randomView.getLayoutBounds().getHeight(), height);
    final LocationTransition trans = new LocationTransition(Duration.seconds(2.5), randomView)
            .withX(randomView.getLayoutX(), bounds[column][row].getMinX())
            .withY(randomView.getLayoutY(), bounds[column][row].getMinY());
    secondParallelTransition.getChildren().addAll(trans, zoomBox);

    SequentialTransition seqT = new SequentialTransition();
    seqT.getChildren().addAll(secondParallelTransition, firstParallelTransition);

    secondParallelTransition.setOnFinished(event
            -> randomView.setEffect(null));

    return seqT;
}
 
Example #12
Source File: ImageMosaicStep.java    From TweetwallFX with MIT License 5 votes vote down vote up
private void executeAnimations(final MachineContext context) {
    ImageWallAnimationTransition highlightAndZoomTransition
            = createHighlightAndZoomTransition();
    highlightAndZoomTransition.transition.play();
    highlightAndZoomTransition.transition.setOnFinished(event1 -> {
        Transition revert
                = createReverseHighlightAndZoomTransition(highlightAndZoomTransition.column, highlightAndZoomTransition.row);
        revert.setDelay(Duration.seconds(3));
        revert.play();
        revert.setOnFinished(event -> {
            count++;
            if (count < 3) {
                executeAnimations(context);
            } else {
                count = 0;
                ParallelTransition cleanup = new ParallelTransition();
                for (int i = 0; i < 6; i++) {
                    for (int j = 0; j < 5; j++) {
                        FadeTransition ft = new FadeTransition(Duration.seconds(0.5), rects[i][j]);
                        ft.setToValue(0);
                        cleanup.getChildren().addAll(ft);
                    }
                }
                cleanup.setOnFinished(cleanUpDown -> {
                    for (int i = 0; i < 6; i++) {
                        for (int j = 0; j < 5; j++) {
                            pane.getChildren().remove(rects[i][j]);
                        }
                    }
                    highlightedIndexes.clear();
                    context.proceed();
                });
                cleanup.play();
            }
        });
    });
}
 
Example #13
Source File: BackgroundController.java    From examples-javafx-repos1 with Apache License 2.0 5 votes vote down vote up
@FXML
public void initialize() {
	
	TranslateTransition translateTransition =
            new TranslateTransition(Duration.millis(10000), background1);
	translateTransition.setFromX(0);
	translateTransition.setToX(-1 * BACKGROUND_WIDTH);
	translateTransition.setInterpolator(Interpolator.LINEAR);

	TranslateTransition translateTransition2 =
           new TranslateTransition(Duration.millis(10000), background2);
	translateTransition2.setFromX(0);
	translateTransition2.setToX(-1 * BACKGROUND_WIDTH);
	translateTransition2.setInterpolator(Interpolator.LINEAR);

	parallelTransition = 
		new ParallelTransition( translateTransition, translateTransition2 );
	parallelTransition.setCycleCount(Animation.INDEFINITE);

	//
	// Sets the label of the Button based on the animation state
	//
	parallelTransition.statusProperty().addListener((obs, oldValue, newValue) -> {
		if( newValue == Animation.Status.RUNNING ) {
			btnControl.setText( "||" );
		} else {
			btnControl.setText( ">" );
		}
	});
}
 
Example #14
Source File: MainController.java    From GreenBits with GNU General Public License v3.0 5 votes vote down vote up
public void readyToGoAnimation() {
    // Buttons slide in and clickable address appears simultaneously.
    TranslateTransition arrive = new TranslateTransition(Duration.millis(1200), controlsBox);
    arrive.setInterpolator(new ElasticInterpolator(EasingMode.EASE_OUT, 1, 2));
    arrive.setToY(0.0);
    FadeTransition reveal = new FadeTransition(Duration.millis(1200), addressControl);
    reveal.setToValue(1.0);
    ParallelTransition group = new ParallelTransition(arrive, reveal);
    group.setDelay(NotificationBarPane.ANIM_OUT_DURATION);
    group.setCycleCount(1);
    group.play();
}
 
Example #15
Source File: NeuralnetInterfaceController.java    From FakeImageDetection with GNU General Public License v3.0 5 votes vote down vote up
private void removeBannersandDescs() {
    TranslateTransition tChristopher = new TranslateTransition(Duration.millis(1000), christopher);
    TranslateTransition tDescription = new TranslateTransition(Duration.millis(1000), description);
    tChristopher.setToY(-500);
    tDescription.setToY(-500);
    ParallelTransition pt = new ParallelTransition(tChristopher, tDescription);
    pt.play();

}
 
Example #16
Source File: LaunchScreeenController.java    From FakeImageDetection with GNU General Public License v3.0 5 votes vote down vote up
private void removeBannersandDescs() {
    TranslateTransition tChristopher = new TranslateTransition(Duration.millis(duration), christopher);
    TranslateTransition tDescription = new TranslateTransition(Duration.millis(duration), description);
    tChristopher.setToY(-200);
    tDescription.setToY(1000);
    ParallelTransition pt = new ParallelTransition(tChristopher, tDescription);
    pt.play();

}
 
Example #17
Source File: HighLowTileSkin.java    From tilesfx with Apache License 2.0 5 votes vote down vote up
@Override protected void handleCurrentValue(final double VALUE) {
    double deviation = calculateDeviation(VALUE);
    updateState(deviation);
    if (tile.getCustomDecimalFormatEnabled()) {
        valueText.setText(decimalFormat.format(VALUE));
    } else {
        valueText.setText(String.format(locale, formatString, VALUE));
    }
    deviationText.setText(String.format(locale, "%." + tile.getTickLabelDecimals() + "f", deviation));

    RotateTransition rotateTransition = new RotateTransition(Duration.millis(200), triangle);
    rotateTransition.setFromAngle(triangle.getRotate());
    rotateTransition.setToAngle(state.angle);

    FillTransition fillIndicatorTransition = new FillTransition(Duration.millis(200), triangle);
    fillIndicatorTransition.setFromValue((Color) triangle.getFill());
    fillIndicatorTransition.setToValue(state.color);

    FillTransition fillReferenceTransition = new FillTransition(Duration.millis(200), deviationText);
    fillReferenceTransition.setFromValue((Color) triangle.getFill());
    fillReferenceTransition.setToValue(state.color);

    FillTransition fillReferenceUnitTransition = new FillTransition(Duration.millis(200), deviationUnitText);
    fillReferenceUnitTransition.setFromValue((Color) triangle.getFill());
    fillReferenceUnitTransition.setToValue(state.color);

    ParallelTransition parallelTransition = new ParallelTransition(rotateTransition, fillIndicatorTransition, fillReferenceTransition, fillReferenceUnitTransition);
    parallelTransition.play();
}
 
Example #18
Source File: MainController.java    From green_android with GNU General Public License v3.0 5 votes vote down vote up
public void readyToGoAnimation() {
    // Buttons slide in and clickable address appears simultaneously.
    TranslateTransition arrive = new TranslateTransition(Duration.millis(1200), controlsBox);
    arrive.setInterpolator(new ElasticInterpolator(EasingMode.EASE_OUT, 1, 2));
    arrive.setToY(0.0);
    FadeTransition reveal = new FadeTransition(Duration.millis(1200), addressControl);
    reveal.setToValue(1.0);
    ParallelTransition group = new ParallelTransition(arrive, reveal);
    group.setDelay(NotificationBarPane.ANIM_OUT_DURATION);
    group.setCycleCount(1);
    group.play();
}
 
Example #19
Source File: ImprovedBackgroundController.java    From examples-javafx-repos1 with Apache License 2.0 4 votes vote down vote up
@FXML
public void initialize() {
	
	TranslateTransition background1Transition =
            new TranslateTransition(Duration.millis(8000), background1);
	background1Transition.setFromX(0);
	background1Transition.setToX(-1 * BACKGROUND_WIDTH);
	background1Transition.setInterpolator(Interpolator.LINEAR);

	TranslateTransition background2Transition =
           new TranslateTransition(Duration.millis(8000), background2);
	background2Transition.setFromX(0);
	background2Transition.setToX(-1 * BACKGROUND_WIDTH);
	background2Transition.setInterpolator(Interpolator.LINEAR);

	ParallelTransition backgroundWrapper = new ParallelTransition(
			background1Transition, background2Transition
			);
	backgroundWrapper.setCycleCount(Animation.INDEFINITE);
	
	TranslateTransition clouds1Transition =
            new TranslateTransition(Duration.millis(20000), clouds1);
	clouds1Transition.setFromX(0);
	clouds1Transition.setToX(-1 * BACKGROUND_WIDTH);
	clouds1Transition.setInterpolator(Interpolator.LINEAR);

	TranslateTransition clouds2Transition =
           new TranslateTransition(Duration.millis(20000), clouds2);
	clouds2Transition.setFromX(0);
	clouds2Transition.setToX(-1 * BACKGROUND_WIDTH);
	clouds2Transition.setInterpolator(Interpolator.LINEAR);

	ParallelTransition cloudsWrapper = new ParallelTransition(
			clouds1Transition, clouds2Transition
			);
	cloudsWrapper.setCycleCount(Animation.INDEFINITE);
	
	parallelTransition = 
		new ParallelTransition( backgroundWrapper,
								cloudsWrapper );

	parallelTransition.setCycleCount(Animation.INDEFINITE);

	//
	// Sets the label of the Button based on the animation state
	//
	parallelTransition.statusProperty().addListener((obs, oldValue, newValue) -> {
		if( newValue == Animation.Status.RUNNING ) {
			btnControl.setText( "||" );
		} else {
			btnControl.setText( ">" );
		}
	});
}
 
Example #20
Source File: MainNode.java    From helloiot with GNU General Public License v3.0 4 votes vote down vote up
public void initialize() {

        if (appexitbutton) {
            exitbutton.setVisible(true);
            exitbutton.setGraphic(IconBuilder.create(IconFontGlyph.FA_SOLID_POWER_OFF, 18.0).styleClass("icon-fill").build());
            exitbutton.setOnAction(ev -> {
                rootpane.getScene().getWindow().hide();
            });
        } else {
            exitbutton.setVisible(false);
            headerbox.getChildren().remove(exitbutton);
            exitbutton = null;
        }
        menubutton.setGraphic(IconBuilder.create(IconFontGlyph.FA_SOLID_BARS, 18.0).styleClass("icon-fill").build());
        menubutton.setDisable(true);
        
        timeindicator = new TimeIndicator(resources.getString("clock.pattern"));
        indicators.getChildren().add(timeindicator.getNode());
        
        listpagesgray.setBackground(new Background(new BackgroundFill(Color.gray(0.5, 0.75), CornerRadii.EMPTY, Insets.EMPTY)));
        FadeTransition ft = new FadeTransition(Duration.millis(300), scrollpages);
        ft.setFromValue(0.0);
        ft.setToValue(1.0);
        ft.setInterpolator(Interpolator.LINEAR);
        FadeTransition ft2 = new FadeTransition(Duration.millis(300), listpagesgray);
        ft2.setFromValue(0.0);
        ft2.setToValue(1.0);
        ft2.setInterpolator(Interpolator.LINEAR);
        TranslateTransition tt = new TranslateTransition(Duration.millis(300), scrollpages);
        tt.setFromX(-scrollpages.prefWidth(0));
        tt.setToX(0.0);
        tt.setInterpolator(Interpolator.EASE_BOTH);
        TranslateTransition tt2 = new TranslateTransition(Duration.millis(300), appcontainer);
        tt2.setFromX(0.0);
        tt2.setToX(scrollpages.prefWidth(0));
        tt2.setInterpolator(Interpolator.EASE_BOTH);
        
        listpagestransition = new ParallelTransition(ft, ft2, tt, tt2);
        listpagestransition.setRate(-1.0);
        listpagestransition.setOnFinished((ActionEvent actionEvent) -> {
            if (listpagestransition.getCurrentTime().equals(Duration.ZERO)) {
                scrollpages.setVisible(false);
                listpagesgray.setVisible(false);
            }
        });
    }
 
Example #21
Source File: FadeInCloudStep.java    From TweetwallFX with MIT License 4 votes vote down vote up
@Override
public void doStep(final MachineContext context) {
    List<Word> sortedWords = context.getDataProvider(TagCloudDataProvider.class).getWords();

    if (sortedWords.isEmpty()) {
        return;
    }

    WordleSkin wordleSkin = (WordleSkin) context.get("WordleSkin");
    List<Word> limitedWords = sortedWords.stream().limit(wordleSkin.getDisplayCloudTags()).collect(Collectors.toList());
    limitedWords.sort(Comparator.reverseOrder());

    Bounds layoutBounds = wordleSkin.getPane().getLayoutBounds();

    WordleLayout.Configuration configuration = new WordleLayout.Configuration(limitedWords, wordleSkin.getFont(), wordleSkin.getFontSizeMax(), layoutBounds);
    if (null != wordleSkin.getLogo()) {
        configuration.setBlockedAreaBounds(wordleSkin.getLogo().getBoundsInParent());
    }
    if (null != wordleSkin.getSecondLogo()) {
        configuration.setBlockedAreaBounds(wordleSkin.getSecondLogo().getBoundsInParent());
    }
    WordleLayout cloudWordleLayout = WordleLayout.createWordleLayout(configuration);
    Duration defaultDuration = Duration.seconds(1.5);

    List<Transition> fadeOutTransitions = new ArrayList<>();
    List<Transition> moveTransitions = new ArrayList<>();
    List<Transition> fadeInTransitions = new ArrayList<>();

    cloudWordleLayout.getWordLayoutInfo().entrySet().stream().forEach(entry -> {
        Word word = entry.getKey();
        Bounds bounds = entry.getValue();
        Text textNode = cloudWordleLayout.createTextNode(word);
        wordleSkin.word2TextMap.put(word, textNode);
        textNode.setLayoutX(bounds.getMinX() + layoutBounds.getWidth() / 2d);
        textNode.setLayoutY(bounds.getMinY() + layoutBounds.getHeight() / 2d + bounds.getHeight() / 2d);
        textNode.setOpacity(0);
        wordleSkin.getPane().getChildren().add(textNode);
        FadeTransition ft = new FadeTransition(defaultDuration, textNode);
        ft.setToValue(1);
        fadeInTransitions.add(ft);
    });

    ParallelTransition fadeOuts = new ParallelTransition();
    fadeOuts.getChildren().addAll(fadeOutTransitions);
    ParallelTransition moves = new ParallelTransition();
    moves.getChildren().addAll(moveTransitions);
    ParallelTransition fadeIns = new ParallelTransition();
    fadeIns.getChildren().addAll(fadeInTransitions);
    SequentialTransition morph = new SequentialTransition(fadeOuts, moves, fadeIns);

    morph.setOnFinished(e -> context.proceed());
    morph.play();
}
 
Example #22
Source File: LaunchScreeenController.java    From FakeImageDetection with GNU General Public License v3.0 4 votes vote down vote up
private void loadMetaDataCheck() {
        startSimpleMetaDataAnimation();

        MetadataProcessor processor = new MetadataProcessor(processingFile);

        bulgingTransition.setOnFinished((e) -> {
            TranslateTransition tt = new TranslateTransition(Duration.millis(duration - 500), load_image_button);
            ScaleTransition st = new ScaleTransition(Duration.millis(duration - 500), load_image_button);
            st.setToX(1);
            st.setToY(1);

            tt.setToX(-150f);
            tt.setToY(80f);

            Timeline timeline = new Timeline();
            timeline.setCycleCount(1);

            KeyValue keyValueX = new KeyValue(load_image_button.prefWidthProperty(), 400);
            KeyValue keyValueY = new KeyValue(load_image_button.prefHeightProperty(), 50);
            KeyFrame keyFrame = new KeyFrame(Duration.millis(duration - 500), keyValueX, keyValueY);
            timeline.getKeyFrames().add(keyFrame);

            ParallelTransition pt = new ParallelTransition(load_image_button, st, tt, timeline);
            pt.play();

            pt.setOnFinished((e1) -> {
                loadMetadataResult();
                load_image_button.setText("Test On AI");
                load_image_button.setFont(Font.font("Roboto", FontWeight.BOLD, 20));
                homeIcon.setVisible(true);
//                Neural Network Entry
                load_image_button.setOnMouseClicked((e2) -> {
                    System.out.println("Loading NN........");
                    try {
                        anchorPane.getChildren().clear();
                        StackPane pane = FXMLLoader.load(getClass().getResource("/resources/fxml/neuralinterface.fxml"));
                        anchorPane.getChildren().setAll(pane);
                    } catch (IOException ex) {
                        Logger.getLogger(MetadataResultController.class.getName()).log(Level.SEVERE, null, ex);
                    }
                });
            });
        });

    }
 
Example #23
Source File: Dialog.java    From LogFX with GNU General Public License v3.0 4 votes vote down vote up
public static void showMessage( String text, MessageLevel level ) {
    Platform.runLater( () -> {
        Text messageText = new Text( text );
        messageText.setWrappingWidth( Math.max( 100, primaryStage.getWidth() - 20 ) );

        Dialog dialog = new Dialog( messageText );
        dialog.setStyle( StageStyle.TRANSPARENT );
        dialog.getBox().setSpacing( 0 );
        dialog.getBox().getStyleClass().addAll( "message", level.name().toLowerCase() );

        MotionBlur blurText = new MotionBlur();
        blurText.setAngle( 0 );
        blurText.setRadius( 0 );
        messageText.setEffect( blurText );

        Animation blurAnimation = new Timeline( new KeyFrame( Duration.millis( 450 ),
                new KeyValue( blurText.angleProperty(), 45.0 ),
                new KeyValue( blurText.radiusProperty(), 20.0 ) ) );
        blurAnimation.setDelay( Duration.millis( 500 ) );

        FadeTransition hideAnimation = new FadeTransition( Duration.seconds( 1 ), dialog.getBox() );
        hideAnimation.setFromValue( 1.0 );
        hideAnimation.setToValue( 0.1 );
        hideAnimation.setInterpolator( Interpolator.EASE_IN );

        ParallelTransition allAnimations = new ParallelTransition( hideAnimation, blurAnimation );
        allAnimations.setDelay( Duration.seconds( level.getDelay() ) );
        allAnimations.setOnFinished( event -> {
            dialog.hide();
            currentMessageStages.remove( dialog.dialogStage );
        } );

        dialog.getBox().setOnMouseClicked( event -> {
            allAnimations.setDelay( Duration.seconds( 0 ) );
            allAnimations.stop();
            allAnimations.play();
        } );

        dialog.show( DialogPosition.TOP_CENTER );
        allAnimations.play();

        double yShift = 20 + currentMessageStages.stream()
                .mapToDouble( stage -> stage.getHeight() + 5.0 )
                .sum();

        StageTranslateTransition shiftDown = new StageTranslateTransition( dialog.dialogStage );
        shiftDown.setToY( yShift );
        shiftDown.setDuration( Duration.millis( 250.0 ) );
        shiftDown.setInterpolator( Interpolator.EASE_BOTH );
        shiftDown.play();

        currentMessageStages.add( dialog.dialogStage );
    } );
}
 
Example #24
Source File: StockTileSkin.java    From tilesfx with Apache License 2.0 4 votes vote down vote up
@Override protected void handleCurrentValue(final double VALUE) {
    low  = Statistics.getMin(dataList);
    high = Statistics.getMax(dataList);
    if (Helper.equals(low, high)) {
        low  = minValue;
        high = maxValue;
    }
    range = high - low;

    double minX           = graphBounds.getX();
    double maxX           = minX + graphBounds.getWidth();
    double minY           = graphBounds.getY();
    double maxY           = minY + graphBounds.getHeight();
    double stepX          = graphBounds.getWidth() / (noOfDatapoints - 1);
    double stepY          = graphBounds.getHeight() / range;
    double referenceValue = tile.getReferenceValue();

    if(!dataList.isEmpty()) {
        MoveTo begin = (MoveTo) pathElements.get(0);
        begin.setX(minX);
        begin.setY(maxY - Math.abs(low - dataList.get(0)) * stepY);
        for (int i = 1; i < (noOfDatapoints - 1); i++) {
            LineTo lineTo = (LineTo) pathElements.get(i);
            lineTo.setX(minX + i * stepX);
            lineTo.setY(maxY - Math.abs(low - dataList.get(i)) * stepY);
        }
        LineTo end = (LineTo) pathElements.get(noOfDatapoints - 1);
        end.setX(maxX);
        end.setY(maxY - Math.abs(low - dataList.get(noOfDatapoints - 1)) * stepY);

        dot.setCenterX(maxX);
        dot.setCenterY(end.getY());

        updateState(VALUE, referenceValue);

        referenceLine.setStartY(maxY - Math.abs(low - referenceValue) * stepY);
        referenceLine.setEndY(maxY - Math.abs(low - referenceValue) * stepY);

        changeText.setText(String.format(locale, "%." + tile.getTickLabelDecimals() + "f", (VALUE - referenceValue)));

        StringBuilder changePercentageTextBuilder = new StringBuilder();
        if (Double.compare(tile.getReferenceValue(), 0.0) == 0) {
            changePercentageTextBuilder.append(String.format(locale, "%." + tile.getTickLabelDecimals() + "f", 0.0));
        } else {
            changePercentageTextBuilder.append(String.format(locale, "%." + tile.getTickLabelDecimals() + "f", (VALUE / tile.getReferenceValue() * 100.0) - 100.0));
        }
        changePercentageTextBuilder.append(Helper.PERCENTAGE);
        changePercentageText.setText(changePercentageTextBuilder.toString());

        RotateTransition rotateTransition = new RotateTransition(Duration.millis(200), triangle);
        rotateTransition.setFromAngle(triangle.getRotate());
        rotateTransition.setToAngle(state.angle);

        FillTransition fillIndicatorTransition = new FillTransition(Duration.millis(200), triangle);
        fillIndicatorTransition.setFromValue((Color) triangle.getFill());
        fillIndicatorTransition.setToValue(state.color);

        FillTransition fillReferenceTransition = new FillTransition(Duration.millis(200), changePercentageText);
        fillReferenceTransition.setFromValue((Color) triangle.getFill());
        fillReferenceTransition.setToValue(state.color);

        ParallelTransition parallelTransition = new ParallelTransition(rotateTransition, fillIndicatorTransition, fillReferenceTransition);
        parallelTransition.play();
    }
    if (tile.getCustomDecimalFormatEnabled()) {
        valueText.setText(decimalFormat.format(VALUE));
    } else {
        valueText.setText(String.format(locale, formatString, VALUE));
    }

    highText.setText(String.format(locale, formatString, high));
    lowText.setText(String.format(locale, formatString, low));

    if (!tile.isTextVisible() && null != movingAverage.getTimeSpan()) {
        timeSpanText.setText(createTimeSpanText());
        text.setText(timeFormatter.format(movingAverage.getLastEntry().getTimestampAsDateTime(tile.getZoneId())));

    }
    resizeDynamicText();
}
 
Example #25
Source File: RadialMenu.java    From Enzo with Apache License 2.0 4 votes vote down vote up
public void click(final MenuItem CLICKED_ITEM) {
    List<Transition> transitions = new ArrayList<>(items.size() * 2);
    for (Parent node : items.keySet()) {
        if (items.get(node).equals(CLICKED_ITEM)) {
            // Add enlarge transition to selected item
            ScaleTransition enlargeItem = new ScaleTransition(Duration.millis(300), node);
            enlargeItem.setToX(5.0);
            enlargeItem.setToY(5.0);
            transitions.add(enlargeItem);
        } else {
            // Add shrink transition to all other items
            ScaleTransition shrinkItem = new ScaleTransition(Duration.millis(300), node);
            shrinkItem.setToX(0.0);
            shrinkItem.setToY(0.0);
            transitions.add(shrinkItem);
        }
        // Add fade out transition to every node
        FadeTransition fadeOutItem = new FadeTransition(Duration.millis(300), node);
        fadeOutItem.setToValue(0.0);
        transitions.add(fadeOutItem);
    }

    // Add rotate and fade transition to main menu button
    if (options.isButtonHideOnSelect()) {
        RotateTransition rotateMainButton = new RotateTransition(Duration.millis(300), mainMenuButton);
        rotateMainButton.setToAngle(225);
        transitions.add(rotateMainButton);
        FadeTransition fadeOutMainButton = new FadeTransition(Duration.millis(300), mainMenuButton);
        fadeOutMainButton.setToValue(0.0);
        transitions.add(fadeOutMainButton);
        ScaleTransition shrinkMainButton = new ScaleTransition(Duration.millis(300), mainMenuButton);
        shrinkMainButton.setToX(0.0);
        shrinkMainButton.setToY(0.0);
        transitions.add(shrinkMainButton);
    } else {
        RotateTransition rotateBackMainButton = new RotateTransition();
        rotateBackMainButton.setNode(cross);
        rotateBackMainButton.setToAngle(0);
        rotateBackMainButton.setDuration(Duration.millis(200));
        rotateBackMainButton.setInterpolator(Interpolator.EASE_BOTH);
        transitions.add(rotateBackMainButton);
        FadeTransition mainButtonFadeOut = new FadeTransition();
        mainButtonFadeOut.setNode(mainMenuButton);
        mainButtonFadeOut.setDuration(Duration.millis(100));
        mainButtonFadeOut.setToValue(options.getButtonAlpha());
        transitions.add(mainButtonFadeOut);
    }

    // Play all transitions in parallel
    ParallelTransition selectTransition = new ParallelTransition();
    selectTransition.getChildren().addAll(transitions);
    selectTransition.play();

    // Set menu state back to closed
    setState(State.CLOSED);
    mainMenuButton.setOpen(false);
}
 
Example #26
Source File: StockTileSkin.java    From OEE-Designer with MIT License 4 votes vote down vote up
@Override protected void handleCurrentValue(final double VALUE) {
    low  = Statistics.getMin(dataList);
    high = Statistics.getMax(dataList);
    if (Helper.equals(low, high)) {
        low  = minValue;
        high = maxValue;
    }
    range = high - low;

    double minX           = graphBounds.getX();
    double maxX           = minX + graphBounds.getWidth();
    double minY           = graphBounds.getY();
    double maxY           = minY + graphBounds.getHeight();
    double stepX          = graphBounds.getWidth() / (noOfDatapoints - 1);
    double stepY          = graphBounds.getHeight() / range;
    double referenceValue = tile.getReferenceValue();

    if(!dataList.isEmpty()) {
        MoveTo begin = (MoveTo) pathElements.get(0);
        begin.setX(minX);
        begin.setY(maxY - Math.abs(low - dataList.get(0)) * stepY);
        for (int i = 1; i < (noOfDatapoints - 1); i++) {
            LineTo lineTo = (LineTo) pathElements.get(i);
            lineTo.setX(minX + i * stepX);
            lineTo.setY(maxY - Math.abs(low - dataList.get(i)) * stepY);
        }
        LineTo end = (LineTo) pathElements.get(noOfDatapoints - 1);
        end.setX(maxX);
        end.setY(maxY - Math.abs(low - dataList.get(noOfDatapoints - 1)) * stepY);

        dot.setCenterX(maxX);
        dot.setCenterY(end.getY());

        updateState(VALUE, referenceValue);

        referenceLine.setStartY(maxY - Math.abs(low - referenceValue) * stepY);
        referenceLine.setEndY(maxY - Math.abs(low - referenceValue) * stepY);

        changeText.setText(String.format(locale, "%." + tile.getTickLabelDecimals() + "f", (VALUE - referenceValue)));
        changePercentageText.setText(new StringBuilder().append(String.format(locale, "%." + tile.getTickLabelDecimals() + "f", (VALUE / referenceValue * 100.0) - 100.0)).append("\u0025").toString());

        RotateTransition rotateTransition = new RotateTransition(Duration.millis(200), triangle);
        rotateTransition.setFromAngle(triangle.getRotate());
        rotateTransition.setToAngle(state.angle);

        FillTransition fillIndicatorTransition = new FillTransition(Duration.millis(200), triangle);
        fillIndicatorTransition.setFromValue((Color) triangle.getFill());
        fillIndicatorTransition.setToValue(state.color);

        FillTransition fillReferenceTransition = new FillTransition(Duration.millis(200), changePercentageText);
        fillReferenceTransition.setFromValue((Color) triangle.getFill());
        fillReferenceTransition.setToValue(state.color);

        ParallelTransition parallelTransition = new ParallelTransition(rotateTransition, fillIndicatorTransition, fillReferenceTransition);
        parallelTransition.play();
    }
    valueText.setText(String.format(locale, formatString, VALUE));

    highText.setText(String.format(locale, formatString, high));
    lowText.setText(String.format(locale, formatString, low));

    if (!tile.isTextVisible() && null != movingAverage.getTimeSpan()) {
        timeSpanText.setText(createTimeSpanText());
        text.setText(timeFormatter.format(movingAverage.getLastEntry().getTimestampAsDateTime(tile.getZoneId())));

    }
    resizeDynamicText();
}
 
Example #27
Source File: LoginFader.java    From iliasDownloaderTool with GNU General Public License v2.0 4 votes vote down vote up
public LoginFader(Dashboard dashboard, double c, GridPane login) {
	this.dashboard = dashboard;
	this.c = c;
	this.login = login;
	p = new ParallelTransition();
}
 
Example #28
Source File: LoginFader.java    From iliasDownloaderTool with GNU General Public License v2.0 4 votes vote down vote up
public ParallelTransition getT() {
	return p;
}