javafx.animation.Animation.Status Java Examples
The following examples show how to use
javafx.animation.Animation.Status.
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: SidesPaneSkin.java From chart-fx with Apache License 2.0 | 6 votes |
private void show(final Side side) { if (hideTimeline[side.ordinal()] != null) { hideTimeline[side.ordinal()].stop(); } if (showTimeline[side.ordinal()] != null && showTimeline[side.ordinal()].getStatus() == Status.RUNNING) { return; } final KeyValue[] keyValues = new KeyValue[Side.values().length]; keyValues[side.ordinal()] = new KeyValue(visibility[side.ordinal()], 1); final Duration delay = getSkinnable().getAnimationDelay() != null ? getSkinnable().getAnimationDelay() : Duration.millis(300); final Duration duration = getSkinnable().getAnimationDuration() != null ? getSkinnable().getAnimationDuration() : Duration.millis(200); final KeyFrame keyFrame = new KeyFrame(duration, keyValues); showTimeline[side.ordinal()] = new Timeline(keyFrame); showTimeline[side.ordinal()].setDelay(delay); showTimeline[side.ordinal()].play(); }
Example #2
Source File: TargetView.java From ShootOFF with GNU General Public License v3.0 | 6 votes |
@Override public void reverseAnimation(TargetRegion region) { if (region.getType() != RegionType.IMAGE) { logger.error("A reversal was requested on a non-image region."); return; } final ImageRegion imageRegion = (ImageRegion) region; if (imageRegion.getAnimation().isPresent()) { final SpriteAnimation animation = imageRegion.getAnimation().get(); if (animation.getStatus() == Status.RUNNING) { animation.setOnFinished((e) -> { animation.reverse(); animation.setOnFinished(null); }); } else { animation.reverse(); } } else { logger.error("A reversal was requested on an image region that isn't animated."); } }
Example #3
Source File: SidesPaneSkin.java From chart-fx with Apache License 2.0 | 5 votes |
private void hide(final Side side) { if (showTimeline[side.ordinal()] != null) { showTimeline[side.ordinal()].stop(); } if (hideTimeline[side.ordinal()] != null && hideTimeline[side.ordinal()].getStatus() == Status.RUNNING) { return; } boolean sideVisible = visibility[side.ordinal()].get() > 0; // nothing to do here if (!sideVisible) { return; } final KeyValue[] keyValues = new KeyValue[Side.values().length]; keyValues[side.ordinal()] = new KeyValue(visibility[side.ordinal()], 0); final Duration delay = getSkinnable().getAnimationDelay() != null ? getSkinnable().getAnimationDelay() : Duration.millis(300); final Duration duration = getSkinnable().getAnimationDuration() != null ? getSkinnable().getAnimationDuration() : Duration.millis(200); final KeyFrame keyFrame = new KeyFrame(duration, keyValues); hideTimeline[side.ordinal()] = new Timeline(keyFrame); hideTimeline[side.ordinal()].setDelay(delay); hideTimeline[side.ordinal()].play(); }
Example #4
Source File: MainController.java From MusicPlayer with MIT License | 5 votes |
private void expandSideBar() { if (expandAnimation.statusProperty().get() == Animation.Status.STOPPED && collapseAnimation.statusProperty().get() == Animation.Status.STOPPED) { expandAnimation.play(); } }
Example #5
Source File: MainController.java From MusicPlayer with MIT License | 5 votes |
private void collapseSideBar() { if (expandAnimation.statusProperty().get() == Animation.Status.STOPPED && collapseAnimation.statusProperty().get() == Animation.Status.STOPPED) { collapseAnimation.play(); } }
Example #6
Source File: PlaylistsController.java From MusicPlayer with MIT License | 5 votes |
@FXML private void deletePlaylist() { if (!deletePlaylistAnimation.getStatus().equals(Status.RUNNING)) { // Gets the title of the selected playlist to compare it against the labels of the playlist boxes. String selectedPlaylistTitle = selectedPlaylist.getTitle(); // Gets the playlist box children to loop through each to find the correct child to remove. ObservableList<Node> playlistBoxChildren = MusicPlayer.getMainController().getPlaylistBox().getChildren(); // Initialize i at 1 to ignore the new playlist cell. for (int i = 1; i <= playlistBoxChildren.size(); i++) { // Gets each cell in the playlist box and retrieves the cell's label. cell = (HBox) playlistBoxChildren.get(i); Label cellLabel = (Label) cell.getChildren().get(1); // Ends the process if the cell's label matches the selected playlist's title. if (cellLabel.getText().equals(selectedPlaylistTitle)) { break; } } deletePlaylistAnimation.play(); // Deletes the play list from the xml file. XMLEditor.deletePlaylistFromXML(selectedPlaylist.getId()); // Loads the artists view. MusicPlayer.getMainController().loadView("artists"); // Removes the selected playlist from the library so that it is not reloaded. Library.removePlaylist(selectedPlaylist); // Resets the selected playlist to avoid storing the deleted playlist's data. selectedPlaylist = null; } }
Example #7
Source File: JFXNodesList.java From JFoenix with Apache License 2.0 | 5 votes |
/** * Animates the list to show/hide the nodes. */ public void animateList() { expanded = !expanded; if (animateTimeline.getStatus() == Status.RUNNING) { animateTimeline.stop(); } animateTimeline.getKeyFrames().clear(); createAnimation(expanded, animateTimeline); animateTimeline.play(); }
Example #8
Source File: JFXDatePickerContent.java From JFoenix with Apache License 2.0 | 5 votes |
protected void forward(int offset, ChronoUnit unit, boolean focusDayCell, boolean withAnimation) { if (withAnimation) { if (tempImageTransition == null || tempImageTransition.getStatus() == Status.STOPPED) { Pane monthContent = (Pane) calendarPlaceHolder.getChildren().get(0); this.getParent().setManaged(false); SnapshotParameters snapShotparams = new SnapshotParameters(); snapShotparams.setFill(Color.TRANSPARENT); WritableImage temp = monthContent.snapshot(snapShotparams, new WritableImage((int) monthContent.getWidth(), (int) monthContent.getHeight())); ImageView tempImage = new ImageView(temp); calendarPlaceHolder.getChildren().add(calendarPlaceHolder.getChildren().size() - 2, tempImage); TranslateTransition imageTransition = new TranslateTransition(Duration.millis(160), tempImage); imageTransition.setToX(-offset * calendarPlaceHolder.getWidth()); imageTransition.setOnFinished((finish) -> calendarPlaceHolder.getChildren().remove(tempImage)); monthContent.setTranslateX(offset * calendarPlaceHolder.getWidth()); TranslateTransition contentTransition = new TranslateTransition(Duration.millis(160), monthContent); contentTransition.setToX(0); tempImageTransition = new ParallelTransition(imageTransition, contentTransition); tempImageTransition.setOnFinished((finish) -> { calendarPlaceHolder.getChildren().remove(tempImage); this.getParent().setManaged(true); }); tempImageTransition.play(); } } YearMonth yearMonth = selectedYearMonth.get(); DateCell dateCell = currentFocusedDayCell; if (dateCell == null || !(dayCellDate(dateCell).getMonth() == yearMonth.getMonth())) { dateCell = findDayCellOfDate(yearMonth.atDay(1)); } goToDayCell(dateCell, offset, unit, focusDayCell); }
Example #9
Source File: LogButton.java From pdfsam with GNU Affero General Public License v3.0 | 5 votes |
void hasUnseenErrors(boolean value) { if (value) { if (!(anim.getStatus() == Status.RUNNING)) { anim.play(); } if (!getStyleClass().contains(HAS_ERRORS_CSS_CLASS)) { getStyleClass().add(HAS_ERRORS_CSS_CLASS); } } else { getStyleClass().remove(HAS_ERRORS_CSS_CLASS); anim.stop(); setRotate(0); setScaleY(1); } }
Example #10
Source File: HoverGesture.java From gef with Eclipse Public License 2.0 | 5 votes |
/** * Updates the hover intent position (and restarts the hover intent delay) * if the mouse was moved too much. * * @param event * The {@link MouseEvent}. */ private void updateHoverIntentPosition(MouseEvent event) { if (hoverIntentDelay.getStatus().equals(Status.RUNNING)) { double dx = hoverIntentScreenPosition.x - event.getScreenX(); double dy = hoverIntentScreenPosition.y - event.getScreenY(); double threshold = getHoverIntentMouseMoveThreshold(); if (Math.abs(dx) > threshold || Math.abs(dy) > threshold) { hoverIntentDelay.playFromStart(); hoverIntentScreenPosition.x = event.getScreenX(); hoverIntentScreenPosition.y = event.getScreenY(); } } }
Example #11
Source File: StopWatch.java From netbeans with Apache License 2.0 | 5 votes |
public void stopReset() { if (time.getStatus() != Status.STOPPED) { // if started, stop it time.stop(); lastClockTime = 0; } else { // if stopped, reset it lastClockTime = 0; elapsedMillis = 0; refreshTimeDisplay(0, 0, 0); } }
Example #12
Source File: StopWatch.java From netbeans with Apache License 2.0 | 5 votes |
public void startStop() { if (time.getStatus() != Status.STOPPED) { // if started, stop it time.stop(); lastClockTime = 0; } else { // if stopped, restart time.play(); } }
Example #13
Source File: StopWatchSample.java From marathonv5 with Apache License 2.0 | 5 votes |
public void stopReset() { if (time.getStatus() != Status.STOPPED) { // if started, stop it time.stop(); lastClockTime = 0; } else { // if stopped, reset it lastClockTime = 0; elapsedMillis = 0; refreshTimeDisplay(0, 0, 0); } }
Example #14
Source File: StopWatchSample.java From marathonv5 with Apache License 2.0 | 5 votes |
public void startStop() { if (time.getStatus() != Status.STOPPED) { // if started, stop it time.stop(); lastClockTime = 0; } else { // if stopped, restart time.play(); } }
Example #15
Source File: StopWatchSample.java From marathonv5 with Apache License 2.0 | 5 votes |
public void stopReset() { if (time.getStatus() != Status.STOPPED) { // if started, stop it time.stop(); lastClockTime = 0; } else { // if stopped, reset it lastClockTime = 0; elapsedMillis = 0; refreshTimeDisplay(0, 0, 0); } }
Example #16
Source File: StopWatchSample.java From marathonv5 with Apache License 2.0 | 5 votes |
public void startStop() { if (time.getStatus() != Status.STOPPED) { // if started, stop it time.stop(); lastClockTime = 0; } else { // if stopped, restart time.play(); } }
Example #17
Source File: ValidableTextField.java From pdfsam with GNU Affero General Public License v3.0 | 4 votes |
private void showTooltip() { if (activationTimer.getStatus() != Status.RUNNING) { activationTimer.stop(); activationTimer.playFromStart(); } }
Example #18
Source File: CaptureController.java From logbook-kai with MIT License | 4 votes |
/** * タイムラインを停止 */ private void stopTimeLine() { if (this.timeline.getStatus() == Status.RUNNING) { this.timeline.stop(); } }
Example #19
Source File: CaptureController.java From logbook-kai with MIT License | 4 votes |
@FXML void capture(ActionEvent event) { boolean running = this.timeline.getStatus() == Status.RUNNING; if (running) { this.stopTimeLine(); } if (this.processRunning) { this.stopProcess(); } if (this.cyclic.isSelected()) { // 動画撮影中ではない this.processRunning = false; // 周期キャプチャの場合 if (running) { // キャプチャボタンテキストの変更 this.setCatureButtonState(ButtonState.START); } else { // キャプチャ中で無ければ開始する this.timeline.setCycleCount(Animation.INDEFINITE); this.timeline.getKeyFrames().clear(); this.timeline.getKeyFrames() .add(new KeyFrame(javafx.util.Duration.millis(100), this::captureAction)); this.timeline.play(); // キャプチャボタンテキストの変更 this.setCatureButtonState(ButtonState.STOP); } } else if (this.movie.isSelected()) { if (this.processRunning) { // キャプチャボタンテキストの変更 this.setCatureButtonState(ButtonState.START); this.processRunning = false; } else { // キャプチャ中で無ければ開始する this.startProcess(); this.processRunning = true; // キャプチャボタンテキストの変更 this.setCatureButtonState(ButtonState.STOP); } } else { // 動画撮影中ではない this.processRunning = false; this.captureAction(event); } }
Example #20
Source File: JFXColorPickerUI.java From JFoenix with Apache License 2.0 | 4 votes |
public void moveToColor(Color color) { allowColorChange = false; double max = Math.max(color.getRed(), Math.max(color.getGreen(), color.getBlue())), min = Math.min(color.getRed(), Math.min(color.getGreen(), color.getBlue())); double hue = 0; double l = (max + min) / 2; double s = 0; if (max == min) { hue = s = 0; // achromatic } else { double d = max - min; s = l > 0.5 ? d / (2 - max - min) : d / (max + min); if (max == color.getRed()) { hue = (color.getGreen() - color.getBlue()) / d + (color.getGreen() < color.getBlue() ? 6 : 0); } else if (max == color.getGreen()) { hue = (color.getBlue() - color.getRed()) / d + 2; } else if (max == color.getBlue()) { hue = (color.getRed() - color.getGreen()) / d + 4; } hue /= 6; } currentHue = map(hue, 0, 1, 0, 255); // Animate Hue double theta = map(currentHue, 0, 255, -Math.PI, Math.PI); double x = centerX + huesRadius * Math.cos(theta); double y = centerY + huesRadius * Math.sin(theta); colorsTransition = new CurveTransition(new Point2D(colorSelector.getTranslateX() + colorSelector.getPrefWidth() / 2, colorSelector.getTranslateY() + colorSelector.getPrefHeight() / 2), new Point2D(x, y)); // Animate SL s = map(s, 0, 1, 0, 255); l = map(l, 0, 1, 0, 255); Point2D point = getPointFromSL((int) s, (int) l, slRadius); double pX = centerX - point.getX(); double pY = centerY - point.getY(); double endPointX; double endPointY; if (Math.pow(pX - centerX, 2) + Math.pow(pY - centerY, 2) < Math.pow(slRadius - 2, 2)) { endPointX = pX - selector.getPrefWidth() / 2; endPointY = pY - selector.getPrefHeight() / 2; } else { double dx = pX - centerX; double dy = pY - centerY; theta = Math.atan2(dy, dx); x = centerX + (slRadius - 2) * Math.cos(theta); y = centerY + (slRadius - 2) * Math.sin(theta); endPointX = x - selector.getPrefWidth() / 2; endPointY = y - selector.getPrefHeight() / 2; } selectorTransition = new CachedTransition(selector, new Timeline(new KeyFrame(Duration.millis(1000), new KeyValue(selector.translateXProperty(), endPointX, Interpolator.EASE_BOTH), new KeyValue(selector.translateYProperty(), endPointY, Interpolator.EASE_BOTH)))) {{ setCycleDuration(Duration.millis(160)); setDelay(Duration.seconds(0)); }}; if (pTrans != null) { pTrans.stop(); } pTrans = new ParallelTransition(colorsTransition, selectorTransition); pTrans.setOnFinished((finish) -> { if (pTrans.getStatus() == Status.STOPPED) { allowColorChange = true; } }); pTrans.play(); refreshHSLCircle(); }
Example #21
Source File: JFXPopupSkin.java From JFoenix with Apache License 2.0 | 4 votes |
public final void animate() { if (animation.getStatus() == Status.STOPPED) { animation.play(); } }