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


Java TranslateTransition.setByX方法代碼示例

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


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

示例1: update

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

示例2: eval

import javafx.animation.TranslateTransition; //導入方法依賴的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();
        System.out.println(env.getSpeed());
        TranslateTransition tt
                = new TranslateTransition(Duration.millis(env.getSpeed()), sprite);
        double x = sprite.moveBy((Integer) c);
        tt.setByX(x);
        env.setX(sprite.getX() + env.getX() + x);
        st.getChildren().add(tt);
    }
    return c;
}
 
開發者ID:jointry,項目名稱:jointry,代碼行數:17,代碼來源:MoveStmnt.java

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

示例4: selectedStateChanged

import javafx.animation.TranslateTransition; //導入方法依賴的package包/類
private void selectedStateChanged() {
    TranslateTransition transition = new TranslateTransition(Duration.millis(100), thumb);
    double thumbAreaWidth = snapSize(thumbArea.prefWidth(-1));
    double thumbWidth = snapSize(thumb.prefWidth(-1));

    if (!getSkinnable().isSelected())
        transition.setByX(-(thumbAreaWidth - thumbWidth));
    else {
        transition.setByX(thumbAreaWidth - thumbWidth);
    }
    transition.setCycleCount(1);
    transition.play();
}
 
開發者ID:thane98,項目名稱:FEFEditor,代碼行數:14,代碼來源:ToggleSwitchSkin.java

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

示例6: createAndConfigureAnimation

import javafx.animation.TranslateTransition; //導入方法依賴的package包/類
private TranslateTransition createAndConfigureAnimation(
		final TableView<Person> sourceTable,
		final TableView<Person> destinationTable,
		final Pane commonTableAncestor, final TableRow<Person> row,
		final ImageView imageView, final Point2D animationStartPoint,
		Point2D animationEndPoint) {
	final TranslateTransition transition = new TranslateTransition(ANIMATION_DURATION, imageView);
	// At end of animation, actually move data, and remove animated image
	transition.setOnFinished(createAnimationFinishedHandler(sourceTable, destinationTable, commonTableAncestor, row.getItem(), imageView));
	// configure transition
	transition.setByX(animationEndPoint.getX() - animationStartPoint.getX()); // absolute translation, computed from coords relative to Scene
	transition.setByY(animationEndPoint.getY() - animationStartPoint.getY()); // absolute translation, computed from coords relative to Scene
	return transition;
}
 
開發者ID:mars-sim,項目名稱:mars-sim,代碼行數:15,代碼來源:AnimatedTableRow.java

示例7: setPagePosition

import javafx.animation.TranslateTransition; //導入方法依賴的package包/類
public void setPagePosition(int position) {
    if (animationFinished && (position - currentPosition) != 0) {
        animationFinished = false;
        TranslateTransition transition = new TranslateTransition();
        transition.setByX(((TabTitle) (hBox.getChildren().get(0))).getWidth() * (position - currentPosition));
        transition.setDuration(Duration.millis(150 * Math.abs(position - currentPosition)));
        transition.setInterpolator(Interpolator.LINEAR);
        transition.setNode(line);
        transition.setOnFinished(e -> {
            currentPosition = position;
            animationFinished = true;
        });
        transition.play();
    }
}
 
開發者ID:Tareq-SiSalem,項目名稱:JFXMaterial,代碼行數:16,代碼來源:ActionBar.java

示例8: btnMenuClose_Clicked

import javafx.animation.TranslateTransition; //導入方法依賴的package包/類
@FXML
public void btnMenuClose_Clicked(MouseEvent event) {
    // Slide the menu back off screen
    TranslateTransition transition = new TranslateTransition(Duration.millis(500), pnlMenu);
    transition.setByX(-205);
    transition.play();
}
 
開發者ID:JamesFitzpatrick-Coursework,項目名稱:Client-UI,代碼行數:8,代碼來源:MenuController.java

示例9: updatePosition

import javafx.animation.TranslateTransition; //導入方法依賴的package包/類
@Override
public void updatePosition(Point2D moveBy) {
	double translateX = holder.getNode().getTranslateX();
	double translateY = holder.getNode().getTranslateY();
	Point2D playerPosition = new Point2D(translateX, translateY);

	this.position = playerPosition;
	TranslateTransition smoothMove = new TranslateTransition(
			Duration.millis(2000), this.getNode());
	smoothMove.setFromX(translateX);
	smoothMove.setFromY(translateY);
	// FIXME: Change 1000 to screenWidth()
	int leftRightDirection = 0;
	int upDownDirection = 0;
	
	switch (shootingDirection) {
	case ("west"):
		leftRightDirection = -1000;
		break;
	case ("east"):
		leftRightDirection = 1000;
		break;
	case ("north"):
		upDownDirection = -1000;
		break;
	case ("south"):
		upDownDirection = 1000;
		break;
	default:
		//some other directions?
		break;
	}
	
	smoothMove.setByX(this.getPosition().getX() + leftRightDirection);
	smoothMove.setByY(this.getPosition().getY() + upDownDirection);
	smoothMove.setAutoReverse(true);
	smoothMove.setCycleCount(1);
	smoothMove.play();
}
 
開發者ID:kpetkova,項目名稱:teamearth,代碼行數:40,代碼來源:Bullet.java

示例10: updatePosition

import javafx.animation.TranslateTransition; //導入方法依賴的package包/類
@Override
public void updatePosition(Point2D position) {
	TranslateTransition smoothMove = new TranslateTransition(
			Duration.millis(200), this.getNode());
	smoothMove.setByX(position.getX());
	smoothMove.setByY(position.getY());
	smoothMove.setAutoReverse(true);
	smoothMove.play();
}
 
開發者ID:kpetkova,項目名稱:teamearth,代碼行數:10,代碼來源:Player.java

示例11: updatePosition

import javafx.animation.TranslateTransition; //導入方法依賴的package包/類
@Override
public void updatePosition(Point2D position) {
	TranslateTransition smoothMove = new TranslateTransition(
			Duration.millis(300), this.getNode());
	smoothMove.setByX(this.getPosition().getX() + position.getX());
	smoothMove.setByY(this.getPosition().getY() + position.getY());
	smoothMove.setAutoReverse(true);
	smoothMove.play();
}
 
開發者ID:kpetkova,項目名稱:teamearth,代碼行數:10,代碼來源:Enemy.java

示例12: btnMenu_Click

import javafx.animation.TranslateTransition; //導入方法依賴的package包/類
@FXML
public void btnMenu_Click(MouseEvent event) {
    TranslateTransition transition = new TranslateTransition(Duration.millis(500), pnlMenu);
    transition.setByX(205);
    transition.play();
}
 
開發者ID:JamesFitzpatrick-Coursework,項目名稱:Client-UI,代碼行數:7,代碼來源:Controller.java


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