javafx.animation.KeyValue Java Examples
The following examples show how to use
javafx.animation.KeyValue.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ZoomOutLeft.java From AnimateFX with Apache License 2.0 | 7 votes |
@Override void initTimeline() { setTimeline(new Timeline( new KeyFrame(Duration.millis(0), new KeyValue(getNode().translateXProperty(), 0, AnimateFXInterpolator.EASE), new KeyValue(getNode().opacityProperty(), 1, AnimateFXInterpolator.EASE), new KeyValue(getNode().scaleXProperty(), 1, AnimateFXInterpolator.EASE), new KeyValue(getNode().scaleYProperty(), 1, AnimateFXInterpolator.EASE), new KeyValue(getNode().scaleZProperty(), 1, AnimateFXInterpolator.EASE) ), new KeyFrame(Duration.millis(400), new KeyValue(getNode().opacityProperty(), 1, AnimateFXInterpolator.EASE), new KeyValue(getNode().translateXProperty(), 42, AnimateFXInterpolator.EASE), new KeyValue(getNode().scaleXProperty(), 0.475, AnimateFXInterpolator.EASE), new KeyValue(getNode().scaleYProperty(), 0.475, AnimateFXInterpolator.EASE), new KeyValue(getNode().scaleZProperty(), 0.475, AnimateFXInterpolator.EASE) ), new KeyFrame(Duration.millis(1100), new KeyValue(getNode().translateXProperty(), -2000, AnimateFXInterpolator.EASE), new KeyValue(getNode().opacityProperty(), 0, AnimateFXInterpolator.EASE), new KeyValue(getNode().scaleXProperty(), 0.1, AnimateFXInterpolator.EASE), new KeyValue(getNode().scaleYProperty(), 0.1, AnimateFXInterpolator.EASE), new KeyValue(getNode().scaleZProperty(), 0.1, AnimateFXInterpolator.EASE) ) )); }
Example #2
Source File: ZoomOutUp.java From AnimateFX with Apache License 2.0 | 7 votes |
@Override void initTimeline() { setTimeline(new Timeline( new KeyFrame(Duration.millis(0), new KeyValue(getNode().opacityProperty(), 1, AnimateFXInterpolator.EASE), new KeyValue(getNode().translateYProperty(), 0, AnimateFXInterpolator.EASE), new KeyValue(getNode().scaleXProperty(), 1, AnimateFXInterpolator.EASE), new KeyValue(getNode().scaleYProperty(), 1, AnimateFXInterpolator.EASE), new KeyValue(getNode().scaleZProperty(), 1, AnimateFXInterpolator.EASE) ), new KeyFrame(Duration.millis(400), new KeyValue(getNode().opacityProperty(), 1, AnimateFXInterpolator.EASE), new KeyValue(getNode().translateYProperty(), 60, AnimateFXInterpolator.EASE), new KeyValue(getNode().scaleXProperty(), 0.475, AnimateFXInterpolator.EASE), new KeyValue(getNode().scaleYProperty(), 0.475, AnimateFXInterpolator.EASE), new KeyValue(getNode().scaleZProperty(), 0.475, AnimateFXInterpolator.EASE) ), new KeyFrame(Duration.millis(1000), new KeyValue(getNode().translateYProperty(), -600, AnimateFXInterpolator.EASE), new KeyValue(getNode().opacityProperty(), 0, AnimateFXInterpolator.EASE), new KeyValue(getNode().scaleXProperty(), 0.1, AnimateFXInterpolator.EASE), new KeyValue(getNode().scaleYProperty(), 0.1, AnimateFXInterpolator.EASE), new KeyValue(getNode().scaleZProperty(), 0.1, AnimateFXInterpolator.EASE) ) )); }
Example #3
Source File: RotateInDownRight.java From AnimateFX with Apache License 2.0 | 7 votes |
@Override void initTimeline() { getNode().setRotationAxis(Rotate.Z_AXIS); Rotate rotate = new Rotate(0, getNode().getBoundsInLocal().getWidth(), getNode().getBoundsInLocal().getHeight()); getNode().getTransforms().add(rotate); setTimeline(new Timeline( new KeyFrame(Duration.millis(0), new KeyValue(rotate.angleProperty(), 45, AnimateFXInterpolator.EASE), new KeyValue(getNode().opacityProperty(), 0, AnimateFXInterpolator.EASE) ), new KeyFrame(Duration.millis(1000), new KeyValue(rotate.angleProperty(), 0, AnimateFXInterpolator.EASE), new KeyValue(getNode().opacityProperty(), 1, AnimateFXInterpolator.EASE) ) )); }
Example #4
Source File: FadeInRightBigTransition.java From oim-fx with MIT License | 7 votes |
@Override protected void starting() { double startX = node.getScene().getWidth() - node.localToScene(0, 0).getX(); timeline = TimelineBuilder.create() .keyFrames( new KeyFrame(Duration.millis(0), new KeyValue(node.opacityProperty(), 0, WEB_EASE), new KeyValue(node.translateXProperty(), startX, WEB_EASE) ), new KeyFrame(Duration.millis(1000), new KeyValue(node.opacityProperty(), 1, WEB_EASE), new KeyValue(node.translateXProperty(), 0, WEB_EASE) ) ) .build(); super.starting(); }
Example #5
Source File: JackInTheBox.java From AnimateFX with Apache License 2.0 | 7 votes |
@Override void initTimeline() { Rotate rotate = new Rotate(30, getNode().getBoundsInParent().getWidth() / 2, getNode().getBoundsInParent().getHeight()); getNode().getTransforms().add(rotate); setTimeline(new Timeline( new KeyFrame(Duration.millis(0), new KeyValue(rotate.angleProperty(), 30, AnimateFXInterpolator.EASE), new KeyValue(getNode().scaleXProperty(), 0.1, AnimateFXInterpolator.EASE), new KeyValue(getNode().scaleYProperty(), 0.1, AnimateFXInterpolator.EASE), new KeyValue(getNode().opacityProperty(), 0, AnimateFXInterpolator.EASE) ), new KeyFrame(Duration.millis(500), new KeyValue(rotate.angleProperty(), -10, AnimateFXInterpolator.EASE) ), new KeyFrame(Duration.millis(700), new KeyValue(rotate.angleProperty(), 3, AnimateFXInterpolator.EASE) ), new KeyFrame(Duration.millis(1000), new KeyValue(getNode().scaleXProperty(), 1, AnimateFXInterpolator.EASE), new KeyValue(getNode().scaleYProperty(), 1, AnimateFXInterpolator.EASE), new KeyValue(rotate.angleProperty(), 0, AnimateFXInterpolator.EASE), new KeyValue(getNode().opacityProperty(), 1, AnimateFXInterpolator.EASE) ) )); }
Example #6
Source File: ZoomOperator.java From PDF4Teachers with Apache License 2.0 | 7 votes |
public void scrollRight(int factor, boolean removeTransition){ if(!isPlaying){ aimTranslateY = pane.getTranslateY(); aimTranslateX = pane.getTranslateX(); aimScale = pane.getScaleX(); } double newTranslateX = aimTranslateX - factor; if(newTranslateX - getPaneShiftX() < -getScrollableWidth()) newTranslateX = -getScrollableWidth() + getPaneShiftX(); aimTranslateX = newTranslateX; if(Main.settings.isZoomAnimations() && factor > 25 && !removeTransition){ timeline.getKeyFrames().clear(); timeline.getKeyFrames().addAll( new KeyFrame(Duration.millis(200), new KeyValue(pane.translateXProperty(), newTranslateX)) ); timeline.stop(); isPlaying = true; timeline.play(); }else{ pane.setTranslateX(newTranslateX); } }
Example #7
Source File: ZoomInRight.java From AnimateFX with Apache License 2.0 | 7 votes |
@Override void initTimeline() { setTimeline(new Timeline( new KeyFrame(Duration.millis(0), new KeyValue(getNode().translateXProperty(), 1000, Interpolator.SPLINE(0.55, 0.055, 0.675, 0.19)), new KeyValue(getNode().opacityProperty(), 0, Interpolator.SPLINE(0.55, 0.055, 0.675, 0.19)), new KeyValue(getNode().scaleXProperty(), 0.1, Interpolator.SPLINE(0.55, 0.055, 0.675, 0.19)), new KeyValue(getNode().scaleYProperty(), 0.1, Interpolator.SPLINE(0.55, 0.055, 0.675, 0.19)), new KeyValue(getNode().scaleZProperty(), 0.1, Interpolator.SPLINE(0.55, 0.055, 0.675, 0.19)) ), new KeyFrame(Duration.millis(400), new KeyValue(getNode().opacityProperty(), 1, Interpolator.SPLINE(0.175, 0.885, 0.32, 1)), new KeyValue(getNode().translateXProperty(), -10, Interpolator.SPLINE(0.175, 0.885, 0.32, 1)), new KeyValue(getNode().scaleXProperty(), 0.475, Interpolator.SPLINE(0.175, 0.885, 0.32, 1)), new KeyValue(getNode().scaleYProperty(), 0.475, Interpolator.SPLINE(0.175, 0.885, 0.32, 1)), new KeyValue(getNode().scaleZProperty(), 0.475, Interpolator.SPLINE(0.175, 0.885, 0.32, 1)) ), new KeyFrame(Duration.millis(1100), new KeyValue(getNode().translateXProperty(), 0, Interpolator.SPLINE(0.175, 0.885, 0.32, 1)), new KeyValue(getNode().opacityProperty(), 1, Interpolator.SPLINE(0.175, 0.885, 0.32, 1)), new KeyValue(getNode().scaleXProperty(), 1, Interpolator.SPLINE(0.175, 0.885, 0.32, 1)), new KeyValue(getNode().scaleYProperty(), 1, Interpolator.SPLINE(0.175, 0.885, 0.32, 1)), new KeyValue(getNode().scaleZProperty(), 1, Interpolator.SPLINE(0.175, 0.885, 0.32, 1)) ) )); }
Example #8
Source File: FadeInUp.java From AnimateFX with Apache License 2.0 | 7 votes |
@Override void initTimeline() { setTimeline(new Timeline( new KeyFrame(Duration.millis(0), new KeyValue(getNode().opacityProperty(), 0, AnimateFXInterpolator.EASE), new KeyValue(getNode().translateYProperty(), getNode().getBoundsInParent().getHeight(), AnimateFXInterpolator.EASE) ), new KeyFrame(Duration.millis(1000), new KeyValue(getNode().opacityProperty(), 1, AnimateFXInterpolator.EASE), new KeyValue(getNode().translateYProperty(), 0, AnimateFXInterpolator.EASE) ) )); }
Example #9
Source File: GlobalTransformManager.java From paintera with GNU General Public License v2.0 | 7 votes |
public synchronized void setTransform(final AffineTransform3D affine, final Duration duration) { if (duration.toMillis() == 0.0) { setTransform(affine); return; } final Timeline timeline = new Timeline(60.0); timeline.setCycleCount(1); timeline.setAutoReverse(false); final AffineTransform3D currentState = this.affine.copy(); final DoubleProperty progressProperty = new SimpleDoubleProperty(0.0); final SimilarityTransformInterpolator interpolator = new SimilarityTransformInterpolator(currentState, affine.copy()); progressProperty.addListener((obs, oldv, newv) -> setTransform(interpolator.interpolateAt(newv.doubleValue()))); final KeyValue kv = new KeyValue(progressProperty, 1.0, Interpolator.EASE_BOTH); timeline.getKeyFrames().add(new KeyFrame(duration, kv)); timeline.play(); }
Example #10
Source File: KeyStrokeMotion.java From netbeans with Apache License 2.0 | 7 votes |
private void createLetter(String c) { final Text letter = new Text(c); letter.setFill(Color.BLACK); letter.setFont(FONT_DEFAULT); letter.setTextOrigin(VPos.TOP); letter.setTranslateX((getWidth() - letter.getBoundsInLocal().getWidth()) / 2); letter.setTranslateY((getHeight() - letter.getBoundsInLocal().getHeight()) / 2); getChildren().add(letter); // over 3 seconds move letter to random position and fade it out final Timeline timeline = new Timeline(); timeline.getKeyFrames().add( new KeyFrame(Duration.seconds(3), new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { // we are done remove us from scene getChildren().remove(letter); } }, new KeyValue(letter.translateXProperty(), getRandom(0.0f, getWidth() - letter.getBoundsInLocal().getWidth()),INTERPOLATOR), new KeyValue(letter.translateYProperty(), getRandom(0.0f, getHeight() - letter.getBoundsInLocal().getHeight()),INTERPOLATOR), new KeyValue(letter.opacityProperty(), 0f) )); timeline.play(); }
Example #11
Source File: ZoomIn.java From AnimateFX with Apache License 2.0 | 6 votes |
@Override void initTimeline() { setTimeline(new Timeline( new KeyFrame(Duration.millis(0), new KeyValue(getNode().opacityProperty(), 0, AnimateFXInterpolator.EASE), new KeyValue(getNode().scaleXProperty(), 0.3, AnimateFXInterpolator.EASE), new KeyValue(getNode().scaleYProperty(), 0.3, AnimateFXInterpolator.EASE), new KeyValue(getNode().scaleZProperty(), 0.3, AnimateFXInterpolator.EASE) ), new KeyFrame(Duration.millis(1000), new KeyValue(getNode().opacityProperty(), 1, AnimateFXInterpolator.EASE), new KeyValue(getNode().scaleXProperty(), 1, AnimateFXInterpolator.EASE), new KeyValue(getNode().scaleYProperty(), 1, AnimateFXInterpolator.EASE), new KeyValue(getNode().scaleZProperty(), 1, AnimateFXInterpolator.EASE) ) )); }
Example #12
Source File: Notifications.java From oim-fx with MIT License | 6 votes |
private Timeline createHideTimeline(final Popup popup, NotificationBar bar, final Pos p, Duration startDelay) { KeyValue fadeOutBegin = new KeyValue(bar.opacityProperty(), 1.0); KeyValue fadeOutEnd = new KeyValue(bar.opacityProperty(), 0.0); KeyFrame kfBegin = new KeyFrame(Duration.ZERO, fadeOutBegin); KeyFrame kfEnd = new KeyFrame(Duration.millis(500), fadeOutEnd); Timeline timeline = new Timeline(kfBegin, kfEnd); timeline.setDelay(startDelay); timeline.setOnFinished(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { hide(popup, p); } }); return timeline; }
Example #13
Source File: SpriteView.java From quantumjava with BSD 3-Clause "New" or "Revised" License | 6 votes |
public void moveTo(Main.Location loc) { walking = new Timeline(Animation.INDEFINITE, new KeyFrame(Duration.seconds(.001), new KeyValue(direction, location.getValue().directionTo(loc))), new KeyFrame(Duration.seconds(.002), new KeyValue(location, loc)), new KeyFrame(Duration.seconds(1), new KeyValue(translateXProperty(), loc.getX() * Main.CELL_SIZE)), new KeyFrame(Duration.seconds(1), new KeyValue(translateYProperty(), loc.getY() * Main.CELL_SIZE)), new KeyFrame(Duration.seconds(.25), new KeyValue(frame, 0)), new KeyFrame(Duration.seconds(.5), new KeyValue(frame, 1)), new KeyFrame(Duration.seconds(.75), new KeyValue(frame, 2)), new KeyFrame(Duration.seconds(1), new KeyValue(frame, 1)) ); walking.setOnFinished(e -> { if (arrivalHandler != null) { arrivalHandler.handle(e); } }); Platform.runLater(walking::play); }
Example #14
Source File: BounceOut.java From AnimateFX with Apache License 2.0 | 6 votes |
@Override void initTimeline() { setTimeline(new Timeline( new KeyFrame(Duration.millis(0), new KeyValue(getNode().scaleXProperty(), 1, AnimateFXInterpolator.EASE), new KeyValue(getNode().scaleYProperty(), 1, AnimateFXInterpolator.EASE) ), new KeyFrame(Duration.millis(200), new KeyValue(getNode().scaleXProperty(), 0.9, AnimateFXInterpolator.EASE), new KeyValue(getNode().scaleYProperty(), 0.9, AnimateFXInterpolator.EASE) ), new KeyFrame(Duration.millis(550), new KeyValue(getNode().opacityProperty(), 1, AnimateFXInterpolator.EASE), new KeyValue(getNode().scaleXProperty(), 1.1, AnimateFXInterpolator.EASE), new KeyValue(getNode().scaleYProperty(), 1.1, AnimateFXInterpolator.EASE) ), new KeyFrame(Duration.millis(1000), new KeyValue(getNode().opacityProperty(), 0, AnimateFXInterpolator.EASE), new KeyValue(getNode().scaleXProperty(), 0.3, AnimateFXInterpolator.EASE), new KeyValue(getNode().scaleYProperty(), 0.3, AnimateFXInterpolator.EASE) ) )); }
Example #15
Source File: SidesPaneSkin.java From chart-fx with Apache License 2.0 | 6 votes |
private void show(final Side side) { if (hideTimeline[side.ordinal()] != null) { hideTimeline[side.ordinal()].stop(); } if (showTimeline[side.ordinal()] != null && showTimeline[side.ordinal()].getStatus() == Status.RUNNING) { return; } final KeyValue[] keyValues = new KeyValue[Side.values().length]; keyValues[side.ordinal()] = new KeyValue(visibility[side.ordinal()], 1); final Duration delay = getSkinnable().getAnimationDelay() != null ? getSkinnable().getAnimationDelay() : Duration.millis(300); final Duration duration = getSkinnable().getAnimationDuration() != null ? getSkinnable().getAnimationDuration() : Duration.millis(200); final KeyFrame keyFrame = new KeyFrame(duration, keyValues); showTimeline[side.ordinal()] = new Timeline(keyFrame); showTimeline[side.ordinal()].setDelay(delay); showTimeline[side.ordinal()].play(); }
Example #16
Source File: UiUtil.java From Recaf with MIT License | 6 votes |
private static void animate(Node node, long millis, int r, int g, int b) { DoubleProperty dblProp = new SimpleDoubleProperty(1); dblProp.addListener((ob, o, n) -> { InnerShadow innerShadow = new InnerShadow(); innerShadow.setBlurType(BlurType.ONE_PASS_BOX); innerShadow.setChoke(1); innerShadow.setRadius(5); innerShadow.setColor(Color.rgb(r, g, b, n.doubleValue())); node.setEffect(innerShadow); }); Timeline timeline = new Timeline(); KeyValue kv = new KeyValue(dblProp, 0); KeyFrame kf = new KeyFrame(Duration.millis(millis), kv); timeline.getKeyFrames().add(kf); timeline.play(); }
Example #17
Source File: FlipOutX.java From AnimateFX with Apache License 2.0 | 6 votes |
@Override void initTimeline() { getNode().getScene().setCamera(new PerspectiveCamera()); getNode().setRotationAxis(X_AXIS); setTimeline(new Timeline( new KeyFrame(Duration.millis(0), new KeyValue(getNode().opacityProperty(), 1, AnimateFXInterpolator.EASE) ), new KeyFrame(Duration.millis(225), new KeyValue(getNode().rotateProperty(), 20, AnimateFXInterpolator.EASE) ), new KeyFrame(Duration.millis(750), new KeyValue(getNode().opacityProperty(), 0, AnimateFXInterpolator.EASE), new KeyValue(getNode().rotateProperty(), -90, AnimateFXInterpolator.EASE) ) )); getTimeline().setOnFinished(event -> getNode().getScene().setCamera(new ParallelCamera())); }
Example #18
Source File: AbstractAxis.java From chart-fx with Apache License 2.0 | 6 votes |
protected void setRange(final AxisRange rangeObj, final boolean animate) { final AxisRange range = rangeObj; final double oldLowerBound = getMin(); set(range.getLowerBound(), range.getUpperBound()); if (animate) { animator.stop(); animator.getKeyFrames() .setAll(new KeyFrame(Duration.ZERO, new KeyValue(currentLowerBound, oldLowerBound), new KeyValue(scaleBinding, getScale())), new KeyFrame(Duration.millis(AbstractAxis.RANGE_ANIMATION_DURATION_MS), new KeyValue(currentLowerBound, range.getLowerBound()), new KeyValue(scaleBinding, range.getScale()))); animator.play(); } else { currentLowerBound.set(range.getLowerBound()); setScale(range.getScale()); } }
Example #19
Source File: ZoomOutDown.java From AnimateFX with Apache License 2.0 | 6 votes |
@Override void initTimeline() { setTimeline(new Timeline( new KeyFrame(Duration.millis(0), new KeyValue(getNode().opacityProperty(), 1, AnimateFXInterpolator.EASE), new KeyValue(getNode().translateYProperty(), 0, AnimateFXInterpolator.EASE), new KeyValue(getNode().scaleXProperty(), 1, AnimateFXInterpolator.EASE), new KeyValue(getNode().scaleYProperty(), 1, AnimateFXInterpolator.EASE), new KeyValue(getNode().scaleZProperty(), 1, AnimateFXInterpolator.EASE) ), new KeyFrame(Duration.millis(400), new KeyValue(getNode().opacityProperty(), 1, AnimateFXInterpolator.EASE), new KeyValue(getNode().translateYProperty(), -60, AnimateFXInterpolator.EASE), new KeyValue(getNode().scaleXProperty(), 0.475, AnimateFXInterpolator.EASE), new KeyValue(getNode().scaleYProperty(), 0.475, AnimateFXInterpolator.EASE), new KeyValue(getNode().scaleZProperty(), 0.475, AnimateFXInterpolator.EASE) ), new KeyFrame(Duration.millis(1000), new KeyValue(getNode().translateYProperty(), 600, AnimateFXInterpolator.EASE), new KeyValue(getNode().opacityProperty(), 0, AnimateFXInterpolator.EASE), new KeyValue(getNode().scaleXProperty(), 0.1, AnimateFXInterpolator.EASE), new KeyValue(getNode().scaleYProperty(), 0.1, AnimateFXInterpolator.EASE), new KeyValue(getNode().scaleZProperty(), 0.1, AnimateFXInterpolator.EASE) ) )); }
Example #20
Source File: RotateInDownLeft.java From AnimateFX with Apache License 2.0 | 6 votes |
@Override void initTimeline() { getNode().setRotationAxis(Rotate.Z_AXIS); Rotate rotate = new Rotate(0, 0, getNode().getBoundsInLocal().getHeight()); getNode().getTransforms().add(rotate); setTimeline(new Timeline( new KeyFrame(Duration.millis(0), new KeyValue(rotate.angleProperty(), -45, AnimateFXInterpolator.EASE), new KeyValue(getNode().opacityProperty(), 0, AnimateFXInterpolator.EASE) ), new KeyFrame(Duration.millis(1000), new KeyValue(rotate.angleProperty(), 0, AnimateFXInterpolator.EASE), new KeyValue(getNode().opacityProperty(), 1, AnimateFXInterpolator.EASE) ) )); }
Example #21
Source File: BounceOutRight.java From AnimateFX with Apache License 2.0 | 6 votes |
@Override void initTimeline() { setTimeline(new Timeline( new KeyFrame(Duration.millis(0), new KeyValue(getNode().opacityProperty(), 1, AnimateFXInterpolator.EASE) ), new KeyFrame(Duration.millis(200), new KeyValue(getNode().opacityProperty(), 1, AnimateFXInterpolator.EASE), new KeyValue(getNode().translateXProperty(), -20, AnimateFXInterpolator.EASE) ), new KeyFrame(Duration.millis(1000), new KeyValue(getNode().opacityProperty(), 0, AnimateFXInterpolator.EASE), new KeyValue(getNode().translateXProperty(), 2000, AnimateFXInterpolator.EASE) ) )); }
Example #22
Source File: FadeInUpBig.java From AnimateFX with Apache License 2.0 | 6 votes |
@Override void initTimeline() { setTimeline(new Timeline( new KeyFrame(Duration.millis(0), new KeyValue(getNode().opacityProperty(), 0, AnimateFXInterpolator.EASE), new KeyValue(getNode().translateYProperty(), 2000, AnimateFXInterpolator.EASE) ), new KeyFrame(Duration.millis(1000), new KeyValue(getNode().opacityProperty(), 1, AnimateFXInterpolator.EASE), new KeyValue(getNode().translateYProperty(), 0, AnimateFXInterpolator.EASE) ) )); }
Example #23
Source File: KeyStrokeMotion.java From marathonv5 with Apache License 2.0 | 6 votes |
private void createLetter(String c) { final Text letter = new Text(c); letter.setFill(Color.BLACK); letter.setFont(FONT_DEFAULT); letter.setTextOrigin(VPos.TOP); letter.setTranslateX((getWidth() - letter.getBoundsInLocal().getWidth()) / 2); letter.setTranslateY((getHeight() - letter.getBoundsInLocal().getHeight()) / 2); getChildren().add(letter); // over 3 seconds move letter to random position and fade it out final Timeline timeline = new Timeline(); timeline.getKeyFrames().add( new KeyFrame(Duration.seconds(3), new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { // we are done remove us from scene getChildren().remove(letter); } }, new KeyValue(letter.translateXProperty(), getRandom(0.0f, getWidth() - letter.getBoundsInLocal().getWidth()),INTERPOLATOR), new KeyValue(letter.translateYProperty(), getRandom(0.0f, getHeight() - letter.getBoundsInLocal().getHeight()),INTERPOLATOR), new KeyValue(letter.opacityProperty(), 0f) )); timeline.play(); }
Example #24
Source File: BounceOutLeft.java From AnimateFX with Apache License 2.0 | 6 votes |
@Override void initTimeline() { setTimeline(new Timeline( new KeyFrame(Duration.millis(0), new KeyValue(getNode().opacityProperty(), 1, AnimateFXInterpolator.EASE) ), new KeyFrame(Duration.millis(200), new KeyValue(getNode().opacityProperty(), 1, AnimateFXInterpolator.EASE), new KeyValue(getNode().translateXProperty(), 20, AnimateFXInterpolator.EASE) ), new KeyFrame(Duration.millis(1000), new KeyValue(getNode().opacityProperty(), 0, AnimateFXInterpolator.EASE), new KeyValue(getNode().translateXProperty(), -2000, AnimateFXInterpolator.EASE) ) )); }
Example #25
Source File: DataAppPreloader.java From marathonv5 with Apache License 2.0 | 6 votes |
@Override public void handleStateChangeNotification(StateChangeNotification evt) { if (evt.getType() == StateChangeNotification.Type.BEFORE_INIT) { // check if download was crazy fast and restart progress if ((System.currentTimeMillis() - startDownload) < 500) { raceTrack.setProgress(0); } // we have finished downloading application, now we are running application // init() method, as we have no way of calculating real progress // simplate pretend progress here simulatorTimeline = new Timeline(); simulatorTimeline.getKeyFrames().add( new KeyFrame(Duration.seconds(3), new KeyValue(raceTrack.progressProperty(),1) ) ); simulatorTimeline.play(); } }
Example #26
Source File: LightSpeedOut.java From AnimateFX with Apache License 2.0 | 6 votes |
@Override void initTimeline() { shear = new Shear(); getNode().getTransforms().add(shear); setTimeline(new Timeline( new KeyFrame(Duration.millis(0), new KeyValue(shear.xProperty(), 0), new KeyValue(shear.yProperty(), 0), new KeyValue(getNode().opacityProperty(), 1, Interpolator.EASE_IN) ), new KeyFrame(Duration.millis(1000), new KeyValue(getNode().translateXProperty(), getNode().getBoundsInParent().getWidth(), Interpolator.EASE_IN), new KeyValue(shear.xProperty(), 0.30), new KeyValue(shear.yProperty(), 0), new KeyValue(getNode().opacityProperty(), 0, Interpolator.EASE_IN) ) )); }
Example #27
Source File: ZoomInUp.java From AnimateFX with Apache License 2.0 | 6 votes |
@Override void initTimeline() { setTimeline(new Timeline( new KeyFrame(Duration.millis(0), new KeyValue(getNode().opacityProperty(), 0, Interpolator.SPLINE(0.55, 0.055, 0.675, 0.19)), new KeyValue(getNode().translateYProperty(), 1000, Interpolator.SPLINE(0.55, 0.055, 0.675, 0.19)), new KeyValue(getNode().scaleXProperty(), 0.1, Interpolator.SPLINE(0.55, 0.055, 0.675, 0.19)), new KeyValue(getNode().scaleYProperty(), 0.1, Interpolator.SPLINE(0.55, 0.055, 0.675, 0.19)), new KeyValue(getNode().scaleZProperty(), 0.1, Interpolator.SPLINE(0.55, 0.055, 0.675, 0.19)) ), new KeyFrame(Duration.millis(400), new KeyValue(getNode().opacityProperty(), 1, Interpolator.SPLINE(0.175, 0.885, 0.32, 1)), new KeyValue(getNode().translateYProperty(), 60, Interpolator.SPLINE(0.175, 0.885, 0.32, 1)), new KeyValue(getNode().scaleXProperty(), 0.475, Interpolator.SPLINE(0.175, 0.885, 0.32, 1)), new KeyValue(getNode().scaleYProperty(), 0.475, Interpolator.SPLINE(0.175, 0.885, 0.32, 1)), new KeyValue(getNode().scaleZProperty(), 0.475, Interpolator.SPLINE(0.175, 0.885, 0.32, 1)) ), new KeyFrame(Duration.millis(1000), new KeyValue(getNode().translateYProperty(), 0, Interpolator.SPLINE(0.55, 0.055, 0.675, 0.19)), new KeyValue(getNode().opacityProperty(), 1, Interpolator.SPLINE(0.55, 0.055, 0.675, 0.19)), new KeyValue(getNode().scaleXProperty(), 1, Interpolator.SPLINE(0.55, 0.055, 0.675, 0.19)), new KeyValue(getNode().scaleYProperty(), 1, Interpolator.SPLINE(0.55, 0.055, 0.675, 0.19)), new KeyValue(getNode().scaleZProperty(), 1, Interpolator.SPLINE(0.55, 0.055, 0.675, 0.19)) ) )); }
Example #28
Source File: SpriteView.java From quantumjava with BSD 3-Clause "New" or "Revised" License | 6 votes |
public void startAnimation() { Timeline timeline = new Timeline(Animation.INDEFINITE, new KeyFrame(Duration.seconds(.25), new KeyValue(frame, 0)), new KeyFrame(Duration.seconds(.5), new KeyValue(frame, 1)), new KeyFrame(Duration.seconds(.75), new KeyValue(frame, 2)), new KeyFrame(Duration.seconds(1), new KeyValue(frame, 1)) ); timeline.onFinishedProperty().setValue(e -> timeline.play()); timeline.play(); }
Example #29
Source File: TimelineInterpolator.java From netbeans with Apache License 2.0 | 6 votes |
private Circle createMovingCircle(Interpolator interpolator) { //create a transparent circle Circle circle = new Circle(45,45, 40, Color.web("1c89f4")); circle.setOpacity(0); //add effect circle.setEffect(new Lighting()); //create a timeline for moving the circle timeline.setCycleCount(Timeline.INDEFINITE); timeline.setAutoReverse(true); //create a keyValue for horizontal translation of circle to the position 155px with given interpolator KeyValue keyValue = new KeyValue(circle.translateXProperty(), 155, interpolator); //create a keyFrame with duration 4s KeyFrame keyFrame = new KeyFrame(Duration.seconds(4), keyValue); //add the keyframe to the timeline timeline.getKeyFrames().add(keyFrame); return circle; }
Example #30
Source File: Viewer3DFX.java From paintera with GNU General Public License v2.0 | 6 votes |
public void setAffine(final Affine affine, final Duration duration) { if (duration.toMillis() == 0.0) { setAffine(affine); return; } final Timeline timeline = new Timeline(60.0); timeline.setCycleCount(1); timeline.setAutoReverse(false); final Affine currentState = new Affine(); getAffine(currentState); final DoubleProperty progressProperty = new SimpleDoubleProperty(0.0); final SimilarityTransformInterpolator interpolator = new SimilarityTransformInterpolator( Transforms.fromTransformFX(currentState), Transforms.fromTransformFX(affine) ); progressProperty.addListener((obs, oldv, newv) -> setAffine(Transforms.toTransformFX(interpolator.interpolateAt(newv.doubleValue())))); final KeyValue kv = new KeyValue(progressProperty, 1.0, Interpolator.EASE_BOTH); timeline.getKeyFrames().add(new KeyFrame(duration, kv)); timeline.play(); }