Java 类javafx.animation.Animation.Status 实例源码

项目:tilesfx    文件:Tile.java   
/**
 * Sets the minimum value of the gauge scale to the given value
 *
 * @param VALUE
 */
public void setMinValue(final double VALUE) {
    if (Status.RUNNING == timeline.getStatus()) { timeline.jumpTo(Duration.ONE); }
    if (null == minValue) {
        if (VALUE > getMaxValue()) { setMaxValue(VALUE); }
        _minValue = clamp(-Double.MAX_VALUE, getMaxValue(), VALUE);
        setRange(getMaxValue() - _minValue);
        if (Helper.equals(originalMinValue, -Double.MAX_VALUE)) originalMinValue = _minValue;
        if (isStartFromZero() && _minValue < 0) setValue(0);
        if (Helper.equals(originalThreshold, getThreshold())) { setThreshold(clamp(_minValue, getMaxValue(), originalThreshold)); }
        fireTileEvent(RECALC_EVENT);
        if (!valueProperty().isBound()) Tile.this.setValue(clamp(getMinValue(), getMaxValue(), Tile.this.getValue()));
    } else {
        minValue.set(VALUE);
    }
}
项目:Medusa    文件:Gauge.java   
/**
 * Sets the minimum value of the gauge scale to the given value
 *
 * @param VALUE
 */
public void setMinValue(final double VALUE) {
    if (Status.RUNNING == timeline.getStatus()) { timeline.jumpTo(Duration.ONE); }
    if (null == minValue) {
        if (VALUE > getMaxValue()) { setMaxValue(VALUE); }
        _minValue = Helper.clamp(-Double.MAX_VALUE, getMaxValue(), VALUE);
        setRange(getMaxValue() - _minValue);
        if (Double.compare(originalMinValue, -Double.MAX_VALUE) == 0) originalMinValue = _minValue;
        if (isStartFromZero() && _minValue < 0) setValue(0);
        if (Double.compare(originalThreshold, getThreshold()) < 0) { setThreshold(Helper.clamp(_minValue, getMaxValue(), originalThreshold)); }
        updateFormatString();
        fireUpdateEvent(RECALC_EVENT);
        if (!valueProperty().isBound()) Gauge.this.setValue(Helper.clamp(getMinValue(), getMaxValue(), Gauge.this.getValue()));
    } else {
        minValue.set(VALUE);
    }
}
项目:Medusa    文件:Gauge.java   
/**
 * Sets the maximum value of the gauge scale to the given value
 *
 * @param VALUE
 */
public void setMaxValue(final double VALUE) {
    if (Status.RUNNING == timeline.getStatus()) { timeline.jumpTo(Duration.ONE); }
    if (null == maxValue) {
        if (VALUE < getMinValue()) { setMinValue(VALUE); }
        _maxValue = Helper.clamp(getMinValue(), Double.MAX_VALUE, VALUE);
        setRange(_maxValue - getMinValue());
        if (Double.compare(originalMaxValue, Double.MAX_VALUE) == 0) originalMaxValue = _maxValue;
        if (Double.compare(originalThreshold, getThreshold()) > 0) { setThreshold(Helper.clamp(getMinValue(), _maxValue, originalThreshold)); }

        if (!valueProperty().isBound()) Gauge.this.setValue(Helper.clamp(getMinValue(), getMaxValue(), Gauge.this.getValue()));
        updateFormatString();
        fireUpdateEvent(RECALC_EVENT);
    } else {
        maxValue.set(VALUE);
    }
}
项目:ShootOFF    文件:TargetView.java   
@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.");
    }
}
项目:incubator-netbeans    文件:StopWatch.java   
public void startStop() {
    if (time.getStatus() != Status.STOPPED) {
        // if started, stop it
        time.stop();
        lastClockTime = 0;
    } else {
        // if stopped, restart
        time.play();
    }
}
项目:incubator-netbeans    文件:StopWatch.java   
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);
    }
}
项目:marathonv5    文件:StopWatchSample.java   
public void startStop() {
    if (time.getStatus() != Status.STOPPED) {
        // if started, stop it
        time.stop();
        lastClockTime = 0;
    } else {
        // if stopped, restart
        time.play();
    }
}
项目:marathonv5    文件:StopWatchSample.java   
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);
    }
}
项目:marathonv5    文件:StopWatchSample.java   
public void startStop() {
    if (time.getStatus() != Status.STOPPED) {
        // if started, stop it
        time.stop();
        lastClockTime = 0;
    } else {
        // if stopped, restart
        time.play();
    }
}
项目:marathonv5    文件:StopWatchSample.java   
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);
    }
}
项目:tilesfx    文件:Tile.java   
/**
 * Sets the maximum value of the gauge scale to the given value
 *
 * @param VALUE
 */
public void setMaxValue(final double VALUE) {
    if (Status.RUNNING == timeline.getStatus()) { timeline.jumpTo(Duration.ONE); }
    if (null == maxValue) {
        if (VALUE < getMinValue()) { setMinValue(VALUE); }
        _maxValue = clamp(getMinValue(), Double.MAX_VALUE, VALUE);
        setRange(_maxValue - getMinValue());
        if (Helper.equals(originalMaxValue, Double.MAX_VALUE)) originalMaxValue = _maxValue;
        if (Helper.biggerThan(originalThreshold, getThreshold())) { setThreshold(clamp(getMinValue(), _maxValue, originalThreshold)); }
        fireTileEvent(RECALC_EVENT);
        if (!valueProperty().isBound()) Tile.this.setValue(clamp(getMinValue(), getMaxValue(), Tile.this.getValue()));
    } else {
        maxValue.set(VALUE);
    }
}
项目:MobTime    文件:TimeController.java   
private void hideWindow() {
    Timeline hide = new Timeline(1, new KeyFrame(Duration.seconds(1), new EventHandler<ActionEvent>() {
        @Override
        public void handle(ActionEvent actionEvent) {
            if (timeline != null && timeline.getStatus().equals(Status.RUNNING)) {
                Stage window = (Stage) timerLabel.getScene().getWindow();
                window.toBack();
            }
        }
    }));
    hide.playFromStart();
}
项目:MobTime    文件:TimeController.java   
private void pauseTimer() {
    boolean paused = false;
    if (timeline != null && timeline.getStatus().equals(Status.RUNNING)) {
        timeline.pause();
        paused = true;
    }
    if (nag != null && nag.getStatus().equals(Status.RUNNING)) {
        nag.stop();
        paused = true;
    }
    if (paused) {
        paneColor.set("-fx-background-color:#FFBF00");
        pauseButton.setGraphic(new Glyph("FontAwesome", "PLAY"));
    }
}
项目:openjfx-8u-dev-tests    文件:AnimationTransitionTest.java   
private void doTest(final String testName){
    openPage(testName);
    clickButton("Start");
    final Wrap<? extends Text> txtS = waitStopped();
    assertEquals(Status.STOPPED, Status.valueOf(txtS.getControl().getText()));
    verifyFailures();
}
项目:openjfx-8u-dev-tests    文件:AnimationTransitionTest.java   
private Wrap<? extends Text> waitStopped() {
        final Wrap<? extends Text> txtS = Lookups.byID(getScene(), CheckedIds.currentState.name(), Text.class);
        txtS.waitState(new State<String>() {
            public String reached() {
                return txtS.getControl().getText();
            }
        },  Status.STOPPED.toString());

// was:     Thread.sleep(AnimationTransitionApp.typicalDuration);
        return txtS;
    }
项目:openjfx-8u-dev-tests    文件:AnimationTransitionTest.java   
/**
*
* test PathTransition() with Path
*/
   @Test
   public void TransitionPath() throws InterruptedException {
       openPage(Pages.TransitionPath.name());
       clickButton("Start");
       final Wrap<? extends Text> txtS = Lookups.byID(getScene(), CheckedIds.currentState.name(), Text.class);
       waitStopped();
       assertEquals(Status.STOPPED, Status.valueOf(txtS.getControl().getText()));
       verifyFailures();
   }
项目:livro-javafx-pratico    文件:AprendendoTransicoes.java   
private void acaoTocar(final Button btnParar, final Button btnTocar, final Button btnPausar,
        final Button btnAjusta) {
    // antes de tocar, pegamos a mais nova transição selecionada
    Transicoes t = (Transicoes) botoesTransicao.getSelectedToggle().getUserData();
    transicaoAtual = FabricaTransicao.fazerTransicao(t, sldTempo.getValue(), alvo);
    // lógicas de habilitação dos botões, temos que setar todas as
    // vezes pq trocamos as transições
    btnParar.disableProperty().bind(transicaoAtual.statusProperty().isNotEqualTo(Status.RUNNING));
    btnTocar.disableProperty().bind(transicaoAtual.statusProperty().isEqualTo(Status.RUNNING));
    btnPausar.disableProperty().bind(transicaoAtual.statusProperty().isNotEqualTo(Status.RUNNING));
    btnAjusta.disableProperty().bind(transicaoAtual.statusProperty().isEqualTo(Status.RUNNING));
    sldTempo.disableProperty().bind(transicaoAtual.statusProperty().isEqualTo(Status.RUNNING));
    System.out.println("Tocando transição " + t);
    transicaoAtual.play();
}
项目:qupath    文件:ViewTrackerPlayback.java   
/**
 * Returns true if playback is started, returns false otherwise (i.e. the tracker is empty, so got nothing to play back)
 * 
 * @return
 */
boolean doStartPlayback() {
    if (tracker.isEmpty())
        return false;
    startTimestamp = System.currentTimeMillis();
    if (timeline.getStatus() == Status.RUNNING)
        timeline.playFromStart();
    else
        timeline.play();
    playing.set(true);
    return true;
}
项目:qupath    文件:MoveTool.java   
public void stopMoving() {
    if (timer != null && timer.getStatus() == Status.RUNNING) {
        timestamp = -1;
        timer.stop();
        if (viewer != null)
            viewer.setDoFasterRepaint(false);
    }
}
项目:ClearComposer    文件:TrackPlayer.java   
/**
 * stop at current position
 */
public void pause()
{
    playState = Status.PAUSED;
    lastUpdate = -1;
    tmr.stop();
}
项目:maps    文件:MapView.java   
/**
 * Wait a bit, then move to the specified mapPoint in seconds time
 *
 * @param waitTime the time to wait before we start moving
 * @param mapPoint the destination of the move
 * @param seconds the time the move should take
 */
public void flyTo(double waitTime, MapPoint mapPoint, double seconds) {
    if ((t != null) && (t.getStatus() == Status.RUNNING)) {
        t.stop();
    }
    double currentLat = baseMap.centerLat().get();
    double currentLon = baseMap.centerLon().get();
    t = new Timeline(
        new KeyFrame(Duration.ZERO, new KeyValue(baseMap.prefCenterLat(), currentLat), new KeyValue(baseMap.prefCenterLon(), currentLon)),
        new KeyFrame(Duration.seconds(waitTime), new KeyValue(baseMap.prefCenterLat(), currentLat), new KeyValue(baseMap.prefCenterLon(), currentLon)),
        new KeyFrame(Duration.seconds(waitTime + seconds), new KeyValue(baseMap.prefCenterLat(), mapPoint.getLatitude()), new KeyValue(baseMap.prefCenterLon(), mapPoint.getLongitude(), Interpolator.EASE_BOTH))
    );
    t.play();
}
项目:JFoenix    文件:JFXNodesList.java   
/**
 * 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();
}
项目:kotlinfx-ensemble    文件:StopWatchSample.java   
public void startStop() {
    if (time.getStatus() != Status.STOPPED) {
        // if started, stop it
        time.stop();
        lastClockTime = 0;
    } else {
        // if stopped, restart
        time.play();
    }
}
项目:kotlinfx-ensemble    文件:StopWatchSample.java   
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);
    }
}
项目:WatchlistPro    文件:AquaProgressBarSkin.java   
@Override protected void handleControlPropertyChanged(String propertyReference) {
    super.handleControlPropertyChanged(propertyReference);
    if (propertyReference == "DISABLED") {
        if (getSkinnable().isIndeterminate()) {
            if (getSkinnable().isDisabled() && indeterminateProgressTransition != null && indeterminateProgressTransition.getStatus() == Status.RUNNING) {
                indeterminateProgressTransition.stop();
            } else {
                setIndeterminateProgressAnimation();
            }
        } else {
            if (getSkinnable().isDisabled() && determinateProgressTransition != null && determinateProgressTransition.getStatus() == Status.RUNNING) {
                determinateProgressTransition.stop();
            } else {
                setDeterminateProgressAnimation();
            }
        }
    }
    if (propertyReference == "INDETERMINATE") {
        if (getSkinnable().isIndeterminate()) {
            if (determinateProgressTransition != null && determinateProgressTransition.getStatus() == Status.RUNNING) {
                determinateProgressTransition.stop();
            }
            ((StackPane) getSkinnable().lookup(".bar")).setBackground(null);
            setIndeterminateProgressAnimation();
        } else {
            if (indeterminateProgressTransition != null && indeterminateProgressTransition.getStatus() == Status.RUNNING) {
                indeterminateProgressTransition.stop();
            }
            getSkinnable().setBackground(originalBackground);
            setDeterminateProgressAnimation();
        }
    }
}
项目:WatchlistPro    文件:AquaButtonSkin.java   
@Override protected void handleControlPropertyChanged(String p) {
    super.handleControlPropertyChanged(p);
    if (p == "HOVER") {
        if (getSkinnable().isDefaultButton() && getSkinnable().isPressed() && getSkinnable().isHover()) {
            getSkinnable().setStyle(armedButtonStyle);
        } else if (getSkinnable().isDefaultButton() && getSkinnable().isPressed() && !getSkinnable().isHover()) {
            getSkinnable().setStyle(usualButtonStyle);
        }
    }
    if (p == "FOCUSED") {
        if (getSkinnable().isFocused()) {
            setFocusBorder();
        } else if (!getSkinnable().isFocused() || getSkinnable().isDisable()) {
            setDropShadow();
        }
    }
    if (p == "DEFAULT_BUTTON") {
        setDefaultButtonAnimation();
    }
    if (p == "DISABLED") {
        if (getSkinnable().isDefaultButton()) {
            if (getSkinnable().isDisabled() && defaultButtonTransition != null && defaultButtonTransition.getStatus() != Status.RUNNING) {
                defaultButtonTransition.stop();
            } else {
                setDefaultButtonAnimation();
            }
        }
    }
}
项目:pdfsam    文件:LogButton.java   
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);
    }
}
项目:fx-experience    文件:MultiKeyButton.java   
@Override
protected void initEventListener(long delay) {

  buttonDelay = new Timeline(new KeyFrame(new Duration(delay), event -> fireLongPressed()));

  setOnDragDetected(e -> {
    logger.trace("{} drag detected", getKeyCode());
    if (buttonDelay.getStatus().equals(Status.RUNNING) && buttonDelay.getCurrentRate() > 0) {
      buttonDelay.stop();
      fireLongPressed();
    }
    e.consume();
  });

  setOnMouseClicked(event -> {
    logger.trace("{} clicked: {}", getKeyCode(), buttonDelay.getCurrentRate());

    if (event.getButton().equals(MouseButton.PRIMARY)) {
      if (buttonDelay.getStatus().equals(Status.RUNNING)) {
        buttonDelay.stop();
        fireShortPressed();
      }
    }
    setFocused(false);
    event.consume();
  });

  setOnMousePressed(event -> {
    logger.trace("{} pressed: {}", getKeyCode(), buttonDelay.getCurrentRate());
    if (event.getButton().equals(MouseButton.PRIMARY)) {
      buttonDelay.playFromStart();
    }
    event.consume();
  });

}
项目:fx-experience    文件:RepeatableKeyButton.java   
@Override
protected void initEventListener(long delay) {

  buttonDelay = new Timeline(new KeyFrame(Duration.millis(delay), event -> {
    fireShortPressed();
    buttonDelay.playFrom(buttonDelay.getCycleDuration().subtract(Duration.millis(REPEAT_DELAY)));
  }));

  setOnDragDetected(e -> {
    logger.trace("{} drag detected", getKeyCode());
    buttonDelay.stop();
    e.consume();
  });

  setOnMousePressed(e -> {
    logger.trace("{} pressed", getKeyCode());
    if (e.getButton().equals(MouseButton.PRIMARY)) {
      if (!isMovable()) {
        fireShortPressed();
      }
      buttonDelay.playFromStart();
    }
    e.consume();
  });

  setOnMouseReleased(e -> {
    logger.trace("{} released", getKeyCode());
    if (isMovable() && buttonDelay.getStatus() == Status.RUNNING) {
      fireShortPressed();
    }
    buttonDelay.stop();
    setFocused(false);
    e.consume();
  });

}
项目:qupath    文件:AdvancedControllerActionFactory.java   
private boolean isControllerOn() {
    return timeline != null && timeline.getStatus() == Status.RUNNING;
}
项目:qupath    文件:ViewTrackerPlayback.java   
public boolean isPlaying() {
    return timeline.getStatus() == Status.RUNNING;
}
项目:ClearComposer    文件:TrackPlayer.java   
public Status getPlayState()
{
    return playState;
}
项目:ClearComposer    文件:TrackPlayer.java   
/**
 * play
 */
public void play()
{
    playState = Status.RUNNING;
    tmr.start();
}
项目:JFoenix    文件:JFXTreeTableRowSkin.java   
@Override
protected void layoutChildren(final double x, final double y, final double w, final double h) {
    // allow custom skin to grouped rows
    pseudoClassStateChanged(groupedClass, false);
    if (getSkinnable().getTreeItem() != null
        && getSkinnable().getTreeItem().getValue() instanceof RecursiveTreeObject
        && getSkinnable().getTreeItem().getValue().getClass() == RecursiveTreeObject.class) {
        pseudoClassStateChanged(groupedClass, true);
    }

    if (getSkinnable().getIndex() > -1 && getSkinnable().getTreeTableView()
        .getTreeItem(getSkinnable().getIndex()) != null) {
        super.layoutChildren(x, y, w, h);

        // disclosure row case
        if (getSkinnable().getTreeItem() != null && !getSkinnable().getTreeItem().isLeaf()) {
            Node arrow = ((Parent) getDisclosureNode()).getChildrenUnmodifiable().get(0);
            // relocating the disclosure node according to the grouping column
            final Parent arrowParent = arrow.getParent();
            if (((RecursiveTreeObject<?>) getSkinnable().getItem()).getGroupedColumn() != null) {
                Node col = getChildren().get(getSkinnable().getTreeTableView()
                    .getTreeItemLevel(getSkinnable().getTreeItem()) + 1);
                if (getSkinnable().getItem() instanceof RecursiveTreeObject) {
                    int index = getSkinnable().getTreeTableView()
                        .getColumns()
                        .indexOf(((RecursiveTreeObject<?>) getSkinnable().getItem()).getGroupedColumn());
                    //                      getSkinnable().getTreeTableView().getColumns().get(index).getText();
                    col = getChildren().get(index + 1); // index + 2 , if the rippler was added
                }
                arrowParent.setTranslateX(col.getBoundsInParent().getMinX());
                arrowParent.setLayoutX(0);
            } else {
                arrowParent.setTranslateX(0);
                arrowParent.setLayoutX(0);
            }

            // add disclosure node animation
            if (expandedAnimation == null || !(expandedAnimation.getStatus() == Status.RUNNING)) {
                expandedAnimation = new Timeline(new KeyFrame(Duration.millis(160),
                    new KeyValue(arrow.rotateProperty(),
                        90,
                        Interpolator.EASE_BOTH)));
                expandedAnimation.setOnFinished((finish) -> arrow.setRotate(90));
            }
            if (collapsedAnimation == null || !(collapsedAnimation.getStatus() == Status.RUNNING)) {
                collapsedAnimation = new Timeline(new KeyFrame(Duration.millis(160),
                    new KeyValue(arrow.rotateProperty(),
                        0,
                        Interpolator.EASE_BOTH)));
                collapsedAnimation.setOnFinished((finish) -> arrow.setRotate(0));
            }
            getSkinnable().getTreeItem().expandedProperty().removeListener(expandedListener);
            getSkinnable().getTreeItem().expandedProperty().addListener(expandedListener);

            if (expandTriggered) {
                if (getSkinnable().getTreeTableView().getTreeItem(getSkinnable().getIndex()).isExpanded()) {
                    arrow.setRotate(0);
                    expandedAnimation.play();
                } else {
                    arrow.setRotate(90);
                    collapsedAnimation.play();
                }
                expandTriggered = false;
            } else {
                if (getSkinnable().getTreeTableView().getTreeItem(getSkinnable().getIndex()).isExpanded()) {
                    if (expandedAnimation.getStatus() != Status.RUNNING) {
                        arrow.setRotate(90);
                    }
                } else {
                    if (collapsedAnimation.getStatus() != Status.RUNNING) {
                        arrow.setRotate(0);
                    }
                }
            }
        }
    }

}
项目:JFoenix    文件:JFXPopupSkin.java   
public final void animate() {
    if (animation.getStatus() == Status.STOPPED) {
        animation.play();
    }
}
项目:JFoenix    文件:JFXColorPickerUI.java   
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();
}
项目:StreamSis    文件:ThreeDotsAnimation.java   
/**
 * Tells if this {@link ThreeDotsAnimation} is currently running.
 */
public boolean isRunning() {
    return Status.RUNNING.equals(animation.getStatus());
}
项目:StreamSis    文件:ElementEditorController.java   
@FXML
void hitPerformTestButton(ActionEvent event) {
    buttonStateManager.reportStartOfTest();
    if (hideTestResultAnimation.getStatus().equals(Status.STOPPED))
        performTestPane.dividerPositionProperty().set(0.5);
    hideTestResultAnimation.stop();
    testResultText = "Testing...";
    testResultColor = Color.RED;
    performTestStatusFakeButton.setText(testResultText);
    InnerShadow shadow = new InnerShadow(10, testResultColor);
    shadow.setOffsetY(0f);
    shadow.setOffsetX(0f);
    performTestStatusFakeButton.setEffect(shadow);
    performTestPane.showDetailNodeProperty().set(true);
    Task<Void> task = new Task<Void>() {
        @Override
        protected Void call() throws Exception {
            if (elementWorkingCopy instanceof Action) {
                Action action = (Action) elementWorkingCopy;
                action.execute();
                Platform.runLater(() -> {
                    testResultText = "Done";
                    testResultColor = Color.PALEGREEN;
                });
            } else if (elementWorkingCopy instanceof Checker) {
                Checker checker = (Checker) elementWorkingCopy;
                boolean result = checker.check();
                Platform.runLater(() -> {
                    if (result) {
                        testResultText = "True";
                        testResultColor = Color.DEEPSKYBLUE;
                    } else {
                        testResultText = "False";
                        testResultColor = Color.HOTPINK;
                    }
                });
            } else if (elementWorkingCopy instanceof Counter) {
                Counter counter = (Counter) elementWorkingCopy;
                int count = counter.count();
                Platform.runLater(() -> {
                    testResultText = String.valueOf(count);
                    testResultColor = Color.VIOLET;
                });
            }
            return null;
        }
    };
    task.stateProperty().addListener(new ChangeListener<Worker.State>() {
        @Override
        public void changed(ObservableValue<? extends State> observable, State oldValue,
                State newValue) {
            if(newValue==Worker.State.SUCCEEDED){
                shadow.setColor(testResultColor);
                performTestStatusFakeButton.setEffect(shadow);
                performTestStatusFakeButton.setText("Test result: " + testResultText + ".");
                hideTestResultAnimation.play();
                buttonStateManager.reportEndOfTest();
            } else if (newValue==Worker.State.FAILED){
                if (task.getException() == null) {
                    throw new RuntimeException("GUI Testing task failed for some reason for "
                            + elementWorkingCopy.getClass().getSimpleName());
                } else {
                    throw new RuntimeException(task.getException());
                }
            }
        }
    });
    new Thread(task).start();
}
项目:logbook-kai    文件:CaptureController.java   
@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);
    }
}
项目:logbook-kai    文件:CaptureController.java   
/**
 * タイムラインを停止
 */
private void stopTimeLine() {
    if (this.timeline.getStatus() == Status.RUNNING) {
        this.timeline.stop();
    }
}