Java Code Examples for javafx.animation.ParallelTransition#play()

The following examples show how to use javafx.animation.ParallelTransition#play() . 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: 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 3
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 4
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 5
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 6
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 7
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 8
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 9
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 10
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 11
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 12
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 13
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);
}