本文整理汇总了Java中javafx.scene.Group.getTranslateY方法的典型用法代码示例。如果您正苦于以下问题:Java Group.getTranslateY方法的具体用法?Java Group.getTranslateY怎么用?Java Group.getTranslateY使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javafx.scene.Group
的用法示例。
在下文中一共展示了Group.getTranslateY方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: playIndicatorAnimations
import javafx.scene.Group; //导入方法依赖的package包/类
private void playIndicatorAnimations(final Location.Type type, final Group container) {
final Timeline moveAnimation = new Timeline();
final Timeline disappearAnimation = new Timeline();
final double startX = container.getTranslateX();
final double startY = container.getTranslateY();
final Interpolator interpolator = Interpolator.SPLINE(0.645, 0.045, 0.355, 1);
double otherX = 0, otherY = 0;
if(type.equals(Location.Type.INITIAL))
{
otherX = startX + 2 * GRID_SIZE;
otherY = startY + 2 * GRID_SIZE;
} else {
otherX = startX - 2 * GRID_SIZE;
otherY = startY - 2 * GRID_SIZE;
}
final KeyValue kvx1 = new KeyValue(container.translateXProperty(), otherX, interpolator);
final KeyValue kvx2 = new KeyValue(container.translateXProperty(), startX, interpolator);
final KeyValue kvy1 = new KeyValue(container.translateYProperty(), otherY, interpolator);
final KeyValue kvy2 = new KeyValue(container.translateYProperty(), startY, interpolator);
final List<KeyFrame> frames = new ArrayList<>();
frames.add(new KeyFrame(millis(400), kvx2, kvy2));
for(int i = 1; i < 6; i ++) {
if(i % 2 == 1) {
frames.add(new KeyFrame(millis(400 * (i + 1)), kvx2, kvy2));
} else {
frames.add(new KeyFrame(millis(400 * (i + 1)), kvx1, kvy1));
}
}
moveAnimation.getKeyFrames().addAll(frames);
final KeyValue kvPresent = new KeyValue(container.opacityProperty(), 1, interpolator);
final KeyValue kvGone = new KeyValue(container.opacityProperty(), 0, interpolator);
final KeyFrame kf1 = new KeyFrame(millis(5000), kvPresent);
final KeyFrame kf2 = new KeyFrame(millis(5500), kvGone);
disappearAnimation.getKeyFrames().addAll(kf1, kf2);
moveAnimation.play();
disappearAnimation.play();
}