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


Java Interpolator類代碼示例

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


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

示例1: init

import javafx.animation.Interpolator; //導入依賴的package包/類
private void init(Stage primaryStage) {
    Group root = new Group();
    primaryStage.setResizable(false);
    primaryStage.setScene(new Scene(root, 250, 90));

    //create circles by method createMovingCircle listed below
    Circle circle1 = createMovingCircle(Interpolator.LINEAR); //default interpolator
    circle1.setOpacity(0.7);
    Circle circle2 = createMovingCircle(Interpolator.EASE_BOTH); //circle slows down when reached both ends of trajectory
    circle2.setOpacity(0.45);
    Circle circle3 = createMovingCircle(Interpolator.EASE_IN);
    Circle circle4 = createMovingCircle(Interpolator.EASE_OUT);
    Circle circle5 = createMovingCircle(Interpolator.SPLINE(0.5, 0.1, 0.1, 0.5)); //one can define own behaviour of interpolator by spline method
    
    root.getChildren().addAll(
            circle1,
            circle2,
            circle3,
            circle4,
            circle5
    );
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:23,代碼來源:TimelineInterpolator.java

示例2: startAnimateForm300

import javafx.animation.Interpolator; //導入依賴的package包/類
private Timeline startAnimateForm300() {
    Timeline tml = new Timeline(
            new KeyFrame(Duration.ZERO, new KeyValue(pnlContent.maxHeightProperty(), 70)),
            new KeyFrame(Duration.seconds(0.4), new KeyValue(pnlContent.maxHeightProperty(), 300, Interpolator.EASE_BOTH)));
    tml.setOnFinished((ActionEvent event) -> {
        pnlForm.setVisible(true);
        txtSend.requestFocus();
    });
    return tml;
}
 
開發者ID:RestComm,項目名稱:phone-simulator,代碼行數:11,代碼來源:USSDGUIController.java

示例3: startAnimateForm130

import javafx.animation.Interpolator; //導入依賴的package包/類
private Timeline startAnimateForm130() {
    Timeline tml = new Timeline(
            new KeyFrame(Duration.ZERO, new KeyValue(pnlContent.maxHeightProperty(), 70)),
            new KeyFrame(Duration.seconds(0.4), new KeyValue(pnlContent.maxHeightProperty(), 130, Interpolator.EASE_BOTH)));
    tml.setOnFinished((ActionEvent event) -> {

        pnlForm.setVisible(false);
        pnlMessage.setVisible(true);
    });

    return tml;
}
 
開發者ID:RestComm,項目名稱:phone-simulator,代碼行數:13,代碼來源:USSDGUIController.java

示例4: createMovingCircle

import javafx.animation.Interpolator; //導入依賴的package包/類
private Circle createMovingCircle(Interpolator interpolator) {
    //create a transparent circle
    Circle circle = new Circle(45,45, 40,  Color.web("1c89f4"));
    circle.setOpacity(0);
    //add effect
    circle.setEffect(new Lighting());

    //create a timeline for moving the circle
   
    timeline.setCycleCount(Timeline.INDEFINITE);
    timeline.setAutoReverse(true);

    //create a keyValue for horizontal translation of circle to the position 155px with given interpolator
    KeyValue keyValue = new KeyValue(circle.translateXProperty(), 155, interpolator);

    //create a keyFrame with duration 4s
    KeyFrame keyFrame = new KeyFrame(Duration.seconds(4), keyValue);

    //add the keyframe to the timeline
    timeline.getKeyFrames().add(keyFrame);

    return circle;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:24,代碼來源:TimelineInterpolator.java

示例5: animateExistingTile

import javafx.animation.Interpolator; //導入依賴的package包/類
/**
 * Animation that moves the tile from its previous location to a new location 
 * @param tile to be animated
 * @param newLocation new location of the tile
 * @return a timeline 
 */
private Timeline animateExistingTile(Tile tile, Location newLocation) {
    Timeline timeline = new Timeline();
    KeyValue kvX = new KeyValue(tile.layoutXProperty(),
            newLocation.getLayoutX(Board.CELL_SIZE) - (tile.getMinHeight() / 2), Interpolator.EASE_OUT);
    KeyValue kvY = new KeyValue(tile.layoutYProperty(),
            newLocation.getLayoutY(Board.CELL_SIZE) - (tile.getMinHeight() / 2), Interpolator.EASE_OUT);

    KeyFrame kfX = new KeyFrame(ANIMATION_EXISTING_TILE, kvX);
    KeyFrame kfY = new KeyFrame(ANIMATION_EXISTING_TILE, kvY);

    timeline.getKeyFrames().add(kfX);
    timeline.getKeyFrames().add(kfY);

    return timeline;
}
 
開發者ID:juebanlin,項目名稱:util4j,代碼行數:22,代碼來源:GameManager.java

示例6: createDataRemoveTimeline

import javafx.animation.Interpolator; //導入依賴的package包/類
private Timeline createDataRemoveTimeline(final Data<X, Y> item, final Node symbol, final Series<X, Y> series) {
	Timeline t = new Timeline();
	// save data values in case the same data item gets added immediately.
	XYValueMap.put(item, ((Number) item.getYValue()).doubleValue());

	t.getKeyFrames()
			.addAll(new KeyFrame(Duration.ZERO, new KeyValue(item.currentYProperty(), item.getCurrentY()),
					new KeyValue(item.currentXProperty(), item.getCurrentX())),
					new KeyFrame(Duration.millis(500), actionEvent -> {
						if (symbol != null)
							getPlotChildren().remove(symbol);
						removeDataItemFromDisplay(series, item);
						XYValueMap.clear();
					}, new KeyValue(item.currentYProperty(), item.getYValue(), Interpolator.EASE_BOTH),
							new KeyValue(item.currentXProperty(), item.getXValue(), Interpolator.EASE_BOTH)));
	return t;
}
 
開發者ID:JKostikiadis,項目名稱:MultiAxisCharts,代碼行數:18,代碼來源:MultiAxisLineChart.java

示例7: animateDataAdd

import javafx.animation.Interpolator; //導入依賴的package包/類
private void animateDataAdd(Data<X, Y> item, Node bar) {
	double barVal;
	if (orientation == Orientation.VERTICAL) {
		barVal = ((Number) item.getYValue()).doubleValue();
		if (barVal < 0) {
			bar.getStyleClass().add(NEGATIVE_STYLE);
		}
		item.setCurrentY(getY1Axis().toRealValue((barVal < 0) ? -bottomPos : bottomPos));
		getPlotChildren().add(bar);
		item.setYValue(getY1Axis().toRealValue(barVal));
		animate(new KeyFrame(Duration.ZERO, new KeyValue(item.currentYProperty(), item.getCurrentY())),
				new KeyFrame(Duration.millis(700),
						new KeyValue(item.currentYProperty(), item.getYValue(), Interpolator.EASE_BOTH)));
	} else {
		barVal = ((Number) item.getXValue()).doubleValue();
		if (barVal < 0) {
			bar.getStyleClass().add(NEGATIVE_STYLE);
		}
		item.setCurrentX(getXAxis().toRealValue((barVal < 0) ? -bottomPos : bottomPos));
		getPlotChildren().add(bar);
		item.setXValue(getXAxis().toRealValue(barVal));
		animate(new KeyFrame(Duration.ZERO, new KeyValue(item.currentXProperty(), item.getCurrentX())),
				new KeyFrame(Duration.millis(700),
						new KeyValue(item.currentXProperty(), item.getXValue(), Interpolator.EASE_BOTH)));
	}
}
 
開發者ID:JKostikiadis,項目名稱:MultiAxisCharts,代碼行數:27,代碼來源:MultiAxisBarChart.java

示例8: moveCircle

import javafx.animation.Interpolator; //導入依賴的package包/類
private void moveCircle(Circle C) {

        double centerX = (scene.getWidth() - maxRadius) * Math.random() + maxRadius;
        double centerY = scene.getHeight();

        C.setCenterX(centerX);
        //C.setTranslateY((scene.getHeight() - maxRadius) * Math.random() + maxRadius);
        C.setCenterY(centerY);
        double radius = (maxRadius - minRadius) * Math.random() + minRadius;
        C.setFill(new Color(Math.random(), Math.random(), Math.random(), 1));
        C.setRadius(radius);

        Timeline timeline = new Timeline();

        double timelength = ((maxTimeLength - minTimeLength) * Math.random() + minTimeLength) * 1000;

        timeline.getKeyFrames().add(new KeyFrame(new Duration(timelength), new KeyValue(C.centerYProperty(), 0 - maxRadius, Interpolator.EASE_IN)));

       /* SequentialTransition sequence = new SequentialTransition();

        for(int i = 0; i < 10; i++) {
            sequence.getChildren().add(new KeyFrame(new Duration(timelength / 10), new KeyValue(C.centerXProperty(), centerX - 100)));
            sequence.getChildren().add(new KeyFrame(new Duration(timelength / 10), new KeyValue(C.centerXProperty(), centerX + 100)));
        }*/

        timeline.play();

        timeline.setOnFinished(new EventHandler<ActionEvent>() {

            @Override
            public void handle(ActionEvent actionEvent) {

                //moveCircle(C);
                newCircle();
            }
        });
    }
 
開發者ID:schwabdidier,項目名稱:GazePlay,代碼行數:38,代碼來源:Bubble.java

示例9: FlipTransition

import javafx.animation.Interpolator; //導入依賴的package包/類
/**
 * Create new FlipTransition
 *
 * @param node The node to affect
 */
public FlipTransition(final Node node) {
    super(node, new Timeline(
            new KeyFrame(Duration.millis(0),
                    new KeyValue(node.rotateProperty(), 0, Interpolator.EASE_OUT),
                    new KeyValue(node.translateZProperty(), 0, Interpolator.EASE_OUT)),
            new KeyFrame(Duration.millis(400),
                    new KeyValue(node.translateZProperty(), -150, Interpolator.EASE_OUT),
                    new KeyValue(node.rotateProperty(), -170, Interpolator.EASE_OUT)),
            new KeyFrame(Duration.millis(500),
                    new KeyValue(node.translateZProperty(), -150, Interpolator.EASE_IN),
                    new KeyValue(node.rotateProperty(), -190, Interpolator.EASE_IN),
                    new KeyValue(node.scaleXProperty(), 1, Interpolator.EASE_IN),
                    new KeyValue(node.scaleYProperty(), 1, Interpolator.EASE_IN)),
            new KeyFrame(Duration.millis(800),
                    new KeyValue(node.translateZProperty(), 0, Interpolator.EASE_IN),
                    new KeyValue(node.rotateProperty(), -360, Interpolator.EASE_IN),
                    new KeyValue(node.scaleXProperty(), 0.95, Interpolator.EASE_IN),
                    new KeyValue(node.scaleYProperty(), 0.95, Interpolator.EASE_IN)),
            new KeyFrame(Duration.millis(1000),
                    new KeyValue(node.scaleXProperty(), 1, Interpolator.EASE_IN),
                    new KeyValue(node.scaleYProperty(), 1, Interpolator.EASE_IN))));
    this.flipNode = node;
    setCycleDuration(Duration.seconds(1));
    setDelay(Duration.seconds(0.2));
}
 
開發者ID:EricCanull,項目名稱:fxexperience2,代碼行數:31,代碼來源:FlipTransition.java

示例10: setupShowAnimation

import javafx.animation.Interpolator; //導入依賴的package包/類
@Override
protected Timeline setupShowAnimation() {
    Timeline tl = new Timeline();

    // Sets the x location of the tray off the screen
    double offScreenX = stage.getOffScreenBounds().getX();
    KeyValue kvX = new KeyValue(stage.xLocationProperty(), offScreenX);
    KeyFrame frame1 = new KeyFrame(Duration.ZERO, kvX);

    // Animates the Tray onto the screen and interpolates at a tangent for 300 millis
    Interpolator interpolator = Interpolator.TANGENT(Duration.millis(300), 50);
    KeyValue kvInter = new KeyValue(stage.xLocationProperty(), stage.getBottomRight().getX(), interpolator);
    KeyFrame frame2 = new KeyFrame(Duration.millis(1300), kvInter);

    // Sets opacity to 0 instantly
    KeyValue kvOpacity = new KeyValue(stage.opacityProperty(), 0.0);
    KeyFrame frame3 = new KeyFrame(Duration.ZERO, kvOpacity);

    // Increases the opacity to fully visible whilst moving in the space of 1000 millis
    KeyValue kvOpacity2 = new KeyValue(stage.opacityProperty(), 1.0);
    KeyFrame frame4 = new KeyFrame(Duration.millis(1000), kvOpacity2);

    tl.getKeyFrames().addAll(frame1, frame2, frame3, frame4);

    tl.setOnFinished(e -> trayIsShowing = true);

    return tl;
}
 
開發者ID:victorward,項目名稱:recruitervision,代碼行數:29,代碼來源:SlideAnimation.java

示例11: setupDismissAnimation

import javafx.animation.Interpolator; //導入依賴的package包/類
@Override
protected Timeline setupDismissAnimation() {
    Timeline tl = new Timeline();

    double offScreenX = stage.getOffScreenBounds().getX();
    Interpolator interpolator = Interpolator.TANGENT(Duration.millis(300), 50);
    double trayPadding = 3;

    // The destination X location for the stage. Which is off the users screen
    // Since the tray has some padding, we want to hide that too
    KeyValue kvX = new KeyValue(stage.xLocationProperty(), offScreenX + trayPadding, interpolator);
    KeyFrame frame1 = new KeyFrame(Duration.millis(1400), kvX);

    // Change the opacity level to 0.4 over the duration of 2000 millis
    KeyValue kvOpacity = new KeyValue(stage.opacityProperty(), 0.4);
    KeyFrame frame2 = new KeyFrame(Duration.millis(2000), kvOpacity);

    tl.getKeyFrames().addAll(frame1, frame2);

    tl.setOnFinished(e -> {
        trayIsShowing = false;
        stage.close();
        stage.setLocation(stage.getBottomRight());
    });

    return tl;
}
 
開發者ID:victorward,項目名稱:recruitervision,代碼行數:28,代碼來源:SlideAnimation.java

示例12: SpriteAnimation

import javafx.animation.Interpolator; //導入依賴的package包/類
/**
 * Creates an animation that will run for indefinite time.
 * Use setCycleCount(1) to run animation only once. Remember to remove the imageView afterwards.
 *
 * @param imageView - the imageview of the sprite
 * @param duration - How long should one animation cycle take
 * @param count - Number of frames
 * @param columns - Number of colums the sprite has
 * @param offsetX - Offset x
 * @param offsetY - Offset y
 * @param width - Width of each frame
 * @param height - Height of each frame
 */
public SpriteAnimation(
        ImageView imageView,
        Duration duration,
        int count, int columns,
        int offsetX, int offsetY,
        int width, int height
) {
    this.imageView = imageView;
    this.count = count;
    this.columns = columns;
    this.offsetX = offsetX;
    this.offsetY = offsetY;
    this.width = width;
    this.height = height;
    setCycleDuration(duration);
    setCycleCount(Animation.INDEFINITE);
    setInterpolator(Interpolator.LINEAR);
    this.imageView.setViewport(new Rectangle2D(offsetX, offsetY, width, height));

}
 
開發者ID:INAETICS,項目名稱:Drones-Simulator,代碼行數:34,代碼來源:SpriteAnimation.java

示例13: initializeShakeAnimation

import javafx.animation.Interpolator; //導入依賴的package包/類
private void initializeShakeAnimation() {
    final Interpolator interpolator = Interpolator.SPLINE(0.645, 0.045, 0.355, 1);

    final double startX = controller.root.getTranslateX();
    final KeyValue kv1 = new KeyValue(controller.root.translateXProperty(), startX - 3, interpolator);
    final KeyValue kv2 = new KeyValue(controller.root.translateXProperty(), startX + 3, interpolator);
    final KeyValue kv3 = new KeyValue(controller.root.translateXProperty(), startX, interpolator);

    final KeyFrame kf1 = new KeyFrame(millis(50), kv1);
    final KeyFrame kf2 = new KeyFrame(millis(100), kv2);
    final KeyFrame kf3 = new KeyFrame(millis(150), kv1);
    final KeyFrame kf4 = new KeyFrame(millis(200), kv2);
    final KeyFrame kf5 = new KeyFrame(millis(250), kv3);

    shakeAnimation.getKeyFrames().addAll(kf1, kf2, kf3, kf4, kf5);
}
 
開發者ID:ulriknyman,項目名稱:H-Uppaal,代碼行數:17,代碼來源:NailPresentation.java

示例14: collapseMessagesIfNotCollapsed

import javafx.animation.Interpolator; //導入依賴的package包/類
public void collapseMessagesIfNotCollapsed() {
    final Transition collapse = new Transition() {
        double height = tabPaneContainer.getMaxHeight();

        {
            setInterpolator(Interpolator.SPLINE(0.645, 0.045, 0.355, 1));
            setCycleDuration(Duration.millis(200));
        }

        @Override
        protected void interpolate(final double frac) {
            tabPaneContainer.setMaxHeight(((height - 35) * (1 - frac)) + 35);
        }
    };

    if (tabPaneContainer.getMaxHeight() > 35) {
        collapse.play();
    }
}
 
開發者ID:ulriknyman,項目名稱:H-Uppaal,代碼行數:20,代碼來源:HUPPAALController.java

示例15: collapseMessagesClicked

import javafx.animation.Interpolator; //導入依賴的package包/類
@FXML
public void collapseMessagesClicked() {
    final Transition collapse = new Transition() {
        double height = tabPaneContainer.getMaxHeight();

        {
            setInterpolator(Interpolator.SPLINE(0.645, 0.045, 0.355, 1));
            setCycleDuration(Duration.millis(200));
        }

        @Override
        protected void interpolate(final double frac) {
            tabPaneContainer.setMaxHeight(((height - 35) * (1 - frac)) + 35);
        }
    };

    if (tabPaneContainer.getMaxHeight() > 35) {
        collapse.play();
    } else {
        expandMessagesContainer.play();
    }
}
 
開發者ID:ulriknyman,項目名稱:H-Uppaal,代碼行數:23,代碼來源:HUPPAALController.java


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