本文整理汇总了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();
}
示例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;
}
示例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);
}
}
示例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();
}
示例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);
}
示例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;
}
示例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();
}
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}