本文整理汇总了Java中javafx.animation.Interpolator.SPLINE属性的典型用法代码示例。如果您正苦于以下问题:Java Interpolator.SPLINE属性的具体用法?Java Interpolator.SPLINE怎么用?Java Interpolator.SPLINE使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类javafx.animation.Interpolator
的用法示例。
在下文中一共展示了Interpolator.SPLINE属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initializeShakeAnimation
private void initializeShakeAnimation() {
final Interpolator interpolator = Interpolator.SPLINE(0.645, 0.045, 0.355, 1);
final double startX = controller.root.getTranslateX();
final KeyValue kv1 = new KeyValue(controller.root.translateXProperty(), startX - 3, interpolator);
final KeyValue kv2 = new KeyValue(controller.root.translateXProperty(), startX + 3, interpolator);
final KeyValue kv3 = new KeyValue(controller.root.translateXProperty(), startX, interpolator);
final KeyFrame kf1 = new KeyFrame(millis(50), kv1);
final KeyFrame kf2 = new KeyFrame(millis(100), kv2);
final KeyFrame kf3 = new KeyFrame(millis(150), kv1);
final KeyFrame kf4 = new KeyFrame(millis(200), kv2);
final KeyFrame kf5 = new KeyFrame(millis(250), kv3);
shakeAnimation.getKeyFrames().addAll(kf1, kf2, kf3, kf4, kf5);
}
示例2: flipForward
private void flipForward() {
timeline.stop();
flap.setCache(true);
flap.setCacheHint(CacheHint.ROTATE);
//flap.setCacheHint(CacheHint.SPEED);
currentSelectionIndex++;
if (currentSelectionIndex >= characters.size()) {
currentSelectionIndex = 0;
}
nextSelectionIndex = currentSelectionIndex + 1;
if (nextSelectionIndex >= characters.size()) {
nextSelectionIndex = 0;
}
KeyValue keyValueFlap = new KeyValue(rotateFlap.angleProperty(), 180, Interpolator.SPLINE(0.5, 0.4, 0.4, 1.0));
//KeyValue keyValueFlap = new KeyValue(rotateFlap.angleProperty(), 180, Interpolator.EASE_IN);
KeyFrame keyFrame = new KeyFrame(Duration.millis(tile.getFlipTimeInMS()), keyValueFlap);
timeline.getKeyFrames().setAll(keyFrame);
timeline.play();
}
示例3: setBar
private void setBar() {
double range = (getSkinnable().getMaxValue() - getSkinnable().getMinValue());
double angleRange = getSkinnable().getAngleRange();
angleStep = angleRange / range;
double targetAngle = getSkinnable().getValue() * angleStep;
if (getSkinnable().isAnimated()) {
timeline.stop();
final KeyValue KEY_VALUE = new KeyValue(angle, targetAngle, Interpolator.SPLINE(0.5, 0.4, 0.4, 1.0));
final KeyFrame KEY_FRAME = new KeyFrame(Duration.millis(getSkinnable().getAnimationDuration()), KEY_VALUE);
timeline.getKeyFrames().setAll(KEY_FRAME);
timeline.play();
} else {
angle.set(targetAngle);
}
}
示例4: rotateNeedle
private void rotateNeedle() {
double range = (getSkinnable().getMaxValue() - getSkinnable().getMinValue());
double angleRange = getSkinnable().getAngleRange();
angleStep = angleRange / range;
double targetAngle = needleRotate.getAngle() + (getSkinnable().getValue() - getSkinnable().getOldValue()) * angleStep;
if (getSkinnable().isAnimated()) {
timeline.stop();
//double animationDuration = (getSkinnable().getAnimationDuration() / (getSkinnable().getMaxValue() - getSkinnable().getMinValue())) * Math.abs(getSkinnable().getValue() - getSkinnable().getOldValue());
final KeyValue KEY_VALUE = new KeyValue(needleRotate.angleProperty(), targetAngle, Interpolator.SPLINE(0.5, 0.4, 0.4, 1.0));
final KeyFrame KEY_FRAME = new KeyFrame(Duration.millis(getSkinnable().getAnimationDuration()), KEY_VALUE);
timeline.getKeyFrames().setAll(KEY_FRAME);
timeline.play();
} else {
needleRotate.setAngle(targetAngle);
}
}
示例5: animateDisplay
@Override
protected void animateDisplay() {
if (GlobalSettings.getUseAnimations()) {
double startY = -160;
double duration = getDuration(400);
Interpolator interpolator = Interpolator.SPLINE(0.25, 0.1, 0.25, 1);
Timeline timeline = new Timeline();
ObservableList<KeyFrame> keyFrames = timeline.getKeyFrames();
keyFrames.add(new KeyFrame(Duration.millis(0),
new KeyValue(gridPane.opacityProperty(), 0, interpolator),
new KeyValue(gridPane.translateYProperty(), startY, interpolator)
));
keyFrames.add(new KeyFrame(Duration.millis(duration),
new KeyValue(gridPane.opacityProperty(), 1, interpolator),
new KeyValue(gridPane.translateYProperty(), 0, interpolator)
));
timeline.play();
}
}
示例6: toggleDeclaration
public void toggleDeclaration(final MouseEvent mouseEvent) {
final Circle circle = new Circle(0);
circle.setCenterX(component.get().getWidth() - (toggleDeclarationButton.getWidth() - mouseEvent.getX()));
circle.setCenterY(-1 * mouseEvent.getY());
final ObjectProperty<Node> clip = new SimpleObjectProperty<>(circle);
declaration.clipProperty().bind(clip);
final Transition rippleEffect = new Transition() {
private final double maxRadius = Math.sqrt(Math.pow(getComponent().getWidth(), 2) + Math.pow(getComponent().getHeight(), 2));
{
setCycleDuration(Duration.millis(500));
}
protected void interpolate(final double fraction) {
if (getComponent().isDeclarationOpen()) {
circle.setRadius(fraction * maxRadius);
} else {
circle.setRadius(maxRadius - fraction * maxRadius);
}
clip.set(circle);
}
};
final Interpolator interpolator = Interpolator.SPLINE(0.785, 0.135, 0.15, 0.86);
rippleEffect.setInterpolator(interpolator);
rippleEffect.play();
getComponent().declarationOpenProperty().set(!getComponent().isDeclarationOpen());
}
示例7: rotateNeedle
private void rotateNeedle() {
angleStep = getSkinnable().getAngleRange() / (getSkinnable().getMaxValue() - getSkinnable().getMinValue());
double targetAngle = needleRotate.getAngle() + (getSkinnable().getValue() - getSkinnable().getOldValue()) * angleStep;
targetAngle = clamp(180 - getSkinnable().getStartAngle(), 180 - getSkinnable().getStartAngle() + getSkinnable().getAngleRange(), targetAngle);
if (getSkinnable().isAnimated()) {
timeline.stop();
final KeyValue KEY_VALUE = new KeyValue(needleRotate.angleProperty(), targetAngle, Interpolator.SPLINE(0.5, 0.4, 0.4, 1.0));
final KeyFrame KEY_FRAME = new KeyFrame(Duration.millis(getSkinnable().getAnimationDuration()), KEY_VALUE);
timeline.getKeyFrames().setAll(KEY_FRAME);
timeline.play();
} else {
needleRotate.setAngle(targetAngle);
}
}
示例8: moveMinutePointer
private void moveMinutePointer(double newAngle) {
final KeyValue kv = new KeyValue(currentMinuteAngle, newAngle, Interpolator.SPLINE(0.5, 0.4, 0.4, 1.0));
final KeyFrame kf = new KeyFrame(Duration.millis(200), kv);
timeline = new Timeline();
timeline.getKeyFrames().add(kf);
timeline.play();
}
示例9: animateHide
@Override
protected void animateHide(Runnable onFinishedHandler) {
if (autoCloseTimer != null) {
autoCloseTimer.stop();
autoCloseTimer = null;
}
if (NotificationCenter.useAnimations) {
double duration = getDuration(400);
Interpolator interpolator = Interpolator.SPLINE(0.25, 0.1, 0.25, 1);
gridPane.setRotationAxis(Rotate.X_AXIS);
Camera camera = gridPane.getScene().getCamera();
gridPane.getScene().setCamera(new PerspectiveCamera());
Timeline timeline = new Timeline();
ObservableList<KeyFrame> keyFrames = timeline.getKeyFrames();
keyFrames.add(new KeyFrame(Duration.millis(0),
new KeyValue(gridPane.rotateProperty(), 0, interpolator),
new KeyValue(gridPane.opacityProperty(), 1, interpolator)
));
keyFrames.add(new KeyFrame(Duration.millis(duration),
new KeyValue(gridPane.rotateProperty(), -90, interpolator),
new KeyValue(gridPane.opacityProperty(), 0, interpolator)
));
timeline.setOnFinished(event -> {
gridPane.setRotate(0);
gridPane.setRotationAxis(Rotate.Z_AXIS);
gridPane.getScene().setCamera(camera);
onFinishedHandler.run();
});
timeline.play();
} else {
onFinishedHandler.run();
}
}
示例10: animateDisplay
@Override
protected void animateDisplay() {
if (NotificationCenter.useAnimations) {
double startX = 320;
double duration = getDuration(600);
Interpolator interpolator = Interpolator.SPLINE(0.25, 0.1, 0.25, 1);
Timeline timeline = new Timeline();
ObservableList<KeyFrame> keyFrames = timeline.getKeyFrames();
keyFrames.add(new KeyFrame(Duration.millis(0),
new KeyValue(gridPane.opacityProperty(), 0, interpolator),
new KeyValue(gridPane.translateXProperty(), startX, interpolator)
));
//bouncing
/* keyFrames.add(new KeyFrame(Duration.millis(duration * 0.6),
new KeyValue(gridPane.opacityProperty(), 1, interpolator),
new KeyValue(gridPane.translateXProperty(), -12, interpolator)
));
keyFrames.add(new KeyFrame(Duration.millis(duration * 0.8),
new KeyValue(gridPane.opacityProperty(), 1, interpolator),
new KeyValue(gridPane.translateXProperty(), 4, interpolator)
));*/
keyFrames.add(new KeyFrame(Duration.millis(duration),
new KeyValue(gridPane.opacityProperty(), 1, interpolator),
new KeyValue(gridPane.translateXProperty(), 0, interpolator)
));
timeline.play();
}
}
示例11: animateHide
@Override
protected void animateHide(Runnable onFinishedHandler) {
if (GlobalSettings.getUseAnimations()) {
double duration = getDuration(300);
Interpolator interpolator = Interpolator.SPLINE(0.25, 0.1, 0.25, 1);
gridPane.setRotationAxis(Rotate.X_AXIS);
Camera camera = gridPane.getScene().getCamera();
gridPane.getScene().setCamera(new PerspectiveCamera());
Timeline timeline = new Timeline();
ObservableList<KeyFrame> keyFrames = timeline.getKeyFrames();
keyFrames.add(new KeyFrame(Duration.millis(0),
new KeyValue(gridPane.rotateProperty(), 0, interpolator),
new KeyValue(gridPane.opacityProperty(), 1, interpolator)
));
keyFrames.add(new KeyFrame(Duration.millis(duration),
new KeyValue(gridPane.rotateProperty(), -90, interpolator),
new KeyValue(gridPane.opacityProperty(), 0, interpolator)
));
timeline.setOnFinished(event -> {
gridPane.setRotate(0);
gridPane.setRotationAxis(Rotate.Z_AXIS);
gridPane.getScene().setCamera(camera);
onFinishedHandler.run();
});
timeline.play();
} else {
onFinishedHandler.run();
}
}
示例12: playIndicatorAnimations
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();
}
示例13: toFxInterpolator
@Override
public Interpolator toFxInterpolator() {
return Interpolator.SPLINE(x1.getValue(), y1.getValue(), x2.getValue(), y2.getValue());
}
示例14: configure
private void configure() {
fxInterpolator = Interpolator.SPLINE(x1.getValue(), y1.getValue(), x2.getValue(), y2.getValue());
}
示例15: createTimelineAnimation
/**
* Метод для анимации движения объекта
*
* @param target Параметр который двигаем
* @param endValue Параметр который задает конечную точку движения
* @param duration Время движения в миллисекундах
* @return Возвращает Timeline
*/
protected Timeline createTimelineAnimation(DoubleProperty target, double endValue, double duration) {
KeyValue endKeyValue = new KeyValue(target, endValue, Interpolator.SPLINE(0.4, 0, 0.2, 1));
KeyFrame endKeyFrame = new KeyFrame(Duration.millis(duration), endKeyValue);
return new Timeline(endKeyFrame);
}