use of javafx.animation.Timeline in project JFoenix by jfoenixadmin.
the class JFXCustomColorPicker method preAnimate.
public void preAnimate() {
double x = curves.get(0).getStartX();
double y = curves.get(0).getStartY();
curves.get(0).setStartX(centerX);
curves.get(0).setStartY(centerY);
double x1 = curves.get(1).getStartX();
double y1 = curves.get(1).getStartY();
curves.get(1).setStartX(centerX);
curves.get(1).setStartY(centerY);
double cx1 = curves.get(0).getControlX1();
double cy1 = curves.get(0).getControlY1();
curves.get(0).setControlX1(centerX + radius);
curves.get(0).setControlY1(centerY + radius / 2);
showAnimation = new CachedTransition(this, new Timeline(new KeyFrame(Duration.millis(1000), new KeyValue(curves.get(0).startXProperty(), x, Interpolator.EASE_BOTH), new KeyValue(curves.get(0).startYProperty(), y, Interpolator.EASE_BOTH), new KeyValue(curves.get(1).startXProperty(), x1, Interpolator.EASE_BOTH), new KeyValue(curves.get(1).startYProperty(), y1, Interpolator.EASE_BOTH), new KeyValue(curves.get(0).controlX1Property(), cx1, Interpolator.EASE_BOTH), new KeyValue(curves.get(0).controlY1Property(), cy1, Interpolator.EASE_BOTH)))) {
{
setCycleDuration(Duration.millis(240));
setDelay(Duration.millis(0));
}
};
}
use of javafx.animation.Timeline in project JFoenix by jfoenixadmin.
the class JFXColorPickerSkin method updateColor.
private void updateColor() {
final ColorPicker colorPicker = (ColorPicker) getSkinnable();
// update picker box color
Circle ColorCircle = new Circle();
ColorCircle.setFill(colorPicker.getValue());
ColorCircle.setLayoutX(pickerColorBox.getWidth() / 4);
ColorCircle.setLayoutY(pickerColorBox.getHeight() / 2);
pickerColorBox.getChildren().add(ColorCircle);
Timeline animateColor = new Timeline(new KeyFrame(Duration.millis(240), new KeyValue(ColorCircle.radiusProperty(), 200, Interpolator.EASE_BOTH)));
animateColor.setOnFinished((finish) -> {
pickerColorBox.setBackground(new Background(new BackgroundFill(ColorCircle.getFill(), pickerColorBox.getBackground().getFills().get(0).getRadii(), pickerColorBox.getBackground().getFills().get(0).getInsets())));
pickerColorBox.getChildren().remove(ColorCircle);
});
animateColor.play();
// update label color
displayNode.setTextFill(colorPicker.getValue().grayscale().getRed() < 0.5 ? Color.valueOf("rgba(255, 255, 255, 0.87)") : Color.valueOf("rgba(0, 0, 0, 0.87)"));
if (colorLabelVisible.get())
displayNode.setText(colorDisplayName(colorPicker.getValue()));
else
displayNode.setText("");
}
use of javafx.animation.Timeline in project JFoenix by jfoenixadmin.
the class JFXSpinner method layoutChildren.
/**
* {@inheritDoc}
*/
@Override
protected void layoutChildren() {
if (!initialized) {
super.layoutChildren();
initialColor = (Color) arc.getStroke();
if (initialColor == null) {
arc.setStroke(blueColor);
}
KeyFrame[] blueFrame = getKeyFrames(0, 0, initialColor == null ? blueColor : initialColor);
KeyFrame[] redFrame = getKeyFrames(450, 1.4, initialColor == null ? redColor : initialColor);
KeyFrame[] yellowFrame = getKeyFrames(900, 2.8, initialColor == null ? yellowColor : initialColor);
KeyFrame[] greenFrame = getKeyFrames(1350, 4.2, initialColor == null ? greenColor : initialColor);
KeyFrame endingFrame = new KeyFrame(Duration.seconds(5.6), new KeyValue(arc.lengthProperty(), 5, Interpolator.LINEAR), new KeyValue(arc.startAngleProperty(), 1845 + getStartingAngle(), Interpolator.LINEAR));
if (timeline != null)
timeline.stop();
timeline = new Timeline(blueFrame[0], blueFrame[1], blueFrame[2], blueFrame[3], redFrame[0], redFrame[1], redFrame[2], redFrame[3], yellowFrame[0], yellowFrame[1], yellowFrame[2], yellowFrame[3], greenFrame[0], greenFrame[1], greenFrame[2], greenFrame[3], endingFrame);
timeline.setCycleCount(Timeline.INDEFINITE);
timeline.setRate(1);
timeline.play();
initialized = true;
}
}
use of javafx.animation.Timeline in project JFoenix by jfoenixadmin.
the class AnimatedFlowContainer method setViewContext.
@Override
public <U> void setViewContext(ViewContext<U> context) {
updatePlaceholder(context.getRootNode());
if (animation != null) {
animation.stop();
}
animation = new Timeline();
animation.getKeyFrames().addAll(animationProducer.apply(this));
animation.getKeyFrames().add(new KeyFrame(duration, (e) -> clearPlaceholder()));
animation.play();
}
use of javafx.animation.Timeline in project fxexperience2 by EricCanull.
the class BounceInDownTransition method starting.
@Override
protected void starting() {
double startY = -node.localToScene(0, 0).getY() - node.getBoundsInParent().getHeight();
timeline = new Timeline();
timeline.getKeyFrames().add(new KeyFrame(Duration.millis(0), new KeyValue(node.opacityProperty(), 0, WEB_EASE), new KeyValue(node.translateYProperty(), startY, WEB_EASE)));
timeline.getKeyFrames().add(new KeyFrame(Duration.millis(600), new KeyValue(node.opacityProperty(), 1, WEB_EASE), new KeyValue(node.translateYProperty(), 30, WEB_EASE)));
timeline.getKeyFrames().add(new KeyFrame(Duration.millis(800), new KeyValue(node.translateYProperty(), -10, WEB_EASE)));
timeline.getKeyFrames().add(new KeyFrame(Duration.millis(1000), new KeyValue(node.translateYProperty(), 0, WEB_EASE)));
super.starting();
}
Aggregations