当前位置: 首页>>代码示例>>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;未经允许,请勿转载。