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


Java TranslateTransition.setFromX方法代碼示例

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


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

示例1: TranslateTransitionSample

import javafx.animation.TranslateTransition; //導入方法依賴的package包/類
public TranslateTransitionSample() {
    super(400,40);
    Circle circle = new Circle(20, Color.CRIMSON);
    circle.setTranslateX(20);
    circle.setTranslateY(20);
    getChildren().add(circle);
    translateTransition = new TranslateTransition(Duration.seconds(4),circle);
    translateTransition.setFromX(20);
    translateTransition.setToX(380);
    translateTransition.setCycleCount(Timeline.INDEFINITE);
    translateTransition.setAutoReverse(true);        
    translateTransition = TranslateTransitionBuilder.create()
            .duration(Duration.seconds(4))
            .node(circle)
            .fromX(20)
            .toX(380)
            .cycleCount(Timeline.INDEFINITE)
            .autoReverse(true)
            .build();
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:21,代碼來源:TranslateTransitionSample.java

示例2: setPlusScoreAnimation

import javafx.animation.TranslateTransition; //導入方法依賴的package包/類
/**
 * Animates a label with the plus(new additional value) text.
 * @param plus 
 */
private void setPlusScoreAnimation(String plus) {
	if(plus.length() > 2 ) {
		double width = 25 * plus.length();
		PLUS_SCORE.setMinSize(width, 45);
	}
	PLUS_SCORE.setText("+" + plus);
	this.setScoreStyle();
	PLUS_SCORE.setTextFill(Color.WHITE);
	FadeTransition ft = new FadeTransition(Duration.seconds(.7), PLUS_SCORE);
	ft.setFromValue(1);
	ft.setToValue(0);
	ft.play();
	
	TranslateTransition tt = new TranslateTransition(Duration.seconds(.7), PLUS_SCORE);
	tt.setFromX(55);
	tt.setFromY(-50);
	tt.setToY(50);
	tt.play();
}
 
開發者ID:ShekkarRaee,項目名稱:xpanderfx,代碼行數:24,代碼來源:MainFXMLDocumentController.java

示例3: TranslateAnimation

import javafx.animation.TranslateTransition; //導入方法依賴的package包/類
public TranslateAnimation(Node child, Node dragged) {
    initialX = child.getLayoutX();
    initialIndex = container.getChildren().indexOf(child);
    if (child != dragged) {
        translate = new TranslateTransition(DURATION, child);

        double displacement = dragged.getLayoutBounds().getWidth() + container.getSpacing();
        if (initialIndex < container.getChildren().indexOf(dragged)) {
            translate.setFromX(0);
            translate.setToX(displacement);
        } else {
            translate.setFromX(-displacement);
            translate.setToX(0);
            translate.jumpTo(DURATION);
            forward.set(true);
        }

        forward.addListener((v, o, n) -> {
            translate.setRate(n ? 1 : -1);
            translate.play();
        });
    } else {
        translate = null;
    }
}
 
開發者ID:rmfisher,項目名稱:fx-animation-editor,代碼行數:26,代碼來源:KeyFrameDragAnimator.java

示例4: TransitionForAll

import javafx.animation.TranslateTransition; //導入方法依賴的package包/類
private void TransitionForAll(Rectangle rectangle, double layoutXFrom, double layoutXTo, double layoutYFrom, double layoutYTo) {
    mainPane.getChildren().add(rectangle);
    TranslateTransition translateTransition = new TranslateTransition(Duration.millis(800), rectangle);
    translateTransition.setFromX(layoutXFrom);
    translateTransition.setToX(layoutXTo);
    translateTransition.setFromY(layoutYFrom);
    translateTransition.setToY(layoutYTo);
    translateTransition.setCycleCount(1);
    translateTransition.setAutoReverse(true);
    FadeTransition fadeTransition = new FadeTransition(Duration.millis(800), rectangle);
    fadeTransition.setFromValue(1.0f);
    fadeTransition.setToValue(0f);
    fadeTransition.setCycleCount(1);
    fadeTransition.setAutoReverse(true);
    translateTransition.play();
    fadeTransition.play();
    rectangle.setDisable(true);
    Rectangle newRectangle = new Rectangle(10, 10);
    eventExit(rectangle, newRectangle);
}
 
開發者ID:PBZ-InsightR,項目名稱:Spellmonger3,代碼行數:21,代碼來源:ControllerPlay.java

示例5: panelShake

import javafx.animation.TranslateTransition; //導入方法依賴的package包/類
/**
 * Shake a panel in the event of an error.
 *
 * @param pane the pane to shake
 */
public static void panelShake(Pane pane) {
    int duration = 100;
    int count = 2;

    TranslateTransition transition1 = new TranslateTransition(Duration.millis(duration), pane);
    transition1.setFromX(0);
    transition1.setToX(-5);
    transition1.setInterpolator(Interpolator.LINEAR);

    TranslateTransition transition2 = new TranslateTransition(Duration.millis(duration), pane);
    transition2.setFromX(-5);
    transition2.setToX(5);
    transition2.setDelay(Duration.millis(duration));
    transition2.setInterpolator(Interpolator.LINEAR);
    transition2.setCycleCount(count);

    TranslateTransition transition3 = new TranslateTransition(Duration.millis(duration), pane);
    transition3.setToX(0);
    transition3.setDelay(Duration.millis((count + 1) * duration));
    transition3.setInterpolator(Interpolator.LINEAR);

    transition1.play();
    transition2.play();
    transition3.play();
}
 
開發者ID:JamesFitzpatrick-Coursework,項目名稱:Client-UI,代碼行數:31,代碼來源:EffectsUtils.java

示例6: swipe2Right

import javafx.animation.TranslateTransition; //導入方法依賴的package包/類
private void swipe2Right(Region to, Region old) {
        to.setTranslateX(0);
        to.setTranslateY(0);

        TranslateTransition translateTransition = new TranslateTransition(Duration.millis(400), old);

        translateTransition.setFromX(old.getLayoutX());
        translateTransition.setToX(master.getLayoutBounds().getWidth());
        translateTransition.setInterpolator(Interpolator.EASE_OUT);
        translateTransition.setCycleCount(1);
        translateTransition.play();

        translateTransition.setOnFinished(new EventHandler() {
            @Override
            public void handle(Event event) {
                System.out.println("master p" + master.getParent());
                master.getChildren().clear();
                master.getChildren().add(to);
                to.prefWidthProperty().bind(master.prefWidthProperty());
//                LayoutUtils.fix2Parent(to, master);
//                to.prefWidthProperty().bind(master.prefWidthProperty());

            }

        });
    }
 
開發者ID:cosysoft,項目名稱:agile,代碼行數:27,代碼來源:MainView.java

示例7: fade

import javafx.animation.TranslateTransition; //導入方法依賴的package包/類
private void fade(double c, GridPane login) {
	TranslateTransition t1 = new TranslateTransition(Duration.millis(500), dashboard.getActionBar());
	t1.setByX(c);

	TranslateTransition t2 = new TranslateTransition(Duration.millis(500), login);
	t2.setByX(c);
	t2.setFromX(login.getLayoutX() - c);
	t2.setToX(login.getLayoutX());

	p.getChildren().addAll(t1, t2);
	p.setInterpolator(new Interpolator() {
		@Override
		protected double curve(double t) {
			return Math.pow(t, 2);
		}
	});
	p.play();
	if (login.getOpacity() == 0) {
		login.setOpacity(1);
	} else {
		login.setOpacity(0);
	}
}
 
開發者ID:DeOldSax,項目名稱:iliasDownloaderTool,代碼行數:24,代碼來源:LoginFader.java

示例8: animateMovinement

import javafx.animation.TranslateTransition; //導入方法依賴的package包/類
/**
 * 
 * @param direction
 * @param from
 * @param to 
 */
private synchronized void animateMovinement(Direction direction, Tile from, Tile to) {
	TranslateTransition st = new TranslateTransition(Duration.seconds(.3), from);
	st.setFromX(0);
	st.setToX(direction.getX_location());
	st.play();
	st.setOnFinished(e -> {
		to.combine(from);
		this.checkCompletion(to);
		from.remove();
	});
}
 
開發者ID:ShekkarRaee,項目名稱:xpanderfx,代碼行數:18,代碼來源:MainFXMLDocumentController.java

示例9: sideMenuSlideIn

import javafx.animation.TranslateTransition; //導入方法依賴的package包/類
private void sideMenuSlideIn(){
	sideMenuVBox.setVisible(true);
	//slide in in 400ms
	TranslateTransition translateTransition = new TranslateTransition(Duration.millis(400), sideMenuVBox);
	translateTransition.setFromX(-175);
	translateTransition.setToX(0);
	translateTransition.play();
}
 
開發者ID:Seil0,項目名稱:cemu_UI,代碼行數:9,代碼來源:MainWindowController.java

示例10: sideMenuSlideOut

import javafx.animation.TranslateTransition; //導入方法依賴的package包/類
private void sideMenuSlideOut(){
	//slide out in 400ms
	TranslateTransition translateTransition = new TranslateTransition(Duration.millis(400), sideMenuVBox);
	translateTransition.setFromX(0);
	translateTransition.setToX(-175);
	translateTransition.play();
}
 
開發者ID:Seil0,項目名稱:cemu_UI,代碼行數:8,代碼來源:MainWindowController.java

示例11: Shaker

import javafx.animation.TranslateTransition; //導入方法依賴的package包/類
public Shaker(Node node) {
    tt = new TranslateTransition(Duration.millis(100), node);
    tt.setFromX(0f);
    tt.setByX(6f);
    tt.setCycleCount(4);
    tt.setAutoReverse(true);
}
 
開發者ID:m-krajcovic,項目名稱:photometric-data-retriever,代碼行數:8,代碼來源:Shaker.java

示例12: resetTilePosition

import javafx.animation.TranslateTransition; //導入方法依賴的package包/類
/**
 * Reset position of tile with smooth transition
 */
public void resetTilePosition() {
    TranslateTransition transition = new TranslateTransition(Duration.millis(300), tile);
    transition.setInterpolator(Interpolator.EASE_OUT);
    transition.setFromX(tile.getTranslateX());
    transition.setToX(0);
    transition.playFromStart();
}
 
開發者ID:gluonhq,項目名稱:gluon-samples,代碼行數:11,代碼來源:SlidingListTile.java

示例13: initialize

import javafx.animation.TranslateTransition; //導入方法依賴的package包/類
@FXML
public void initialize() {
	
	TranslateTransition translateTransition =
            new TranslateTransition(Duration.millis(10000), background1);
	translateTransition.setFromX(0);
	translateTransition.setToX(-1 * BACKGROUND_WIDTH);
	translateTransition.setInterpolator(Interpolator.LINEAR);

	TranslateTransition translateTransition2 =
           new TranslateTransition(Duration.millis(10000), background2);
	translateTransition2.setFromX(0);
	translateTransition2.setToX(-1 * BACKGROUND_WIDTH);
	translateTransition2.setInterpolator(Interpolator.LINEAR);

	parallelTransition = 
		new ParallelTransition( translateTransition, translateTransition2 );
	parallelTransition.setCycleCount(Animation.INDEFINITE);

	//
	// Sets the label of the Button based on the animation state
	//
	parallelTransition.statusProperty().addListener((obs, oldValue, newValue) -> {
		if( newValue == Animation.Status.RUNNING ) {
			btnControl.setText( "||" );
		} else {
			btnControl.setText( ">" );
		}
	});
}
 
開發者ID:bekwam,項目名稱:examples-javafx-repos1,代碼行數:31,代碼來源:BackgroundController.java

示例14: addGebouwKaartViews

import javafx.animation.TranslateTransition; //導入方法依賴的package包/類
/**
     * Voeg gebouwKaart views toe aan de HandActionBarView.
     * Wijzig de X coordinaat van elke GebouwKaartView zodat
     * deze de vorige kaart overlapt.
     */
    private void addGebouwKaartViews() {
        Pane handPane = new Pane();
        int x = 0; // X coordinaat (voor uitlijning)
        int totalWidth = 0;
        int index = 0;
        int delay = 75;
        // Loop  door gebouwKaartViews en wijzig de X coordinaat.
        for (GebouwKaartView gebouwKaartView: gebouwKaartViews) {
//            gebouwKaartView.view().setLayoutX(x); // Zet X coordinaat
            gebouwKaartView.view().setCache(true);
            gebouwKaartView.view().setCacheShape(true);
            gebouwKaartView.view().setCacheHint(CacheHint.SPEED);
            gebouwKaartView.view().setRotate(calcRotation(index, gebouwKaartViews.size()));
            handPane.getChildren().add(gebouwKaartView.view()); // Voeg view to aan Pane
            totalWidth += gebouwKaartView.view().getPrefWidth();

            TranslateTransition transition = new TranslateTransition(Duration.millis(250), gebouwKaartView.view());
            transition.setDelay(Duration.millis(delay));
            transition.setFromX(0);
            transition.setToX(x);
            FadeTransition fadeTransition = new FadeTransition(Duration.millis(125), gebouwKaartView.view());
            fadeTransition.setDelay(Duration.millis(delay));
            fadeTransition.setFromValue(0.0);
            fadeTransition.setToValue(1.0);

            fadeTransition.play();
            transition.play();

            delay += 75;
            x += 130; // Verhoog X coordinaat met 100
            index++;
        }
        handPane.setMaxWidth(totalWidth);
        this.pane.getChildren().add(handPane);
        StackPane.setAlignment(handPane, Pos.TOP_CENTER);
    }
 
開發者ID:Badmuts,項目名稱:Machiavelli,代碼行數:42,代碼來源:HandActionBarView.java

示例15: applyAnimation

import javafx.animation.TranslateTransition; //導入方法依賴的package包/類
private void applyAnimation(final StackPane group)
 {
  
  DropShadow ds = new DropShadow();
  ds.setOffsetY(3.0f);
  ds.setColor(Color.color(0.4f, 0.4f, 0.4f));
   
  Text t = new Text();
  t.setEffect(ds);
  t.setCache(true);
  t.setFill(Color.BLUE);
  t.setText("JavaFX drop shadow...");
  t.setFont(Font.font(null, FontWeight.BOLD, 32));
  
  final TranslateTransition animation = new TranslateTransition(Duration.millis(2000), t);
     animation.setFromX(-100);
     animation.setToX(100);
     animation.setAutoReverse(true);
     animation.setCycleCount(Animation.INDEFINITE);
    
     TranslateTransition animation1 = new TranslateTransition(Duration.millis(1000), t);
     animation1.setFromX(0);
     animation1.setToX(-100);
     animation1.setAutoReverse(false);
     animation1.setCycleCount(1);
     animation1.setOnFinished(new EventHandler<ActionEvent>() {
	@Override
	public void handle(ActionEvent arg0) {
		 animation.playFromStart();
	}
});
     animation1.playFromStart();
     
     group.getChildren().add(t);
  }
 
開發者ID:SaiPradeepDandem,項目名稱:javafx-demos,代碼行數:36,代碼來源:MarqueTagInJavaFX.java


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