本文整理汇总了Java中javafx.animation.TranslateTransition.setByY方法的典型用法代码示例。如果您正苦于以下问题:Java TranslateTransition.setByY方法的具体用法?Java TranslateTransition.setByY怎么用?Java TranslateTransition.setByY使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.animation.TranslateTransition
的用法示例。
在下文中一共展示了TranslateTransition.setByY方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: animate
import javafx.animation.TranslateTransition; //导入方法依赖的package包/类
private void animate() {
TranslateTransition tt = new TranslateTransition(Duration.millis(duration), load_image_button);
TranslateTransition tLogo = new TranslateTransition(Duration.millis(duration), christopher);
TranslateTransition tDesc = new TranslateTransition(Duration.millis(duration), description);
ScaleTransition st = new ScaleTransition(Duration.millis(duration), load_image_button);
st.setToX(3);
st.setToY(3);
tt.setByY(-180f);
tLogo.setToY(50);
tDesc.setToY(500);
buttonParallelTransition = new ParallelTransition(load_image_button, st, tt, tLogo, tDesc);
buttonParallelTransition.play();
buttonParallelTransition.setOnFinished((e) -> {
load_image_button.setOpacity(1);
});
}
示例2: 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();
}
示例3: animate
import javafx.animation.TranslateTransition; //导入方法依赖的package包/类
protected void animate(final ModView modView, final int amount) {
TranslateTransition tt = new TranslateTransition(Duration.millis(80), modView.getContent());
tt.setByY(amount);
tt.setCycleCount(1);
tt.setAutoReverse(false);
tt.setOnFinished(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent e) {
modView.moving = false;
}
});
tt.play();
}
示例4: animateSelection
import javafx.animation.TranslateTransition; //导入方法依赖的package包/类
/** Animates the surrounding frame to move between two difficulty selections */
private void animateSelection(Node target, Node frame, Stage stage ){
TranslateTransition animation = new TranslateTransition( Duration.millis(400), frame );
animation.setInterpolator( Interpolator.EASE_IN );
//centers the difficulties with and without 'y' in them within the frame properly
if( target.localToScene( target.getBoundsInLocal(), false ).getMaxY() < stage.getHeight() * 0.4 ){
animation.setByY( target.localToScene( target.getBoundsInLocal(), false ).getMaxY() -
frame.localToScene( frame.getBoundsInLocal(), false ).getMaxY() + stage.getHeight() / 100 );
}else{
animation.setByY( target.localToScene( target.getBoundsInLocal(), false ).getMaxY() -
frame.localToScene( frame.getBoundsInLocal(), false ).getMaxY() + stage.getHeight() / 150 );
}
animation.play();
}
示例5: 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;
}
示例6: 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();
}
示例7: 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();
}
示例8: 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();
}
示例9: restoreFromSeedAnimation
import javafx.animation.TranslateTransition; //导入方法依赖的package包/类
public void restoreFromSeedAnimation() {
// Buttons slide out ...
TranslateTransition leave = new TranslateTransition(Duration.millis(1200), controlsBox);
leave.setByY(80.0);
leave.play();
}
示例10: restoreFromSeedAnimation
import javafx.animation.TranslateTransition; //导入方法依赖的package包/类
public void restoreFromSeedAnimation () {
// Buttons slide out ...
TranslateTransition leave = new TranslateTransition(Duration.millis(1200), controlsBox);
leave.setByY(80.0);
leave.play();
}