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


Java RotateTransition.setByAngle方法代碼示例

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


在下文中一共展示了RotateTransition.setByAngle方法的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: 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

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

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

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

示例7: initialize

import javafx.animation.RotateTransition; //導入方法依賴的package包/類
@FXML
private void initialize() {
	eventBus.register(this);
	messageBox.setDisable(client.getSelectedRoom() == null);

	eventListView.setCellFactory(listView -> {
		EventListItemView memberListItemView = new EventListItemView();
		memberListItemView.getView();
		return (EventListItemPresenter)memberListItemView.getPresenter();
	});

	eventListView.itemsProperty().addListener((observable, oldValue, newValue) -> {

		if(eventListScrollBar != null) {
			eventListScrollBar.valueProperty().removeListener(scrollListener);
		}

		this.eventListScrollBar = getListViewScrollBar(eventListView, Orientation.VERTICAL);

		if(eventListScrollBar != null) {
			eventListScrollBar.valueProperty().addListener(scrollListener);
		}
	});

	// Buffering icon animations
	bufferIconAnimation = new RotateTransition(Duration.millis(1000), bufferingIcon);
	bufferIconAnimation.setCycleCount(Timeline.INDEFINITE);
	bufferIconAnimation.setByAngle(360);
	bufferFadeIn = new FadeTransition(Duration.millis(200), bufferingIcon);
	bufferFadeIn.setFromValue(0.0);
	bufferFadeIn.setToValue(1.0);
	bufferFadeOut = new FadeTransition(Duration.millis(200), bufferingIcon);
	bufferFadeOut.setFromValue(1.0);
	bufferFadeOut.setToValue(0.0);
}
 
開發者ID:Gurgy,項目名稱:Cypher,代碼行數:36,代碼來源:ChatPresenter.java

示例8: queueImageView

import javafx.animation.RotateTransition; //導入方法依賴的package包/類
private ImageView queueImageView( final TileViewModel build ) {
    final ImageView queuedIcon = new ImageView( UIUtils.createImage( "icons/queued.png" ) );
    queuedIcon.setFitHeight( 45 );
    queuedIcon.setPreserveRatio( true );
    queuedIcon.visibleProperty( ).bind( build.queuedProperty( ) );

    final RotateTransition transition = new RotateTransition( Duration.seconds( 3 ), queuedIcon );
    transition.setByAngle( 360 );
    transition.setCycleCount( Timeline.INDEFINITE );
    transition.play( );

    return queuedIcon;
}
 
開發者ID:u2032,項目名稱:wall-t,代碼行數:14,代碼來源:TileView.java

示例9: getRotation

import javafx.animation.RotateTransition; //導入方法依賴的package包/類
private void getRotation(Button button){

		RotateTransition rotation = new RotateTransition(Duration.seconds(3), button);
		rotation.setCycleCount(Animation.INDEFINITE);
		rotation.setByAngle(360);
		
		button.setOnMouseEntered(e -> rotation.play());
		button.setOnMouseExited(e -> rotation.pause());
	}
 
開發者ID:LtubSalad,項目名稱:voogasalad-ltub,代碼行數:10,代碼來源:GameChooser.java

示例10: createRotateTransition

import javafx.animation.RotateTransition; //導入方法依賴的package包/類
RotateTransition createRotateTransition(Duration duration, Node node, int startAngle) {
    RotateTransition rt = new RotateTransition(duration, node);
    rt.setFromAngle(startAngle);
    rt.setByAngle(360);
    rt.setCycleCount(Animation.INDEFINITE);
    rt.setInterpolator(Interpolator.LINEAR);
    return rt;
}
 
開發者ID:torutk,項目名稱:analogclock,代碼行數:9,代碼來源:AnalogClockDrawing.java

示例11: createRotateTransition

import javafx.animation.RotateTransition; //導入方法依賴的package包/類
/**
 * 360度回転を繰り返すアニメーションの設定。
 *
 * @param duration 1回転するのに要する時間
 * @param node 回転するノード
 * @param startAngle 回転開始角度
 * @return 指定下パラメータで初期化したRotateTransitionインスタンス
 */
private RotateTransition createRotateTransition(Duration duration, Node node, double startAngle) {
    RotateTransition rt = new RotateTransition(duration, node);
    rt.setFromAngle(startAngle);
    rt.setByAngle(360);
    rt.setCycleCount(Animation.INDEFINITE);
    rt.setInterpolator(Interpolator.LINEAR);
    return rt;
}
 
開發者ID:torutk,項目名稱:analogclock,代碼行數:17,代碼來源:AnalogClockImaging.java

示例12: eval

import javafx.animation.RotateTransition; //導入方法依賴的package包/類
@Override
public Object eval(Environment env) {
    Object c = ((ASTree) condition()).eval(env);
    if (c instanceof Integer) {
        Sprite sprite = env.getSprite();
        SequentialTransition st = env.getSequentialTransition();
        RotateTransition rt = new RotateTransition(Duration.millis(env.getSpeed()), sprite);
        rt.setByAngle((Integer) c);
        rt.setAutoReverse(true);
        st.getChildren().add(rt);
    }

    return c;
}
 
開發者ID:jointry,項目名稱:jointry,代碼行數:15,代碼來源:RotateStmnt.java

示例13: start

import javafx.animation.RotateTransition; //導入方法依賴的package包/類
@Override
public void start(Stage stage) throws Exception {
    if (stage == null) {
        return;
    }

    Rectangle clipRect1 = new Rectangle(-130, -130, 115, 115);
    Rectangle clipRect2 = new Rectangle(15, -130, 115, 115);
    Rectangle clipRect3 = new Rectangle(-130, 15, 115, 115);
    Rectangle clipRect4 = new Rectangle(15, 15, 115, 115);
    Group clip = new Group(clipRect1, clipRect2, clipRect3, clipRect4);

    Circle spinnanCircle = new Circle(100);
    spinnanCircle.setFill(null);
    spinnanCircle.setStrokeWidth(30);
    spinnanCircle.setStroke(LTTNG_PURPLE);
    spinnanCircle.setClip(clip);

    Circle magCircle = new Circle(60);
    magCircle.setFill(null);
    magCircle.setStrokeWidth(25);
    magCircle.setStroke(LTTNG_LIGHT_BLUE);

    Rectangle magHandle = new Rectangle(-12.5, 60, 25, 110);
    magHandle.setFill(LTTNG_LIGHT_BLUE);

    Group mag = new Group(magCircle, magHandle);

    Group root = new Group(spinnanCircle, mag);
    root.setRotate(30);
    root.relocate(0, 0);

    Pane pane = new Pane(root);
    pane.setStyle(BACKGROUND_STYLE);

    RotateTransition spinnan = new RotateTransition(Duration.seconds(4), spinnanCircle);
    spinnan.setByAngle(360);
    spinnan.setCycleCount(Animation.INDEFINITE);
    spinnan.setInterpolator(Interpolator.LINEAR);

    Scene scene = new Scene(pane);
    stage.setScene(scene);
    stage.show();

    spinnan.play();
}
 
開發者ID:lttng,項目名稱:lttng-scope,代碼行數:47,代碼來源:Logo.java

示例14: rotate

import javafx.animation.RotateTransition; //導入方法依賴的package包/類
private void rotate(double angle, Duration time){
    RotateTransition flip = new RotateTransition(time, this);
    flip.setAxis(Rotate.X_AXIS);
    flip.setByAngle(angle);
    flip.play();
}
 
開發者ID:scourgemancer,項目名稱:FamilyFeud,代碼行數:7,代碼來源:AnswerTile.java

示例15: startButtonPressed

import javafx.animation.RotateTransition; //導入方法依賴的package包/類
@FXML
private void startButtonPressed(ActionEvent event) 
{
   // transition that changes a shape's fill   
   FillTransition fillTransition = 
      new FillTransition(Duration.seconds(1));
   fillTransition.setToValue(Color.CYAN);
   fillTransition.setCycleCount(2);
   
   // each even cycle plays transition in reverse to restore original
   fillTransition.setAutoReverse(true); 

   // transition that changes a shape's stroke over time  
   StrokeTransition strokeTransition = 
      new StrokeTransition(Duration.seconds(1));
   strokeTransition.setToValue(Color.BLUE);
   strokeTransition.setCycleCount(2);
   strokeTransition.setAutoReverse(true);
   
   // parallelizes multiple transitions  
   ParallelTransition parallelTransition = 
      new ParallelTransition(fillTransition, strokeTransition);

   // transition that changes a node's opacity over time
   FadeTransition fadeTransition = 
      new FadeTransition(Duration.seconds(1));
   fadeTransition.setFromValue(1.0); // opaque
   fadeTransition.setToValue(0.0); // transparent
   fadeTransition.setCycleCount(2);
   fadeTransition.setAutoReverse(true);

   // transition that rotates a node 
   RotateTransition rotateTransition = 
      new RotateTransition(Duration.seconds(1));
   rotateTransition.setByAngle(360.0);
   rotateTransition.setCycleCount(2);
   rotateTransition.setInterpolator(Interpolator.EASE_BOTH);
   rotateTransition.setAutoReverse(true);
   
   // transition that moves a node along a Path  
   Path path = new Path(new MoveTo(45, 45), new LineTo(45, 0), 
      new LineTo(90, 0), new LineTo(90, 90), new LineTo(0, 90));
   PathTransition translateTransition = 
      new PathTransition(Duration.seconds(2), path);
   translateTransition.setCycleCount(2);
   translateTransition.setInterpolator(Interpolator.EASE_IN);
   translateTransition.setAutoReverse(true);
   
   // transition that scales a shape to make it larger or smaller
   ScaleTransition scaleTransition =
      new ScaleTransition(Duration.seconds(1));
   scaleTransition.setByX(0.75);
   scaleTransition.setByY(0.75);
   scaleTransition.setCycleCount(2);
   scaleTransition.setInterpolator(Interpolator.EASE_OUT);
   scaleTransition.setAutoReverse(true);

   // transition that applies a sequence of transitions to a node
   SequentialTransition sequentialTransition = 
      new SequentialTransition (rectangle, parallelTransition, 
         fadeTransition, rotateTransition, translateTransition, 
         scaleTransition);
   sequentialTransition.play(); // play the transition
}
 
開發者ID:cleitonferreira,項目名稱:LivroJavaComoProgramar10Edicao,代碼行數:65,代碼來源:TransitionAnimationsController.java


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