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


Java FadeTransition.setToValue方法代碼示例

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


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

示例1: buttonClicked

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

import javafx.animation.FadeTransition; //導入方法依賴的package包/類
public static void lollipop(double x, double y) {
    Circle circle = new Circle(x, y, 2);
    circle.setFill(randomColor());
    FrameController.instance.hover.getChildren().add(circle);
    FadeTransition fadeTransition = new FadeTransition(Duration.millis(500), circle);
    fadeTransition.setAutoReverse(true);
    fadeTransition.setCycleCount(2);
    fadeTransition.setFromValue(0.0);
    fadeTransition.setToValue(1.0);
    ScaleTransition scaleTransition = new ScaleTransition(Duration.millis(1000), circle);
    scaleTransition.setToX(10.0);
    scaleTransition.setToY(10.0);
    scaleTransition.setCycleCount(1);
    ParallelTransition parallelTransition = new ParallelTransition(fadeTransition, scaleTransition);
    parallelTransition.play();
    executorService.schedule(() -> Platform.runLater(() ->
            FrameController.instance.hover.getChildren().remove(circle)), 1000, TimeUnit.MILLISECONDS);
}
 
開發者ID:IzzelAliz,項目名稱:LCL,代碼行數:19,代碼來源:Transition.java

示例3: makeFadeOut

import javafx.animation.FadeTransition; //導入方法依賴的package包/類
private void makeFadeOut(String path) {
    FadeTransition fadeTransition = new FadeTransition();
    fadeTransition.setDuration(Duration.millis(250));
    fadeTransition.setNode(rootPane);
    fadeTransition.setFromValue(1);
    fadeTransition.setToValue(0);
    fadeTransition.setOnFinished(new EventHandler<ActionEvent>() {
        @Override
        public void handle(ActionEvent event) {
            try {
                loadScreenPlay(path);
            } catch (IOException ex) {
                Logger.getLogger(ControllerLayoutInicial.class.getName()).log(Level.SEVERE, null, ex);
            }
        }
    });
    fadeTransition.play();
}
 
開發者ID:tadeuespindolapalermo,項目名稱:ShowMilhaoPOOJava,代碼行數:19,代碼來源:ControllerLayoutTelaCreditos.java

示例4: seriesAdded

import javafx.animation.FadeTransition; //導入方法依賴的package包/類
@Override protected void seriesAdded(Series<Number, Number> series, int seriesIndex) {
    // handle any data already in series
    for (int j = 0; j < series.getData().size(); j++) {
        Data item = series.getData().get(j);
        Node candle = createCandle(seriesIndex, item, j);
        if (shouldAnimate()) {
            candle.setOpacity(0);
            getPlotChildren().add(candle);
            // fade in new candle
            FadeTransition ft = new FadeTransition(Duration.millis(500), candle);
            ft.setToValue(1);
            ft.play();
        } else {
            getPlotChildren().add(candle);
        }
    }
    // create series path
    Path seriesPath = new Path();
    seriesPath.getStyleClass().setAll("candlestick-average-line", "series" + seriesIndex);
    series.setNode(seriesPath);
    getPlotChildren().add(seriesPath);
}
 
開發者ID:jalian-systems,項目名稱:marathonv5,代碼行數:23,代碼來源:AdvCandleStickChartSample.java

示例5: dataItemRemoved

import javafx.animation.FadeTransition; //導入方法依賴的package包/類
/** @inheritDoc */
@Override
protected void dataItemRemoved(final Data<X, Y> item, final MultiAxisChart.Series<X, Y> series) {
	final Node symbol = item.getNode();

	if (symbol != null) {
		symbol.focusTraversableProperty().unbind();
	}

	if (shouldAnimate()) {
		// fade out old symbol
		FadeTransition ft = new FadeTransition(Duration.millis(500), symbol);
		ft.setToValue(0);
		ft.setOnFinished(actionEvent -> {
			getPlotChildren().remove(symbol);
			removeDataItemFromDisplay(series, item);
			symbol.setOpacity(1.0);
		});
		ft.play();
	} else {
		getPlotChildren().remove(symbol);
		removeDataItemFromDisplay(series, item);
	}
}
 
開發者ID:JKostikiadis,項目名稱:MultiAxisCharts,代碼行數:25,代碼來源:MultiAxisScatterChart.java

示例6: keyPressedAnimation

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

示例7: TransitionGainPV

import javafx.animation.FadeTransition; //導入方法依賴的package包/類
private void TransitionGainPV(Pane player_pane, Pane energy_pane) {
    Rectangle rectangle = new Rectangle(150, 50);
    Stop[] stops = new Stop[]{new Stop(0, Color.GREEN), new Stop(1, Color.WHITE)};
    LinearGradient gp = new LinearGradient(0, 0, 10, 24, true, CycleMethod.NO_CYCLE, stops);
    rectangle.setFill(gp);
    rectangle.setArcHeight(18);
    rectangle.setArcWidth(18);
    rectangle.setLayoutX(energy_pane.getLayoutX());
    rectangle.setLayoutY(energy_pane.getLayoutY());
    FadeTransition fadeTransition = new FadeTransition(Duration.millis(500), rectangle);
    fadeTransition.setFromValue(0f);
    fadeTransition.setToValue(0.6f);
    fadeTransition.setCycleCount(2);
    fadeTransition.setAutoReverse(true);
    player_pane.getChildren().add(rectangle);
    fadeTransition.play();
}
 
開發者ID:PBZ-InsightR,項目名稱:Spellmonger3,代碼行數:18,代碼來源:ControllerPlay.java

示例8: TransitionForAll

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

示例9: setScreen

import javafx.animation.FadeTransition; //導入方法依賴的package包/類
/**
 * set a screen by string id
 * 
 * @param name
 */
public void setScreen(String name) {
    // dont try to set new screen
    if (screens.get(name) == null) {
        System.out.println("invalid screen");
        return;
    }
    
    // fade out animation
    if (screen != null) {
        FadeTransition ft = new FadeTransition(new Duration(500), screen.getScene().getRoot());
        ft.setFromValue(1);
        ft.setToValue(0);
        ft.play();
        
        ticking = false;
        
        ft.setOnFinished(e -> {
            fadeIn(name);
        });
    } else {
        fadeIn(name);
    }
}
 
開發者ID:GlassWispInteractive,項目名稱:fictional-spoon,代碼行數:29,代碼來源:ScreenControl.java

示例10: initGraphics

import javafx.animation.FadeTransition; //導入方法依賴的package包/類
private void initGraphics() {
    font = Font.font(0.4 * PREFERRED_HEIGHT);

    text = new Text(getSkinnable().getText());
    text.setFont(font);
    text.setFill(getSkinnable().getTextColor());

    thumb = new Rectangle();
    thumb.setFill(getSkinnable().getThumbColor());
    thumb.setOpacity(0.0);
    thumb.setMouseTransparent(true);

    pressed  = new FadeTransition(Duration.millis(100), thumb);
    pressed.setInterpolator(Interpolator.EASE_IN);
    pressed.setFromValue(0.0);
    pressed.setToValue(0.8);

    released = new FadeTransition(Duration.millis(250), thumb);
    released.setInterpolator(Interpolator.EASE_OUT);
    released.setFromValue(0.8);
    released.setToValue(0.0);

    pane = new Pane(thumb, text);

    getChildren().setAll(pane);
}
 
開發者ID:HanSolo,項目名稱:MoodFX,代碼行數:27,代碼來源:BtnSkin.java

示例11: TransitionAlert

import javafx.animation.FadeTransition; //導入方法依賴的package包/類
private void TransitionAlert(Pane player_pane, Pane energy_pane) {
    Rectangle rectangle = new Rectangle(150, 50);
    Stop[] stops = new Stop[]{new Stop(0, Color.RED), new Stop(1, Color.WHITE)};
    LinearGradient gp = new LinearGradient(0, 0, 10, 24, true, CycleMethod.NO_CYCLE, stops);
    rectangle.setFill(gp);
    rectangle.setArcHeight(18);
    rectangle.setArcWidth(18);
    rectangle.setLayoutX(energy_pane.getLayoutX());
    rectangle.setLayoutY(energy_pane.getLayoutY());
    FadeTransition fadeTransition1 = new FadeTransition(Duration.millis(500), rectangle);
    fadeTransition1.setFromValue(0f);
    fadeTransition1.setToValue(0.6f);
    fadeTransition1.setCycleCount(2);
    fadeTransition1.setAutoReverse(true);
    player_pane.getChildren().add(rectangle);
    fadeTransition1.play();
}
 
開發者ID:PBZ-InsightR,項目名稱:Spellmonger3,代碼行數:18,代碼來源:ControllerPlay.java

示例12: regresar

import javafx.animation.FadeTransition; //導入方法依賴的package包/類
public void regresar(MouseEvent mouseEvent) {
    Stage stage = (Stage) btn_regresar.getScene().getWindow();
    FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("Menu.fxml"));
    Parent root = null;
    try {
        root = (Parent)fxmlLoader.load();
    } catch (Exception e) {
        Alert alerta = new Alert(Alert.AlertType.ERROR);
        alerta.setTitle("Error de Aplicacion");
        alerta.setHeaderText("Mira, hubo un error...");
        alerta.setContentText("Lo siento. Llama al administrador.");
        alerta.showAndWait();
        Platform.exit();
    }
    FadeTransition ft = new FadeTransition(Duration.millis(1500), root);
    ft.setFromValue(0.0);
    ft.setToValue(1.0);
    ft.play();
    Scene scene = new Scene(root);
    stage.setScene(scene);
    stage.show();
}
 
開發者ID:ampotty,項目名稱:uip-pc2,代碼行數:23,代碼來源:Fecha.java

示例13: reservar

import javafx.animation.FadeTransition; //導入方法依賴的package包/類
public void reservar(ActionEvent actionEvent) {
    Stage stage = (Stage) btn_reservar.getScene().getWindow();
    FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("Fecha.fxml"));
    Parent root = null;
    try {
        root = (Parent)fxmlLoader.load();
    } catch (Exception e) {
        Alert alerta = new Alert(Alert.AlertType.ERROR);
        alerta.setTitle("Error de Aplicacion");
        alerta.setHeaderText("Mira, hubo un error...");
        alerta.setContentText("Lo siento. Llama al administrador.");
        alerta.showAndWait();
        Platform.exit();
    }
    FadeTransition ft = new FadeTransition(Duration.millis(1500), root);
    ft.setFromValue(0.0);
    ft.setToValue(1.0);
    ft.play();
    Scene scene = new Scene(root);
    stage.setScene(scene);
    stage.show();
}
 
開發者ID:ampotty,項目名稱:uip-pc2,代碼行數:23,代碼來源:Menu.java

示例14: atras

import javafx.animation.FadeTransition; //導入方法依賴的package包/類
public void atras(MouseEvent mouseEvent) {
    Stage stage = (Stage) atras.getScene().getWindow();
    FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource("Resumen.fxml"));
    Parent root = null;
    try {
        root = fxmlLoader.load();
    } catch (Exception e) {
        Alert alerta = new Alert(Alert.AlertType.ERROR);
        alerta.setTitle("Error de Aplicación");
        alerta.setContentText("Llama al lapecillo de sistemas.");
        alerta.showAndWait();
        Platform.exit();
    }
    FadeTransition ft = new FadeTransition(Duration.millis(1500), root);
    ft.setFromValue(0.0);
    ft.setToValue(1.0);
    ft.play();
    Resumen controller = fxmlLoader.<Resumen>getController();
    controller.setCuenta();
    controller.setSaldo();
    Scene scene = new Scene(root);
    stage.setScene(scene);
    stage.show();
}
 
開發者ID:ampotty,項目名稱:uip-pc2,代碼行數:25,代碼來源:Movimientos.java

示例15: dataItemAdded

import javafx.animation.FadeTransition; //導入方法依賴的package包/類
@Override protected void dataItemAdded(Series<Number, Number> series, int itemIndex, Data<Number, Number> item) {
    Node candle = createCandle(getData().indexOf(series), item, itemIndex);
    if (shouldAnimate()) {
        candle.setOpacity(0);
        getPlotChildren().add(candle);
        // fade in new candle
        FadeTransition ft = new FadeTransition(Duration.millis(500), candle);
        ft.setToValue(1);
        ft.play();
    } else {
        getPlotChildren().add(candle);
    }
    // always draw average line on top
    if (series.getNode() != null) {
        series.getNode().toFront();
    }
}
 
開發者ID:eugenkiss,項目名稱:kotlinfx-ensemble,代碼行數:18,代碼來源:AdvCandleStickChartSample.java


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