public void initialize() { timer.start(); Timeline timeline = new Timeline(new KeyFrame(Duration.millis(1000), ae -> setTime())); timeline.setCycleCount(Animation.INDEFINITE); timeline.play(); Timeline angleLine = new Timeline(new KeyFrame(Duration.millis(50), ae -> updateAngle())); angleLine.setCycleCount(Animation.INDEFINITE); angleLine.play(); }
private void drawerAnimation() { Timeline animation; if (drawerOpened) { toggleLayer.setVisible(true); animation = new Timeline( new KeyFrame( DEFAULT_TIME_ANIM, new KeyValue(nav.translateXProperty(), 0, Interpolator.EASE_OUT), new KeyValue(toggleLayer.opacityProperty(), 0.3))); } else { animation = new Timeline( new KeyFrame( DEFAULT_TIME_ANIM, new KeyValue(nav.translateXProperty(), -DEFAULT_WIDTH_NAV, Interpolator.EASE_IN), new KeyValue(toggleLayer.opacityProperty(), 0))); animation.setOnFinished( evt -> { toggleLayer.setOpacity(0); toggleLayer.setVisible(false); }); } animation.play(); }
private void runProcessingAnimation(double duration) { timeline.setAutoReverse(true); timeline.setCycleCount(2); // transitionRect = new TranslateTransition(Duration.millis(duration), rectangle); // transitionCircle = new TranslateTransition(Duration.millis(duration), circle); transitionCircle.setDuration(Duration.millis(duration)); transitionCircle.setNode(circle); transitionCircle.setAutoReverse(false); transitionCircle.setByX(150); transitionCircle.setFromX(0); transitionRect.setAutoReverse(false); transitionRect.setDuration(Duration.millis(duration)); transitionRect.setNode(rectangle); transitionRect.setByX(150); transitionRect.setFromX(0); KeyValue keyValue = new KeyValue(imageViewTop.translateYProperty(), 90); KeyFrame keyFrame = new KeyFrame( Duration.millis(duration), (ActionEvent) -> { toggleHide(rectangle); transitionRect.play(); transitionCircle.play(); stackProducts(rectangle, imageViewRightStorage, this); }, keyValue); timeline.getKeyFrames().clear(); timeline.getKeyFrames().add(keyFrame); timeline.play(); }
public void gameTimer() { if (level == 1) { timer = 1000; } else if (level == 2) { timer = 900; } else if (level == 3) { timer = 800; } else if (level == 4) { timer = 700; } else if (level == 5) { timer = 600; } else if (level == 6) { timer = 500; } else if (level == 7) { timer = 400; } else if (level == 8) { timer = 300; } else if (level == 9) { timer = 200; } else if (level == 10) { timer = 100; } timeline = new Timeline(new KeyFrame(Duration.millis(1000), e -> timer())); timeline.setCycleCount(Animation.INDEFINITE); timeline.play(); }
public void play() { // wait till start of next second then start a timeline to call refreshClocks() every second delayTimeline = new Timeline(); delayTimeline .getKeyFrames() .add( new KeyFrame( new Duration(1000 - (System.currentTimeMillis() % 1000)), new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { if (secondTimeline != null) { secondTimeline.stop(); } secondTimeline = new Timeline(); secondTimeline.setCycleCount(Timeline.INDEFINITE); secondTimeline .getKeyFrames() .add( new KeyFrame( Duration.seconds(1), new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { refreshClocks(); } })); secondTimeline.play(); } })); delayTimeline.play(); }
@Override public void start(Stage primaryStage) { try { Group root = new Group(); Scene scene = new Scene(root, 400, 400); scene.getStylesheets().add(getClass().getResource("application.css").toExternalForm()); primaryStage.setScene(scene); primaryStage.show(); final Rectangle rectBasicTimeline = new Rectangle(); rectBasicTimeline.setX(0); rectBasicTimeline.setY(0); rectBasicTimeline.widthProperty().bind(scene.widthProperty()); rectBasicTimeline.heightProperty().bind(scene.heightProperty()); rectBasicTimeline.setFill(Color.RED); root.getChildren().add(rectBasicTimeline); final Timeline timeline = new Timeline(); timeline.setCycleCount(Timeline.INDEFINITE); timeline.setAutoReverse(true); final KeyValue kv1 = new KeyValue(rectBasicTimeline.fillProperty(), Color.YELLOW); final KeyValue kv2 = new KeyValue(rectBasicTimeline.fillProperty(), Color.GREEN); final KeyValue kv3 = new KeyValue(rectBasicTimeline.fillProperty(), Color.BLUE); final KeyFrame kf1 = new KeyFrame(Duration.millis(5000), kv1); final KeyFrame kf2 = new KeyFrame(Duration.millis(10000), kv2); final KeyFrame kf3 = new KeyFrame(Duration.millis(15000), kv3); timeline.getKeyFrames().add(kf1); timeline.getKeyFrames().add(kf2); timeline.getKeyFrames().add(kf3); timeline.play(); } catch (Exception e) { e.printStackTrace(); } }
@Ignore // RT-26710: javafx.scene.web.LeakTest hangs @Test public void testOleg() throws InterruptedException { final String URL = new File("src/test/resources/html/guimark2-vector.html").toURI().toASCIIString(); final int CYCLE_COUNT = 16; final int CYCLE_LENGTH = 5; final CountDownLatch latch = new CountDownLatch(CYCLE_COUNT); Timeline time = new Timeline(); time.setCycleCount(CYCLE_LENGTH * CYCLE_COUNT); time.getKeyFrames() .add( new KeyFrame( Duration.millis(1000), new EventHandler<ActionEvent>() { int counter = -1; @Override public void handle(final ActionEvent e) { ++counter; if (counter == 0) { WebEngine engine = new WebEngine(); engine.load(URL); } else if (counter == CYCLE_LENGTH - 1) { counter = -1; latch.countDown(); } } })); time.play(); latch.await(); }
private void maybeHideDock(long time) { if (hiding) { return; } if (popOver != null && popOver.isShowing()) return; stopDockHiderTrigger(); dockHiderTrigger = new Timeline(new KeyFrame(Duration.millis(time), ae -> hideDock(true))); dockHiderTrigger.play(); }
@Override public void start(Stage primaryStage) throws Exception { Group root = new Group(); Group circles = new Group(); for (int i = 0; i < 30; i++) { Circle circle = new Circle(150, Color.web("white", 0.05)); circle.setStrokeType(StrokeType.OUTSIDE); circle.setStroke(Color.web("white", 0.16)); circle.setStrokeWidth(4); circles.getChildren().add(circle); } root.getChildren().add(circles); Scene scene = new Scene(root, 800, 600, Color.BLACK); Rectangle colors = new Rectangle( scene.getWidth(), scene.getHeight(), new LinearGradient( 0f, 1f, 1f, 0f, true, CycleMethod.NO_CYCLE, new Stop[] { new Stop(0, Color.web("#f8bd55")), new Stop(0.14, Color.web("#c0fe56")), new Stop(0.28, Color.web("#5dfbc1")), new Stop(0.43, Color.web("#64c2f8")), new Stop(0.57, Color.web("#be4af7")), new Stop(0.71, Color.web("#ed5fc2")), new Stop(0.85, Color.web("#ef504c")), new Stop(1, Color.web("#f2660f")), })); colors.widthProperty().bind(scene.widthProperty()); colors.heightProperty().bind(scene.heightProperty()); root.getChildren().add(colors); Timeline timeline = new Timeline(); for (Node circle : circles.getChildren()) { timeline .getKeyFrames() .addAll( new KeyFrame( Duration.ZERO, // set start position at 0 new KeyValue(circle.translateXProperty(), random() * 800), new KeyValue(circle.translateYProperty(), random() * 600)), new KeyFrame( new Duration(40000), // set end position at 40s new KeyValue(circle.translateXProperty(), random() * 800), new KeyValue(circle.translateYProperty(), random() * 600))); } timeline.play(); primaryStage.setScene(scene); primaryStage.show(); }
public void startStop() { if (time.getStatus() != Status.STOPPED) { // if started, stop it time.stop(); lastClockTime = 0; } else { // if stopped, restart time.play(); } }
@Override public void start(Stage stage) { stage.initStyle(StageStyle.TRANSPARENT); stage.setAlwaysOnTop(true); VBox box = new VBox(); imageView = new ImageView(sprites[currentFrame]); box.getChildren().add(imageView); final Scene scene = new Scene(box, 0, 0); Rectangle2D screenBounds = Screen.getPrimary().getVisualBounds(); stage.setX(currentX); stage.setY(currentY); scene.setFill(null); stage.setScene(scene); mainLoop = new Timeline(); mainLoop.setCycleCount(Animation.INDEFINITE); renderFrame = new KeyFrame( frameDuration, new EventHandler<ActionEvent>() { public void handle(ActionEvent event) { Double currentFrameWidth = sprites[currentFrame].getWidth(); Double currentFrameHeight = sprites[currentFrame].getHeight(); stage.setWidth(currentFrameWidth); stage.setHeight(currentFrameHeight); currentY = screenBounds.getMinY() + screenBounds.getHeight() - currentFrameHeight; Double minLimitX = 0.0; Double maxLimitX = screenBounds.getMinX() + screenBounds.getWidth() - currentFrameWidth; if (currentX >= maxLimitX || currentX <= minLimitX) { velocity = -1 * velocity; currentX = currentX >= maxLimitX ? maxLimitX - 1 : minLimitX + 1; currentWalkingFrame = 0; } else { currentX += velocity; } if (velocity > 0) { currentFrame = walking_right_indexes[currentWalkingFrame]; } else { currentFrame = walking_left_indexes[currentWalkingFrame]; } stage.setX(currentX); stage.setY(currentY); imageView.setImage(sprites[currentFrame]); currentWalkingFrame = (++currentWalkingFrame) % walking_right_indexes.length; } }); mainLoop.getKeyFrames().add(renderFrame); stage.show(); mainLoop.play(); }
private void stopGame() { timeline.pause(); done = true; sp.setOnMouseClicked( e -> { timeline.play(); done = false; mediaPlayer.stop(); mediaPlayer.play(); sp.setOnMouseClicked(null); }); }
@Override public void start(Stage stage) throws Exception { game = GameImpl.INSTANCE; LocalEndpoint.client = this; final BorderPane root = new BorderPane(); root.setStyle("-fx-padding: 20"); // root.setCenter(rows); Timeline fiveSecondsWonder = new Timeline( new KeyFrame( Duration.seconds(1), new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { final Sprite[][] grille = game.getGrille(); // * // final Sprite[][] grille = new Sprite[][] { // { Sprite.MUR, Sprite.SOL, Sprite.FANTOME }, // { Sprite.MUR, Sprite.SOL, Sprite.FANTOME }, // { Sprite.MUR, Sprite.SOL, Sprite.FANTOME } }; // */ if (grille.length == 0) { System.out.println("Grille vide"); } else { System.out.println( "Grille de taille : (" + grille.length + " x " + grille[0].length + ")"); } VBox rows = prepareBoard(grille); root.setCenter(rows); } })); fiveSecondsWonder.setCycleCount(Timeline.INDEFINITE); fiveSecondsWonder.play(); Scene scene = new Scene(root); scene.setOnKeyPressed( new EventHandler<KeyEvent>() { @Override public void handle(KeyEvent event) { System.out.println( "AmiEnnemisClient.start(...).new EventHandler() {...}.handle()" + event.getCode()); doMove(event); } }); stage.setScene(scene); stage.show(); }
void animateRoute(List<Path> path, Circle entranceMarker, GraphicsContext gc) { double entranceX = entranceMarker.getCenterX(); double entranceY = entranceMarker.getCenterY(); int currentKeyFrameTimeInMs = 0, keyframeTimeInMs = 50; List<KeyFrame> keyFrames = new ArrayList<>(); List<AnimationTimer> timers = new ArrayList<>(); for (int i = 0; i < path.size(); i++) { Path pathEntry = path.get(i); DoubleProperty opacity = new SimpleDoubleProperty(); keyFrames.add( new KeyFrame(Duration.millis(currentKeyFrameTimeInMs), new KeyValue(opacity, 0))); keyFrames.add( new KeyFrame( Duration.millis(currentKeyFrameTimeInMs + keyframeTimeInMs), new KeyValue(opacity, 0.3))); timeline.setAutoReverse(true); timeline.setCycleCount(1); currentKeyFrameTimeInMs += keyframeTimeInMs; timers.add( new AnimationTimer() { @Override public void handle(long now) { gc.setFill(Color.FORESTGREEN.deriveColor(0, 1, 1, opacity.get())); if (maze.representation().length > 24) { gc.fillRect( entranceX + calculateNextPosX(pathEntry.x, 2) - 20, entranceY + calculateNextPosY(pathEntry.y, 2) - 176, CELL_LENGTH, CELL_LENGTH); } else { gc.fillRect( entranceX + calculateNextPosX(pathEntry.x, 5) - 23, entranceY + calculateNextPosY(pathEntry.y, 5) - 178, CELL_LENGTH, CELL_LENGTH); } } }); } timeline.getKeyFrames().addAll(keyFrames); for (int i = 0; i < path.size(); i++) { timers.get(i).start(); } timeline.play(); }
public void levelUp() { level = (numberOfLines / 10) + 1; shoftDropTimer.stop(); shoftDropTimer.getKeyFrames().clear(); shoftDropTimer .getKeyFrames() .add( new KeyFrame( Duration.millis((double) 1000 * framesPerSecond[level - 1] / 60), new TimerHandler())); shoftDropTimer.play(); }
public static Shape set( Shape s, Paint color, double width, double lineLength, double spaceLength, double secendsPerFrame) { if (s instanceof Rectangle) RectangleBuilder.create().strokeDashArray(lineLength, spaceLength).applyTo(s); else if (s instanceof Circle) CircleBuilder.create().strokeDashArray(lineLength, spaceLength).applyTo(s); s.setStroke(color); s.setStrokeDashOffset(0); s.setStrokeLineCap(StrokeLineCap.ROUND); s.setStrokeLineJoin(StrokeLineJoin.ROUND); s.setStrokeType(StrokeType.CENTERED); s.setStrokeWidth(width); if (secendsPerFrame > 0) { Timeline tl = new Timeline( new KeyFrame( Duration.seconds(secendsPerFrame), new KeyValue(s.strokeDashOffsetProperty(), lineLength + spaceLength))); tl.setCycleCount(Timeline.INDEFINITE); tl.play(); } else if (secendsPerFrame < 0) { Timeline tl = new Timeline( new KeyFrame( Duration.ZERO, new KeyValue(s.strokeDashOffsetProperty(), lineLength + spaceLength)), new KeyFrame( Duration.seconds(-secendsPerFrame), new KeyValue(s.strokeDashOffsetProperty(), 0))); tl.setCycleCount(Timeline.INDEFINITE); tl.play(); } return s; }
@Override public void start(Stage stage) throws Exception { Point[] sample = new Point[] { new Point(20, 10), new Point(50, 50), new Point(10, 20), new Point(100, 30), new Point(100, 200), new Point(30, 30), }; ArrayList<Point> result = convexHull(sample); System.out.println("Left with: " + result.toString()); // for animated spawning of dots Circle[] sampleDots = new Circle[sample.length]; for (int i = 0; i < sampleDots.length; i++) { sampleDots[i] = new Circle(sample[i].x, sample[i].y, 3); sampleDots[i].setFill(Color.RED); sampleDots[i].opacityProperty().set(0); if (result.contains(sample[i])) sampleDots[i].setFill(Color.DARKCYAN); bp.getChildren().add(sampleDots[i]); sampleDots[i].toFront(); } // polygon of result Polygon p = new Polygon(); p.setFill(Color.TRANSPARENT); p.setStroke(Color.BLACK); p.setStrokeWidth(3); for (Point pt : result) { p.getPoints().addAll(Double.valueOf(pt.x), Double.valueOf(pt.y)); } bp.getChildren().add(p); // scene & stage related Scene scene = new Scene(bp, 250, 250); stage.setScene(scene); stage.setResizable(false); stage.setTitle("Sample Convex Hull"); stage.show(); // animated spawning of dots p.toBack(); Timeline tl = new Timeline(); for (int i = 0; i < sampleDots.length; i++) { tl.getKeyFrames() .add( new KeyFrame( Duration.seconds(1), new KeyValue(sampleDots[i].opacityProperty(), 1.0))); } tl.setCycleCount(1); tl.play(); }
public void createNodes(Graph graph, double[][] coordinates) { nodeArray = new ArrayList<>(); double radius = graph.getNumberOfNodes() < 25 ? 100 / graph.getNumberOfNodes() : 4; for (int i = 0; i < coordinates.length; i++) { Circle nodeI = new Circle(radius); nodeI.setTranslateX(coordinates[i][0]); nodeI.setTranslateY(coordinates[i][1]); Tooltip tip = new Tooltip("node number " + (i + 1) + ", \"" + root.sequence.getText().charAt(i) + "\""); Tooltip.install(nodeI, tip); nodeI.setId(root.sequence.getText().substring(i, i + 1)); Timeline timeline = new Timeline(); nodeI.setOnMouseDragged( event -> { nodeI.setTranslateX(event.getSceneX() - root.nodes.getLayoutX()); nodeI.setTranslateY(event.getSceneY() - root.nodes.getLayoutY()); }); final int finalI = i; nodeI.setOnMouseReleased( event -> { double[][] newCoordinates = SpringEmbedder.computeSpringEmbedding( 100, graph.getNumberOfNodes(), graph.getEdges(), null); SpringEmbedder.centerCoordinates( newCoordinates, 0, (int) root.getWidth(), 20, (int) (root.getHeight() - root.vbox.getHeight() * 1.5)); timeline .getKeyFrames() .add( new KeyFrame( Duration.millis(200), new KeyValue(nodeI.translateXProperty(), coordinates[finalI][0]))); timeline .getKeyFrames() .add( new KeyFrame( Duration.millis(200), new KeyValue(nodeI.translateYProperty(), coordinates[finalI][1]))); timeline.play(); }); nodeI.disableProperty().bind(Bindings.not(root.animate.selectedProperty())); root.nodes.getChildren().add(nodeI); nodeArray.add(nodeI); } }
public void startGame(MouseEvent e) { if (e.getButton().equals(MouseButton.PRIMARY)) { stage.close(); EscapeNewPangea game = new EscapeNewPangea(); Scene scene = game.initialize(); stage.setScene(scene); stage.show(); KeyFrame frame = game.start(); Timeline animation = new Timeline(); animation.setCycleCount(Animation.INDEFINITE); animation.getKeyFrames().add(frame); animation.play(); } }
public void handle(ActionEvent t) { if (Objekte.getPlayerData().isAnimation()) { if (Objekte.getPlayerData().isMoveB()) { moveB(); } else if (Objekte.getPlayerData().isMoveL()) { moveL(); } else if (Objekte.getPlayerData().isMoveT()) { moveT(); } else if (Objekte.getPlayerData().isMoveR()) { moveR(); } } timeL.play(); }
/* */ public Object animate(KeyFrame[] paramArrayOfKeyFrame) /* */ { /* 87 */ Timeline localTimeline = new Timeline(); /* 88 */ localTimeline.setAutoReverse(false); /* 89 */ localTimeline.setCycleCount(1); /* 90 */ localTimeline.getKeyFrames().addAll(paramArrayOfKeyFrame); /* 91 */ localTimeline.setOnFinished(this); /* */ /* 93 */ if (this.activeTimeLines.isEmpty()) start(); /* */ /* 95 */ this.activeTimeLines.put(localTimeline, localTimeline); /* */ /* 97 */ localTimeline.play(); /* 98 */ return localTimeline; /* */ }
// Tenta carregar uma Screen pelo nome // Primeiramente tendo certeza que a Screen ja foi carregada // Se existir mais de uma Screen entao uma nova Screen é adicionada e removemos a atual public void setScreen(final String name) { if (screens.get(name) == null) { // Carregando a Screen final DoubleProperty opacity = opacityProperty(); if (!getChildren().isEmpty()) { Timeline fade = new Timeline( new KeyFrame(Duration.ZERO, new KeyValue(opacity, 1.0)), new KeyFrame( new Duration(1000), new EventHandler<ActionEvent>() { public void handle(ActionEvent event) { getChildren().remove(0); getChildren().add(0, screens.get(name)); Timeline fadeIn = new Timeline( new KeyFrame(Duration.ZERO, new KeyValue(opacity, 0.0)), new KeyFrame(new Duration(800), new KeyValue(opacity, 1.0))); fadeIn.play(); } }, new KeyValue(opacity, 0.0))); fade.play(); } else { setOpacity(0.0); getChildren().add(screens.get(name)); Timeline fadeIn = new Timeline( new KeyFrame(Duration.ZERO, new KeyValue(opacity, 0.0)), new KeyFrame(new Duration(2500), new KeyValue(opacity, 1.0))); fadeIn.play(); } } else { System.err.println("Screen não foi encontrada na lista"); } }
public void initialize(Stage stage, Scene scene) { this.stage = stage; this.scene = scene; try { ClientCommunicationManager.getInstance().subscribeAll(); } catch (InterruptedException e) { e.printStackTrace(); } btn_refresh.setOnAction( event -> { try { ClientCommunicationManager.getInstance().subscribeAll(); updateRobotList(); } catch (InterruptedException e) { e.printStackTrace(); } }); list_robots .getSelectionModel() .selectedIndexProperty() .addListener((obervable, oldValue, newValue) -> loadSelected()); ClientCommunicationManager clientCommunicationManager = ClientCommunicationManager.getInstance(); updateRobotList(); Timeline updateTimer = new Timeline( new KeyFrame( Duration.millis(50), new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { Collection<String> oldRobots = RobotRepository.getInstance().getRobots().keySet(); clientCommunicationManager.processIncomingObjects(); Collection<String> newRobots = RobotRepository.getInstance().getRobots().keySet(); if (!oldRobots.equals(newRobots)) { updateRobotList(); } } })); updateTimer.setCycleCount(Timeline.INDEFINITE); updateTimer.play(); }
private void animateTransitionToLabel(Label newLabel) { final Bounds newLabelBounds = newLabel.getBoundsInParent(); final double newX = newLabelBounds.getMinX(); final double newWidth = newLabelBounds.getWidth(); animation.getKeyFrames().clear(); animation .getKeyFrames() .add( new KeyFrame( TRANSITION_DURATION, new KeyValue(selectedBackground.xProperty(), newX), new KeyValue(selectedBackground.widthProperty(), newWidth))); animation.play(); }
public void win() { Text t = new Text("You Win"); t.setFont(Font.font("Impact", 45)); t.setFill(Color.BLACK); root.getChildren().add(t); timeline = new Timeline( new KeyFrame( Duration.millis(100), new EventHandler() { public void handle(Event e) {} })); timeline.setCycleCount(10); timeline.play(); curClan.inventory.addAll(m.spoils); curClan.gold += m.gold; curClan.completed.add(m); }
public void animate() { Timeline timeline = new Timeline( new KeyFrame( Duration.seconds(0), new KeyValue(translateZ.zProperty(), -20), new KeyValue(rotateX.angleProperty(), 90), new KeyValue(rotateY.angleProperty(), 90), new KeyValue(rotateZ.angleProperty(), 90)), new KeyFrame( Duration.seconds(5), new KeyValue(translateZ.zProperty(), -80), new KeyValue(rotateX.angleProperty(), -90), new KeyValue(rotateY.angleProperty(), -90), new KeyValue(rotateZ.angleProperty(), -90))); timeline.setCycleCount(Animation.INDEFINITE); timeline.play(); }
@Override public void start(Stage s) { myGame = new Game(); s.setTitle(myGame.getTitle()); Scene scene = myGame.init(WIDTH, HEIGHT); s.setScene(scene); s.show(); KeyFrame frame = new KeyFrame(Duration.millis(MILLISECOND_DELAY), e -> myGame.step(SECOND_DELAY)); Timeline animation = new Timeline(); animation.setCycleCount(Timeline.INDEFINITE); animation.getKeyFrames().add(frame); animation.play(); s.setResizable(false); }
public JFXToggleButtonSkin(JFXToggleButton toggleButton) { super(toggleButton); // hide the togg le button toggleButton.setStyle("-fx-background-color:TRANSPARENT"); line = new Line(startX, startY, endX, startY); line.setStroke(unToggledColor); line.setStrokeWidth(1); circle = new Circle(startX - circleRadius, startY, circleRadius); circle.setFill(Color.TRANSPARENT); circle.setStroke(unToggledColor); circle.setStrokeWidth(strokeWidth); innerCircle = new Circle(startX - circleRadius, startY, 0); innerCircle.setStrokeWidth(0); StackPane circlePane = new StackPane(); circlePane.getChildren().add(circle); circlePane.getChildren().add(innerCircle); circlePane.setPadding(new Insets(15)); rippler = new JFXRippler(circlePane, RipplerMask.CIRCLE, RipplerPos.BACK); circles.getChildren().add(rippler); main.getChildren().add(line); main.getChildren().add(circles); main.setCursor(Cursor.HAND); AnchorPane.setTopAnchor(circles, -12.0); AnchorPane.setLeftAnchor(circles, -15.0); getSkinnable() .selectedProperty() .addListener( (o, oldVal, newVal) -> { rippler.setRipplerFill(newVal ? unToggledColor : toggledColor); transition.setRate(newVal ? 1 : -1); transition.play(); }); updateChildren(); }
public void schedule() { Timeline fiveSecondsWonder = new Timeline( new KeyFrame( Duration.seconds(.2), new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { // System.out.println("heading " + heading+"route "+route); speed.setText(route.toString()); cog.setText(route.toString()); sog.setText(route.toString()); depth.setText(route.toString()); route++; route %= 360; } })); fiveSecondsWonder.setCycleCount(Timeline.INDEFINITE); fiveSecondsWonder.play(); }
void hideDock(boolean hide) { stopDockHiderTrigger(); if (hide != hidden) { /* * If revealing, then don't actually reveal until a delay has * passed. The delayed action will be cancelled if in the mean time * the mouse leaves the dock revealer */ if (!hide) { stopDockRevealerTimer(); dockRevealer = new Timeline( new KeyFrame(Duration.millis(REVEAL_HOVER_TIME), ae -> changeHidden(hide))); dockRevealer.play(); } else { changeHidden(hide); } } }