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