javafx.animation.FillTransition Java Examples
The following examples show how to use
javafx.animation.FillTransition.
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 |
@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: MidiApp.java From FXTutorials with MIT License | 6 votes |
private void onKeyPress(KeyCode key) { root.getChildren() .stream() .map(view -> (NoteView) view) .filter(view -> view.note.key.equals(key)) .forEach(view -> { FillTransition ft = new FillTransition( Duration.seconds(0.15), view.bg, Color.WHITE, Color.BLACK ); ft.setCycleCount(2); ft.setAutoReverse(true); ft.play(); channel.noteOn(view.note.number, 90); }); }
Example #3
Source File: HighLowTileSkin.java From tilesfx with Apache License 2.0 | 5 votes |
@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 #4
Source File: MenuItem.java From FXTutorials with MIT License | 5 votes |
public void setOnAction(Runnable action) { setOnMouseClicked(e -> { FillTransition ft = new FillTransition(Duration.seconds(0.45), selection, Color.YELLOW, Colors.MENU_ITEM_SELECTION); ft.setOnFinished(e2 -> action.run()); ft.play(); }); }
Example #5
Source File: StockTileSkin.java From OEE-Designer with MIT License | 4 votes |
@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 #6
Source File: StockTileSkin.java From tilesfx with Apache License 2.0 | 4 votes |
@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(); }