本文整理匯總了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();
}