use of javafx.animation.SequentialTransition in project fx2048 by brunoborges.
the class GameManager method animateMergedTile.
/**
* Animation that creates a pop effect when two tiles merge
* by increasing the tile scale to 120% at the middle, and then going back to 100%
* @param tile to be animated
* @return a sequential transition
*/
private SequentialTransition animateMergedTile(Tile tile) {
final ScaleTransition scale0 = new ScaleTransition(ANIMATION_MERGED_TILE, tile);
scale0.setToX(1.2);
scale0.setToY(1.2);
scale0.setInterpolator(Interpolator.EASE_IN);
final ScaleTransition scale1 = new ScaleTransition(ANIMATION_MERGED_TILE, tile);
scale1.setToX(1.0);
scale1.setToY(1.0);
scale1.setInterpolator(Interpolator.EASE_OUT);
return new SequentialTransition(scale0, scale1);
}
use of javafx.animation.SequentialTransition in project Board-Instrumentation-Framework by intel.
the class RadialBargraphSkin method fadeBackToInteractive.
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();
}
use of javafx.animation.SequentialTransition in project Board-Instrumentation-Framework by intel.
the class HeatControlSkin method fadeBack.
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();
}
use of javafx.animation.SequentialTransition in project Board-Instrumentation-Framework by intel.
the class GaugeSkin method fadeBackToInteractive.
private void fadeBackToInteractive() {
FadeTransition fadeUnitOut = new FadeTransition(Duration.millis(425), unitText);
fadeUnitOut.setFromValue(1.0);
fadeUnitOut.setToValue(0.0);
FadeTransition fadeValueOut = new FadeTransition(Duration.millis(425), valueText);
fadeValueOut.setFromValue(1.0);
fadeValueOut.setToValue(0.0);
PauseTransition pause = new PauseTransition(Duration.millis(50));
FadeTransition fadeUnitIn = new FadeTransition(Duration.millis(425), unitText);
fadeUnitIn.setFromValue(0.0);
fadeUnitIn.setToValue(1.0);
FadeTransition fadeValueIn = new FadeTransition(Duration.millis(425), valueText);
fadeValueIn.setFromValue(0.0);
fadeValueIn.setToValue(1.0);
ParallelTransition parallelIn = new ParallelTransition(fadeUnitIn, fadeValueIn);
ParallelTransition parallelOut = new ParallelTransition(fadeUnitOut, fadeValueOut);
parallelOut.setOnFinished(event -> {
unitText.setText("Interactive");
valueText.setText("");
resizeText();
});
SequentialTransition sequence = new SequentialTransition(parallelOut, pause, parallelIn);
sequence.play();
}
use of javafx.animation.SequentialTransition in project tilesfx by HanSolo.
the class SmoothAreaChartTileSkin method initGraphics.
// ******************** Initialization ************************************
@Override
protected void initGraphics() {
super.initGraphics();
chartEventListener = e -> handleData();
chartDataListener = c -> {
while (c.next()) {
if (c.wasAdded()) {
c.getAddedSubList().forEach(addedItem -> addedItem.addChartDataEventListener(chartEventListener));
} else if (c.wasRemoved()) {
c.getRemoved().forEach(removedItem -> removedItem.removeChartDataEventListener(chartEventListener));
}
}
handleData();
};
clickHandler = e -> select(e);
endOfTransformationHandler = e -> selectorTooltip.hide();
smoothing = tile.isSmoothing();
titleText = new Text();
titleText.setFill(tile.getTitleColor());
Helper.enableNode(titleText, !tile.getTitle().isEmpty());
fillClip = new Rectangle(0, 0, PREFERRED_WIDTH, PREFERRED_HEIGHT);
strokeClip = new Rectangle(0, 0, PREFERRED_WIDTH, PREFERRED_HEIGHT);
points = new ArrayList<>();
fillPath = new Path();
fillPath.setStroke(null);
fillPath.setClip(fillClip);
strokePath = new Path();
strokePath.setFill(null);
strokePath.setStroke(tile.getBarColor());
strokePath.setClip(strokeClip);
strokePath.setMouseTransparent(true);
Helper.enableNode(fillPath, ChartType.AREA == tile.getChartType());
canvas = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT);
canvas.setMouseTransparent(true);
ctx = canvas.getGraphicsContext2D();
dataPointsVisible = tile.getDataPointsVisible();
valueText = new Text(String.format(locale, formatString, ((tile.getValue() - minValue) / range * 100)));
valueText.setFill(tile.getValueColor());
valueText.setTextOrigin(VPos.BASELINE);
Helper.enableNode(valueText, tile.isValueVisible());
unitText = new Text(" " + tile.getUnit());
unitText.setFill(tile.getUnitColor());
unitText.setTextOrigin(VPos.BASELINE);
Helper.enableNode(unitText, !tile.getUnit().isEmpty());
valueUnitFlow = new TextFlow(valueText, unitText);
valueUnitFlow.setTextAlignment(TextAlignment.RIGHT);
selector = new Circle();
selectorTooltip = new Tooltip("");
selectorTooltip.setWidth(60);
selectorTooltip.setHeight(48);
Tooltip.install(selector, selectorTooltip);
FadeTransition fadeIn = new FadeTransition(Duration.millis(100), selector);
fadeIn.setFromValue(0);
fadeIn.setToValue(1);
FadeTransition fadeOut = new FadeTransition(Duration.millis(100), selector);
fadeOut.setFromValue(1);
fadeOut.setToValue(0);
fadeInFadeOut = new SequentialTransition(fadeIn, new PauseTransition(Duration.millis(3000)), fadeOut);
handleData();
getPane().getChildren().addAll(titleText, fillPath, strokePath, canvas, valueUnitFlow, selector);
}
Aggregations