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


Java ScaleTransition.setFromY方法代碼示例

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


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

示例1: buttonClicked

import javafx.animation.ScaleTransition; //導入方法依賴的package包/類
/**
 * 
 * @param b 
 */
public void buttonClicked(Button b, KeyCode key) {
	ScaleTransition st = new ScaleTransition(Duration.seconds(.2), b);
	st.setFromX(.8);
	st.setFromY(.8);
	st.setToX(1.6);
	st.setToY(1.6);
	st.play();
	
	FadeTransition ft = new FadeTransition(Duration.seconds(.2), b);
	ft.setFromValue(.2);
	ft.setToValue(1);
	ft.play();	
	
	boolean movable = true;
	Direction direction = new Direction(key);
	if(direction.getKey().equals(KeyCode.UP)) movable = this.upMove(direction);
	if(direction.getKey().equals(KeyCode.RIGHT)) movable = this.rightMove(direction);
	if(direction.getKey().equals(KeyCode.DOWN)) movable = this.downMove(direction);
	if(direction.getKey().equals(KeyCode.LEFT)) movable = this.leftMove(direction);
	if(movable) {	
		int random_value = ((int)(new Random().nextDouble() * 10)) > 8 ? 4 : 2;
		this.addNewTile(String.valueOf(random_value), Duration.seconds(.2));
	}
		
}
 
開發者ID:ShekkarRaee,項目名稱:xpanderfx,代碼行數:30,代碼來源:MainFXMLDocumentController.java

示例2: keyPressedAnimation

import javafx.animation.ScaleTransition; //導入方法依賴的package包/類
/**
 * Animation for key pressed.
 * @param b 
 */
private void keyPressedAnimation(Button b) {
	ScaleTransition st = new ScaleTransition(Duration.seconds(.2), b);
	st.setFromX(.8);
	st.setFromY(.8);
	st.setToX(1.6);
	st.setToY(1.6);
	st.play();
	st.setOnFinished(e -> {
		if(!b.isHover()) {
			ScaleTransition st2 = new ScaleTransition(Duration.seconds(.09), b);
			st2.setToX(1);
			st2.setToY(1);
			st2.play();
		}
	});
	
	FadeTransition ft = new FadeTransition(Duration.seconds(.2), b);
	ft.setFromValue(.2);
	ft.setToValue(1);
	ft.play();	
}
 
開發者ID:ShekkarRaee,項目名稱:xpanderfx,代碼行數:26,代碼來源:MainFXMLDocumentController.java

示例3: doOutputScaleAnimation

import javafx.animation.ScaleTransition; //導入方法依賴的package包/類
private void doOutputScaleAnimation(){
    ParallelTransition pt = new ParallelTransition();
    for(Node c : outputTabContainer.getChildren()){
        if(c == compilerArea) continue;
        ScaleTransition scale = new ScaleTransition(Duration.millis(250), c);
        scale.setFromX(1);
        scale.setToX(1.15);
        scale.setFromY(1);
        scale.setToY(1.15);
        scale.setAutoReverse(true);
        scale.setCycleCount(2);
        pt.getChildren().add(scale);
    }
    pt.play();

}
 
開發者ID:ProPra16,項目名稱:programmierpraktikum-abschlussprojekt-amigos,代碼行數:17,代碼來源:ExerciseController.java

示例4: initializePromptMoveTransition

import javafx.animation.ScaleTransition; //導入方法依賴的package包/類
private void initializePromptMoveTransition() {
    ScaleTransition promptScale = new ScaleTransition(promptAnimationDuration, this.promptLabel);
    promptScale.setFromX(1);
    promptScale.setFromY(1);
    promptScale.setToX(.7);
    promptScale.setToY(.7);
    promptScale.setInterpolator(promptAnimationInterpolator);

    TranslateTransition promptTranslate = new TranslateTransition(promptAnimationDuration, this.promptLabel);
    promptTranslate.setFromY(0);
    promptTranslate.setToY(-AnchorPane.getTopAnchor(this.promptLabel) - 4);
    promptTranslate.setInterpolator(promptAnimationInterpolator);

    this.promptLabel.translateXProperty().bind(
            this.promptLabel.widthProperty()
            .multiply(this.promptLabel.scaleXProperty()
                    .subtract(1)
                    .divide(2)));

    this.promptMoveAnimation = new ParallelTransition(promptScale, promptTranslate);

    this.promptUp = false;
}
 
開發者ID:Novanoid,項目名稱:Tourney,代碼行數:24,代碼來源:MaterialTextField.java

示例5: createWalletHideAnimation

import javafx.animation.ScaleTransition; //導入方法依賴的package包/類
private Animation createWalletHideAnimation() {
   	try {
   		FadeTransition fade = new FadeTransition(Duration.millis(1000), this.knownWalletDetailContainer);
   		fade.setFromValue(1.0);
   		fade.setToValue(0.0);
   		fade.setCycleCount(1);
   		
   		ScaleTransition scale = new ScaleTransition(Duration.millis(1000), this.knownWalletDetailContainer);
   		scale.setFromX(1.0);
   		scale.setToX(0.1);
   		scale.setFromY(1.0);
   		scale.setToY(0.1);
   		scale.setCycleCount(1);
   		
   		ParallelTransition parallel = new ParallelTransition();
   		parallel.getChildren().addAll(fade, scale);
   		parallel.setCycleCount(1);
   		
   		return parallel;		
	} catch (Exception e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
		return null;
	}    	
}
 
開發者ID:crypto-coder,項目名稱:firstlight,代碼行數:26,代碼來源:KnownWalletController.java

示例6: createWalletShowAnimation

import javafx.animation.ScaleTransition; //導入方法依賴的package包/類
private Animation createWalletShowAnimation() {
   	try {
   		FadeTransition fade = new FadeTransition(Duration.millis(1000), this.knownWalletDetailContainer);
   		fade.setFromValue(0.0);
   		fade.setToValue(1.0);
   		fade.setCycleCount(1);
   		
   		ScaleTransition scale = new ScaleTransition(Duration.millis(1000), this.knownWalletDetailContainer);
   		scale.setFromX(0.1);
   		scale.setToX(1.0);
   		scale.setFromY(0.1);
   		scale.setToY(1.0);
   		scale.setCycleCount(1);
   		
   		ParallelTransition parallel = new ParallelTransition();
   		parallel.getChildren().addAll(fade, scale);
   		parallel.setCycleCount(1);
   		
   		return parallel;		
	} catch (Exception e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
		return null;
	}    	
}
 
開發者ID:crypto-coder,項目名稱:firstlight,代碼行數:26,代碼來源:KnownWalletController.java

示例7: popupOpener

import javafx.animation.ScaleTransition; //導入方法依賴的package包/類
/**
 * 
 * @param pp
 * @param node 
 */
private void popupOpener(Node node) {	
	ScaleTransition st = new ScaleTransition(Duration.seconds(.3), node);
	st.setFromX(.2);
	st.setFromY(.2);
	st.setToX(1);
	st.setToY(1);
	st.play();
	
	FadeTransition fd = new FadeTransition(Duration.seconds(.2), node);
	fd.setFromValue(.2);
	fd.setToValue(1);
	fd.play();
}
 
開發者ID:ShekkarRaee,項目名稱:xpanderfx,代碼行數:19,代碼來源:MainFXMLDocumentController.java

示例8: bounce

import javafx.animation.ScaleTransition; //導入方法依賴的package包/類
/**
 * Makes the entry view "bounce" by applying a scale transition. This is a
 * good way to make an entry stand out, e.g. when it receives the keyboard
 * focus.
 */
public final void bounce() {
    ScaleTransition transition = new ScaleTransition(Duration.millis(200), this);
    setCache(true);
    setCacheHint(CacheHint.SCALE);
    transition.setAutoReverse(true);
    transition.setFromX(1);
    transition.setToX(.8);
    transition.setFromY(1);
    transition.setToY(.8);
    transition.setCycleCount(2);
    transition.setOnFinished(evt -> setCache(false));
    transition.play();
}
 
開發者ID:dlemmermann,項目名稱:CalendarFX,代碼行數:19,代碼來源:EntryViewBase.java

示例9: AnimatedPopup

import javafx.animation.ScaleTransition; //導入方法依賴的package包/類
private AnimatedPopup() {

            showFadeTransition = new FadeTransition(Duration.seconds(0.2), getScene().getRoot());
            showFadeTransition.setFromValue(0);
            showFadeTransition.setToValue(1);
            showFadeTransition.setInterpolator(new BackInterpolator());

            showScaleTransition = new ScaleTransition(Duration.seconds(0.2), getScene().getRoot());
            showScaleTransition.setFromX(0.8);
            showScaleTransition.setFromY(0.8);
            showScaleTransition.setToY(1);
            showScaleTransition.setToX(1);

            showScaleTransition.setInterpolator(new BackInterpolator());

            hideFadeTransition = new FadeTransition(Duration.seconds(.3), getScene().getRoot());
            hideFadeTransition.setFromValue(1);
            hideFadeTransition.setToValue(0);
            hideFadeTransition.setInterpolator(new BackInterpolator());

            hideScaleTransition = new ScaleTransition(Duration.seconds(.3), getScene().getRoot());
            hideScaleTransition.setFromX(1);
            hideScaleTransition.setFromY(1);
            hideScaleTransition.setToY(0.8);
            hideScaleTransition.setToX(0.8);

            hideScaleTransition.setInterpolator(new BackInterpolator());
            hideScaleTransition.setOnFinished(new EventHandler<ActionEvent>() {
                @Override
                public void handle(ActionEvent actionEvent) {
                    if (AnimatedPopup.super.isShowing()) {
                        AnimatedPopup.super.hide();
                    }
                }
            });
        }
 
開發者ID:scourgemancer,項目名稱:graphing-loan-analyzer,代碼行數:37,代碼來源:DatePickerSkin.java

示例10: zoom

import javafx.animation.ScaleTransition; //導入方法依賴的package包/類
private static void zoom(Node node, double scaleFrom, double scaleTo, double opacity, EventHandler<ActionEvent> eventHandler) {
    ScaleTransition scaleTransition = new ScaleTransition(Duration.millis(200), node);
    scaleTransition.setToX(scaleTo);
    scaleTransition.setToY(scaleTo);
    scaleTransition.setFromX(scaleFrom);
    scaleTransition.setFromY(scaleFrom);
    FadeTransition fadeTransition = new FadeTransition(Duration.millis(200), node);
    fadeTransition.setFromValue(opacity);
    fadeTransition.setToValue(1D - opacity);
    ParallelTransition parallelTransition = new ParallelTransition(fadeTransition, scaleTransition);
    parallelTransition.play();
    parallelTransition.setOnFinished(eventHandler);
}
 
開發者ID:IzzelAliz,項目名稱:LCL,代碼行數:14,代碼來源:ZoomTransition.java

示例11: minimize

import javafx.animation.ScaleTransition; //導入方法依賴的package包/類
@Override
public void minimize() {
    FadeTransition ft = new FadeTransition(Duration.seconds(1.5), root);
    ft.setFromValue(1);
    ft.setToValue(0);
    ft.setOnFinished(evt -> this.hide());
    ft.play();


    ScaleTransition st = new ScaleTransition(Duration.seconds(1), root);
    st.setFromY(1);
    st.setToY(0);
    st.play();
}
 
開發者ID:AlmasB,項目名稱:mmorpg,代碼行數:15,代碼來源:UIMenuWindow.java

示例12: restore

import javafx.animation.ScaleTransition; //導入方法依賴的package包/類
@Override
public void restore() {
    this.show();
    ScaleTransition st = new ScaleTransition(Duration.seconds(0.66), root);
    st.setFromY(0);
    st.setToY(1);
    st.play();

    FadeTransition ft = new FadeTransition(Duration.seconds(1.5), root);
    ft.setFromValue(0);
    ft.setToValue(1);
    ft.play();
}
 
開發者ID:AlmasB,項目名稱:mmorpg,代碼行數:14,代碼來源:UIMenuWindow.java

示例13: createDefaultShowAnimation

import javafx.animation.ScaleTransition; //導入方法依賴的package包/類
private Animation createDefaultShowAnimation(Node nodeToShow) {
   	try {
   		//Make sure the node is in the proper disposition
   		nodeToShow.setOpacity(0.0);
   		nodeToShow.setScaleX(0.9);
   		nodeToShow.setScaleY(0.9);
   		
   		//Create and set the animations
   		FadeTransition fade = new FadeTransition(Duration.millis(500), nodeToShow);
   		fade.setFromValue(0.0);
   		fade.setToValue(1.0);
   		fade.setCycleCount(1);
   		
   		ScaleTransition scale = new ScaleTransition(Duration.millis(500), nodeToShow);
   		scale.setFromX(0.9);
   		scale.setToX(1.0);
   		scale.setFromY(0.9);
   		scale.setToY(1.0);
   		scale.setCycleCount(1);
   		
   		ParallelTransition parallel = new ParallelTransition();
   		parallel.getChildren().addAll(fade, scale);
   		parallel.setCycleCount(1);
   		
   		return parallel;		
	} catch (Exception e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
		return null;
	}    	
}
 
開發者ID:crypto-coder,項目名稱:firstlight,代碼行數:32,代碼來源:ApplicationShellController.java

示例14: createDefaultHideAnimation

import javafx.animation.ScaleTransition; //導入方法依賴的package包/類
private Animation createDefaultHideAnimation(Node nodeToHide) {
   	try {
   		//Make sure the node is in the proper disposition
   		nodeToHide.setOpacity(1.0);
   		nodeToHide.setScaleX(1.0);
   		nodeToHide.setScaleY(1.0);
   		
   		//Create and set the animations
   		FadeTransition fade = new FadeTransition(Duration.millis(500), nodeToHide);
   		fade.setFromValue(1.0);
   		fade.setToValue(0.0);
   		fade.setCycleCount(1);
   		
   		ScaleTransition scale = new ScaleTransition(Duration.millis(500), nodeToHide);
   		scale.setFromX(1.0);
   		scale.setToX(0.9);
   		scale.setFromY(1.0);
   		scale.setToY(0.9);
   		scale.setCycleCount(1);
   		
   		ParallelTransition parallel = new ParallelTransition();
   		parallel.getChildren().addAll(fade, scale);
   		parallel.setCycleCount(1);
   		
   		return parallel;		
	} catch (Exception e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
		return null;
	}    	
}
 
開發者ID:crypto-coder,項目名稱:firstlight,代碼行數:32,代碼來源:ApplicationShellController.java

示例15: fazerTransicao

import javafx.animation.ScaleTransition; //導入方法依賴的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


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