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


Java RotateTransition類代碼示例

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


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

示例1: rotateHer

import javafx.animation.RotateTransition; //導入依賴的package包/類
public void rotateHer(Label labelHer, ImageView iv)
{
	RotateTransition rotation = new RotateTransition(Duration.seconds(2), iv);
	rotation.setCycleCount(Animation.INDEFINITE);
	rotation.setByAngle(360);

	iv.setTranslateZ(iv.getBoundsInLocal().getWidth() / 2.0);
	iv.setRotationAxis(Rotate.Y_AXIS);
	
	labelHer.setOnMouseEntered(e ->
	{ 
		rotation.play();
		iv.setRotate(180);
	});
	labelHer.setOnMouseExited(e ->
	{ 
		rotation.pause();
		iv.setRotate(0);
	});
}
 
開發者ID:mikemacharia39,項目名稱:gatepass,代碼行數:21,代碼來源:MainWindow.java

示例2: rotateHer

import javafx.animation.RotateTransition; //導入依賴的package包/類
public void rotateHer(Label labelHer, ImageView iv)
{
	RotateTransition rotation = new RotateTransition(Duration.seconds(2.3), iv);
	rotation.setCycleCount(Animation.INDEFINITE);
	rotation.setByAngle(360);

	iv.setTranslateZ(iv.getBoundsInLocal().getWidth() / 2.0);
	iv.setRotationAxis(Rotate.Y_AXIS);
	
	labelHer.setOnMouseEntered(e ->
	{ 
		rotation.play();
		iv.setRotate(180);
	});
	labelHer.setOnMouseExited(e ->
	{ 
		rotation.pause();
		iv.setRotate(0);
	});
}
 
開發者ID:mikemacharia39,項目名稱:gatepass,代碼行數:21,代碼來源:SysSettings.java

示例3: handleCurrentValue

import javafx.animation.RotateTransition; //導入依賴的package包/類
@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();
}
 
開發者ID:HanSolo,項目名稱:tilesfx,代碼行數:26,代碼來源:HighLowTileSkin.java

示例4: switchStateAnimation

import javafx.animation.RotateTransition; //導入依賴的package包/類
private void switchStateAnimation(TDDState newState){
    RotateTransition rotateTransition = new RotateTransition(Duration.millis(800), cycleImage);
    rotateTransition.setFromAngle(0);
    rotateTransition.setToAngle(-180);
    FadeTransition ft = new FadeTransition(Duration.millis(800), cycleImage);
    ft.setFromValue(1);
    ft.setToValue(0);
    RotateTransition rotateTransition2 = new RotateTransition(Duration.millis(800), cycleImageOverlay);
    rotateTransition2.setFromAngle(180);
    rotateTransition2.setToAngle(0);

    Image newImg = getImageOfPhase(newState);
    rotateTransition2.setOnFinished(event -> {
        cycleImage.setImage(newImg);
    });
    FadeTransition ft2 = new FadeTransition(Duration.millis(800), cycleImageOverlay);
    ft2.setFromValue(0);
    ft2.setToValue(1);

    ft.play();
    cycleImageOverlay.setImage(newImg);
    rotateTransition.play();
    ft.play();
    ft2.play();
    rotateTransition2.play();
}
 
開發者ID:ProPra16,項目名稱:programmierpraktikum-abschlussprojekt-amigos,代碼行數:27,代碼來源:ExerciseController.java

示例5: update

import javafx.animation.RotateTransition; //導入依賴的package包/類
@Override
public void update (Object object) {
    ITurtleState state = (ITurtleState) object;
    
    this.penStyleIndex = state.getPenStyle();
    TranslateTransition tt = new TranslateTransition(Duration.millis(mySpeed), this);

    double currentX = this.getTranslateX(); double currentY = this.getTranslateY();
    tt.setByX(currentX); tt.setByY(currentY); tt.setToX(state.getX()); tt.setToY(state.getY());

    RotateTransition rt = new RotateTransition(Duration.millis(mySpeed), this);

    double currentHeading = this.getRotate();
    rt.setByAngle(currentHeading); rt.setToAngle(state.getHeading());

    ParallelTransition pt = new ParallelTransition();
    pt.getChildren().addAll(tt, rt);

    pt.setOnFinished(e -> {
        updateTurtleState(state);
        System.out.println("myturtle: " + this.toString());
        tooltip.setText(this.toString());
    });

    pt.play();
}
 
開發者ID:adisrini,項目名稱:slogo,代碼行數:27,代碼來源:TurtleView.java

示例6: TestLoadingScene

import javafx.animation.RotateTransition; //導入依賴的package包/類
public TestLoadingScene() {

        getText().setFont(Font.font("Segoe UI", 24));
        getText().setTranslateY(50);

        Circle circle = new Circle(50, 50, 50);

        Shape shape = Shape.subtract(new Rectangle(100, 100), circle);
        shape.setFill(Color.BLUE);
        shape.setStroke(Color.YELLOW);

        RotateTransition rt = new RotateTransition(Duration.seconds(2), shape);
        rt.setByAngle(360);
        rt.setCycleCount(15);
        rt.play();

        shape.setTranslateX(700);
        shape.setTranslateY(500);

        getContentRoot().getChildren().set(1, shape);
    }
 
開發者ID:AlmasB,項目名稱:FXGL,代碼行數:22,代碼來源:TestLoadingScene.java

示例7: moveToDeck

import javafx.animation.RotateTransition; //導入依賴的package包/類
/**
 * Method to display the movement of a card to a Deck
 * @param card the card to move
 */
private PathTransition moveToDeck(Card card) {
    StackPane deck = ownerToDeck(card.getOwner());
    Path path = new Path(new MoveTo(card.localToParent(0,0).getX() + card.getWidth()/2, card.localToParent(0,0).getY() + card.getHeight()/2),
            new LineTo(deck.localToParent(deck.getWidth()/2.,deck.getHeight()/2.).getX(), deck.localToParent(deck.getWidth()/2.,deck.getHeight()/2.).getY()));

    boolean horizontal = card.getOwner() == Owner.PROJECT_DECK || card.getOwner() == Owner.PROJECT_DISCARD;

    card.toFront();
    if (horizontal) {
        RotateTransition rotateTransition = new RotateTransition(Duration.millis(500), card);
        rotateTransition.setByAngle(-90);
        rotateTransition.play();
    }

    ScaleTransition scaleTransition = new ScaleTransition(Duration.millis(500), card);
    scaleTransition.setToX(horizontal ? deck.getScaleY() : deck.getScaleX());
    scaleTransition.setToY(horizontal ? deck.getScaleX() : deck.getScaleY());
    scaleTransition.play();

    card.setClickable(false, view);

    return new PathTransition(Duration.seconds(.5),path,card);
}
 
開發者ID:MrFouss,項目名稱:The-Projects,代碼行數:28,代碼來源:Board.java

示例8: 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

示例9: createFlipEndTransition

import javafx.animation.RotateTransition; //導入依賴的package包/類
/**
 * Creates a {@link RotateTransition} that is the second/end part of a flip
 * animation.
 * 
 * @param pNode the {@link Node}.
 * @param pOrientation the {@link Orientation} in which to rotate. Note that
 *            {@link Orientation#HORIZONTAL} means from right to left.
 * @param pRightLeftTopDown {@code true} if the animation should be from
 *            right to left/top to down. {@code false} if it should be left
 *            to right/bottom to up.
 * @return the created {@link RotateTransition}.
 */
public static RotateTransition createFlipEndTransition(Node pNode, Orientation pOrientation, boolean pRightLeftTopDown)
{
	double startingAngle = calculateEdgeAngle(pNode, pOrientation);
	
	RotateTransition endTransition = new RotateTransition(Duration.millis(466), pNode);
	endTransition.setAxis(getAxis(pOrientation));
	if (pRightLeftTopDown)
	{
		endTransition.setFromAngle(startingAngle + 180);
		endTransition.setToAngle(360);
	}
	else
	{
		
		endTransition.setFromAngle(startingAngle);
		endTransition.setToAngle(0);
	}
	endTransition.setInterpolator(Interpolator.EASE_OUT);
	
	return endTransition;
}
 
開發者ID:ivartanian,項目名稱:JVx.javafx,代碼行數:34,代碼來源:FXAnimator.java

示例10: createFlipStartTransition

import javafx.animation.RotateTransition; //導入依賴的package包/類
/**
 * Creates a {@link RotateTransition} that is the first/start part of a flip
 * animation.
 * 
 * @param pNode the {@link Node}.
 * @param pOrientation the {@link Orientation} in which to rotate. Note that
 *            {@link Orientation#HORIZONTAL} means from right to left.
 * @param pRightLeftTopDown {@code true} if the animation should be from
 *            right to left/top to down. {@code false} if it should be left
 *            to right/bottom to up.
 * @return the created {@link RotateTransition}.
 */
public static RotateTransition createFlipStartTransition(Node pNode, Orientation pOrientation, boolean pRightLeftTopDown)
{
	double endingAngle = calculateEdgeAngle(pNode, pOrientation);
	
	RotateTransition transition = new RotateTransition(Duration.millis(466), pNode);
	transition.setAxis(getAxis(pOrientation));
	if (pRightLeftTopDown)
	{
		transition.setFromAngle(0);
		transition.setToAngle(endingAngle);
	}
	else
	{
		transition.setFromAngle(360);
		transition.setToAngle(endingAngle + 180);
	}
	transition.setInterpolator(Interpolator.EASE_IN);
	
	return transition;
}
 
開發者ID:ivartanian,項目名稱:JVx.javafx,代碼行數:33,代碼來源:FXAnimator.java

示例11: LoadingBar

import javafx.animation.RotateTransition; //導入依賴的package包/類
public LoadingBar() {
    Circle outer = new Circle(50);
    outer.setFill(null);
    outer.setStroke(Color.BLACK);

    Circle inner = new Circle(5);
    inner.setTranslateY(-50);

    rt = new RotateTransition(Duration.seconds(2), this);
    rt.setToAngle(360);
    rt.setInterpolator(Interpolator.LINEAR);
    rt.setCycleCount(RotateTransition.INDEFINITE);

    getChildren().addAll(outer, inner);
    setVisible(false);
}
 
開發者ID:AlmasB,項目名稱:FXTutorials,代碼行數:17,代碼來源:Main.java

示例12: LoadingCircle

import javafx.animation.RotateTransition; //導入依賴的package包/類
public LoadingCircle() {
    Circle circle = new Circle(20);
    circle.setFill(null);
    circle.setStroke(Color.WHITE);
    circle.setStrokeWidth(2);

    Rectangle rect = new Rectangle(20, 20);

    Shape shape = Shape.subtract(circle, rect);
    shape.setFill(Color.WHITE);

    getChildren().add(shape);

    animation = new RotateTransition(Duration.seconds(2.5), this);
    animation.setByAngle(-360);
    animation.setInterpolator(Interpolator.LINEAR);
    animation.setCycleCount(Animation.INDEFINITE);
    animation.play();
}
 
開發者ID:AlmasB,項目名稱:FXTutorials,代碼行數:20,代碼來源:FarCry4Loading.java

示例13: initialize

import javafx.animation.RotateTransition; //導入依賴的package包/類
/**
 * JavaFX constructor for the ApplicationController.
 */
@FXML
private void initialize() {
  ApplicationController.instance = this;

  ApplicationController.instance.rt = new RotateTransition(
    Duration.millis(10000), this.loadIcon
  );
  ApplicationController.instance.rotateIcon();
  ApplicationController.instance.stackPane.getChildren().remove(
    this.loadIcon
  );

  ApplicationController.addIcon();
  Platform.runLater(() -> {
    MenuController.loadDefault();
  });
}
 
開發者ID:kasperisager,項目名稱:kelvin-maps,代碼行數:21,代碼來源:ApplicationController.java

示例14: flipTo180

import javafx.animation.RotateTransition; //導入依賴的package包/類
private void flipTo180(final Domino.Dot DOT, final String STYLE) {
    final RotateTransition ROT_0_90 = new RotateTransition(FLIP_TIME.divide(2), dotMap.get(DOT));
    ROT_0_90.setAxis(Rotate.Y_AXIS);
    ROT_0_90.setFromAngle(0);
    ROT_0_90.setToAngle(90);
    ROT_0_90.play();
    ROT_0_90.setOnFinished(new EventHandler<ActionEvent>() {
        @Override public void handle(final ActionEvent EVENT) {
            dotMap.get(DOT).getStyleClass().clear();
            dotMap.get(DOT).getStyleClass().add(STYLE);
            final RotateTransition ROT_90_180 = new RotateTransition(FLIP_TIME.divide(2), dotMap.get(DOT));
            ROT_90_180.setAxis(Rotate.Y_AXIS);
            ROT_90_180.setFromAngle(90);
            ROT_90_180.setToAngle(180);
            ROT_90_180.play();
        }
    });
}
 
開發者ID:SaiPradeepDandem,項目名稱:javafx-demos,代碼行數:19,代碼來源:DominoSkin.java

示例15: flipTo0

import javafx.animation.RotateTransition; //導入依賴的package包/類
private void flipTo0(final Domino.Dot DOT, final String STYLE) {
    final RotateTransition ROT_180_90 = new RotateTransition(FLIP_TIME.divide(2), dotMap.get(DOT));
    ROT_180_90.setAxis(Rotate.Y_AXIS);
    ROT_180_90.setFromAngle(180);
    ROT_180_90.setToAngle(90);
    ROT_180_90.play();
    ROT_180_90.setOnFinished(new EventHandler<ActionEvent>() {
        @Override public void handle(final ActionEvent EVENT) {
            dotMap.get(DOT).getStyleClass().clear();
            dotMap.get(DOT).getStyleClass().add(STYLE);
            final RotateTransition ROT_90_0 = new RotateTransition(FLIP_TIME.divide(2), dotMap.get(DOT));
            ROT_90_0.setAxis(Rotate.Y_AXIS);
            ROT_90_0.setFromAngle(90);
            ROT_90_0.setToAngle(0);
            ROT_90_0.play();
        }
    });
}
 
開發者ID:SaiPradeepDandem,項目名稱:javafx-demos,代碼行數:19,代碼來源:DominoSkin.java


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