當前位置: 首頁>>代碼示例>>Java>>正文


Java RotateTransition.setDuration方法代碼示例

本文整理匯總了Java中javafx.animation.RotateTransition.setDuration方法的典型用法代碼示例。如果您正苦於以下問題:Java RotateTransition.setDuration方法的具體用法?Java RotateTransition.setDuration怎麽用?Java RotateTransition.setDuration使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javafx.animation.RotateTransition的用法示例。


在下文中一共展示了RotateTransition.setDuration方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: close

import javafx.animation.RotateTransition; //導入方法依賴的package包/類
public void close() {
    if (State.CLOSED == getState()) return;

    setState(State.CLOSED);
    RotateTransition rotate = new RotateTransition();
    rotate.setNode(cross);
    rotate.setToAngle(0);
    rotate.setDuration(Duration.millis(200));
    rotate.setInterpolator(Interpolator.EASE_BOTH);
    rotate.play();
    closeTimeLines[closeTimeLines.length - 1].setOnFinished(actionEvent -> {
        FadeTransition buttonFadeOut = new FadeTransition();
        buttonFadeOut.setNode(mainMenuButton);
        buttonFadeOut.setDuration(Duration.millis(100));
        buttonFadeOut.setToValue(options.getButtonAlpha());
        buttonFadeOut.play();
        buttonFadeOut.setOnFinished(event -> {
            if (options.isButtonHideOnClose()) hide();
            fireMenuEvent(new MenuEvent(this, null, MenuEvent.MENU_CLOSE_FINISHED));
        });
    });
    for (int i = 0 ; i < closeTimeLines.length ; i++) {
        closeTimeLines[i].play();
    }
    fireMenuEvent(new MenuEvent(this, null, MenuEvent.MENU_CLOSE_STARTED));
}
 
開發者ID:Simego,項目名稱:FXImgurUploader,代碼行數:27,代碼來源:RadialMenu.java

示例2: fazerTransicao

import javafx.animation.RotateTransition; //導入方法依賴的package包/類
public static Transition fazerTransicao(Transicoes transicao, double duracaoSegundos, Node alvo) {
	Duration duracao = new Duration(duracaoSegundos * 1000);
	Transition t = null;

	switch (transicao) {
	case FADE:
		FadeTransition fadeTransition = new FadeTransition();
		fadeTransition.setFromValue(1);
		fadeTransition.setToValue(0);
		fadeTransition.setDuration(duracao);
		fadeTransition.setNode(alvo);
		t = fadeTransition;
		break;
	case FILL:
		FillTransition fillTransition = new FillTransition();
		fillTransition.setFromValue(Color.RED);
		fillTransition.setToValue(Color.DARKGREEN);
		fillTransition.setDuration(duracao);
		fillTransition.setShape((Shape) alvo);
		t = fillTransition;
		break;
	case ROTATE:
		RotateTransition rotateTransition = new RotateTransition();
		rotateTransition.setByAngle(360);
		rotateTransition.setDuration(duracao);
		rotateTransition.setNode(alvo);
		t = rotateTransition;
		break;
	case SCALE:
		ScaleTransition scaleTransition = new ScaleTransition();
		scaleTransition.setFromX(1);
		scaleTransition.setFromY(1);
		scaleTransition.setToX(4);
		scaleTransition.setToY(4);
		scaleTransition.setDuration(duracao);
		scaleTransition.setNode(alvo);
		t = scaleTransition;
		break;
	case TRANSLATE:
		TranslateTransition translateTransition = new TranslateTransition();
		translateTransition.setToX(600);
		translateTransition.setToY(250);
		translateTransition.setDuration(duracao);
		translateTransition.setNode(alvo);
		t = translateTransition;
		break;
	default:
		break;
	}
	t.setAutoReverse(true);
	t.setCycleCount(2);
	return t;
}
 
開發者ID:jesuino,項目名稱:livro-javafx-pratico,代碼行數:54,代碼來源:AprendendoTransicoes.java

示例3: initGraphics

import javafx.animation.RotateTransition; //導入方法依賴的package包/類
private void initGraphics() {
    double center = PREFERRED_WIDTH * 0.5;
    double radius = PREFERRED_WIDTH * 0.45;
    circle = new Circle();
    circle.setCenterX(center);
    circle.setCenterY(center);
    circle.setRadius(radius);
    circle.getStyleClass().add("indicator");
    circle.setStrokeLineCap(isRoundLineCap() ? StrokeLineCap.ROUND : StrokeLineCap.SQUARE);
    circle.setStrokeWidth(PREFERRED_WIDTH * 0.10526316);
    circle.setStrokeDashOffset(dashOffset.get());
    circle.getStrokeDashArray().setAll(dashArray_0.getValue(), 200d);

    arc = new Arc(center, center, radius, radius, 90, -360.0 * getProgress());
    arc.setStrokeLineCap(isRoundLineCap() ? StrokeLineCap.ROUND : StrokeLineCap.SQUARE);
    arc.setStrokeWidth(PREFERRED_WIDTH * 0.1);
    arc.getStyleClass().add("indicator");

    indeterminatePane = new StackPane(circle);
    indeterminatePane.setVisible(false);

    progressPane      = new Pane(arc);
    progressPane.setVisible(Double.compare(getProgress(), 0.0) != 0);

    getChildren().setAll(progressPane, indeterminatePane);

    // Setup timeline animation
    KeyValue kvDashOffset_0    = new KeyValue(dashOffset, 0, Interpolator.EASE_BOTH);
    KeyValue kvDashOffset_50   = new KeyValue(dashOffset, -32, Interpolator.EASE_BOTH);
    KeyValue kvDashOffset_100  = new KeyValue(dashOffset, -64, Interpolator.EASE_BOTH);

    KeyValue kvDashArray_0_0   = new KeyValue(dashArray_0, 5, Interpolator.EASE_BOTH);
    KeyValue kvDashArray_0_50  = new KeyValue(dashArray_0, 89, Interpolator.EASE_BOTH);
    KeyValue kvDashArray_0_100 = new KeyValue(dashArray_0, 89, Interpolator.EASE_BOTH);

    KeyValue kvRotate_0        = new KeyValue(circle.rotateProperty(), -10, Interpolator.LINEAR);
    KeyValue kvRotate_100      = new KeyValue(circle.rotateProperty(), 370, Interpolator.LINEAR);

    KeyFrame kf0               = new KeyFrame(Duration.ZERO, kvDashOffset_0, kvDashArray_0_0, kvRotate_0);
    KeyFrame kf1               = new KeyFrame(Duration.millis(1000), kvDashOffset_50, kvDashArray_0_50);
    KeyFrame kf2               = new KeyFrame(Duration.millis(1500), kvDashOffset_100, kvDashArray_0_100, kvRotate_100);

    timeline.setCycleCount(Animation.INDEFINITE);
    timeline.getKeyFrames().setAll(kf0, kf1, kf2);

    // Setup additional pane rotation
    indeterminatePaneRotation = new RotateTransition();
    indeterminatePaneRotation.setNode(indeterminatePane);
    indeterminatePaneRotation.setFromAngle(0);
    indeterminatePaneRotation.setToAngle(-360);
    indeterminatePaneRotation.setInterpolator(Interpolator.LINEAR);
    indeterminatePaneRotation.setCycleCount(Timeline.INDEFINITE);
    indeterminatePaneRotation.setDuration(new Duration(4500));
}
 
開發者ID:HanSolo,項目名稱:CircularProgressIndicator,代碼行數:55,代碼來源:CircularProgressIndicator.java

示例4: click

import javafx.animation.RotateTransition; //導入方法依賴的package包/類
public void click(final MenuItem CLICKED_ITEM) {
    List<Transition> transitions = new ArrayList<>(items.size() * 2);
    for (Parent node : items.keySet()) {
        if (items.get(node).equals(CLICKED_ITEM)) {
            // Add enlarge transition to selected item
            ScaleTransition enlargeItem = new ScaleTransition(Duration.millis(300), node);
            enlargeItem.setToX(5.0);
            enlargeItem.setToY(5.0);
            transitions.add(enlargeItem);
        } else {
            // Add shrink transition to all other items
            ScaleTransition shrinkItem = new ScaleTransition(Duration.millis(300), node);
            shrinkItem.setToX(0.0);
            shrinkItem.setToY(0.0);
            transitions.add(shrinkItem);
        }
        // Add fade out transition to every node
        FadeTransition fadeOutItem = new FadeTransition(Duration.millis(300), node);
        fadeOutItem.setToValue(0.0);
        transitions.add(fadeOutItem);
    }

    // Add rotate and fade transition to main menu button
    if (options.isButtonHideOnSelect()) {
        RotateTransition rotateMainButton = new RotateTransition(Duration.millis(300), mainMenuButton);
        rotateMainButton.setToAngle(225);
        transitions.add(rotateMainButton);
        FadeTransition fadeOutMainButton = new FadeTransition(Duration.millis(300), mainMenuButton);
        fadeOutMainButton.setToValue(0.0);
        transitions.add(fadeOutMainButton);
        ScaleTransition shrinkMainButton = new ScaleTransition(Duration.millis(300), mainMenuButton);
        shrinkMainButton.setToX(0.0);
        shrinkMainButton.setToY(0.0);
        transitions.add(shrinkMainButton);
    } else {
        RotateTransition rotateBackMainButton = new RotateTransition();
        rotateBackMainButton.setNode(cross);
        rotateBackMainButton.setToAngle(0);
        rotateBackMainButton.setDuration(Duration.millis(200));
        rotateBackMainButton.setInterpolator(Interpolator.EASE_BOTH);
        transitions.add(rotateBackMainButton);
        FadeTransition mainButtonFadeOut = new FadeTransition();
        mainButtonFadeOut.setNode(mainMenuButton);
        mainButtonFadeOut.setDuration(Duration.millis(100));
        mainButtonFadeOut.setToValue(options.getButtonAlpha());
        transitions.add(mainButtonFadeOut);
    }

    // Play all transitions in parallel
    ParallelTransition selectTransition = new ParallelTransition();
    selectTransition.getChildren().addAll(transitions);
    selectTransition.play();

    // Set menu state back to closed
    setState(State.CLOSED);
    mainMenuButton.setOpen(false);
}
 
開發者ID:Simego,項目名稱:FXImgurUploader,代碼行數:58,代碼來源:RadialMenu.java


注:本文中的javafx.animation.RotateTransition.setDuration方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。