Java Code Examples for javafx.animation.Animation.Status#RUNNING

The following examples show how to use javafx.animation.Animation.Status#RUNNING . 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 vote down vote up
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 vote down vote up
@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 vote down vote up
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: JFXNodesList.java    From JFoenix with Apache License 2.0 5 votes vote down vote up
/**
 * 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 5
Source File: LogButton.java    From pdfsam with GNU Affero General Public License v3.0 5 votes vote down vote up
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 6
Source File: CaptureController.java    From logbook-kai with MIT License 4 votes vote down vote up
@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 7
Source File: CaptureController.java    From logbook-kai with MIT License 4 votes vote down vote up
/**
 * タイムラインを停止
 */
private void stopTimeLine() {
    if (this.timeline.getStatus() == Status.RUNNING) {
        this.timeline.stop();
    }
}
 
Example 8
Source File: ValidableTextField.java    From pdfsam with GNU Affero General Public License v3.0 4 votes vote down vote up
private void showTooltip() {
    if (activationTimer.getStatus() != Status.RUNNING) {
        activationTimer.stop();
        activationTimer.playFromStart();
    }
}