protected final void createRippleUI() { // create rippler panels rippler = new RippleGenerator(); ripplerPane = new StackPane(); ripplerPane.setMouseTransparent(true); ripplerPane.getChildren().add(rippler); getChildren().add(ripplerPane); }
@Override protected void layoutChildren() { super.layoutChildren(); if (!getChildren().contains(selectedPane)) { getChildren().add(0, cellRippler); cellRippler.rippler.clear(); getChildren().add(0, selectedPane); } cellRippler.resizeRelocate(0, 0, getWidth(), getHeight()); cellRippler.releaseRipple(); selectedPane.resizeRelocate(0, 0, selectedPane.prefWidth(-1), getHeight()); selectedPane.setVisible(isSelected() ? true : false); }
void createRipple() { if (enabled) { if (!generating.getAndSet(true)) { // create overlay once then change its color later createOverlay(); if (this.getClip() == null || (getChildren().size() == 1 && !cacheRipplerClip) || resetClip) { this.setClip(getMask()); } this.resetClip = false; // create the ripple effect final Ripple ripple = new Ripple(generatorCenterX, generatorCenterY); getChildren().add(ripple); ripplesQueue.add(ripple); // animate the ripple overlayRect.outAnimation.stop(); overlayRect.inAnimation.play(); ripple.inAnimation.play(); } } }
if (currentNode == null || !currentNode.equals(newNode)) { cellContent = newNode; cellRippler.rippler.cacheRippleClip(false); cellRippler.rippler.cacheRippleClip(true);
makeChildrenTransparent(); getChildren().add(0, cellRippler); cellRippler.rippler.clear();
if (getListView() instanceof JFXListView) { ((JFXListView<?>) newList).currentVerticalGapProperty().addListener((o, oldVal, newVal) -> { cellRippler.rippler.setClip(null); if (newVal.doubleValue() != 0) { playExpandAnimation = true;
private void releaseRipple() { Ripple ripple = ripplesQueue.poll(); if(ripple!=null) { ripple.inAnimation.stop(); ripple.outAnimation = new Timeline( new KeyFrame(Duration.millis(Math.min(800, (0.9 * 500) / ripple.getScaleX())) , ripple.outKeyValues)); ripple.outAnimation.setOnFinished((event) -> getChildren().remove(ripple)); ripple.outAnimation.play(); if (generating.getAndSet(false)) { if (overlayRect != null) { overlayRect.inAnimation.stop(); if (!forceOverlay) overlayRect.outAnimation.play(); } } } }
void createRipple() { if (enabled) { if (!generating.getAndSet(true)) { // create overlay once then change its color later createOverlay(); if (this.getClip() == null || (getChildren().size() == 1 && !cacheRipplerClip) || resetClip) { this.setClip(getMask()); } this.resetClip = false; // create the ripple effect final Ripple ripple = new Ripple(generatorCenterX, generatorCenterY); getChildren().add(ripple); ripplesQueue.add(ripple); // animate the ripple overlayRect.outAnimation.stop(); overlayRect.inAnimation.play(); ripple.inAnimation.play(); } } }
/** * creates Ripple effect in the center of the control * @return a runnable to release the ripple when needed */ public Runnable createManualRipple() { if(!isRipplerDisabled()) { rippler.setGeneratorCenterX(control.getLayoutBounds().getWidth() / 2); rippler.setGeneratorCenterY(control.getLayoutBounds().getHeight() / 2); rippler.createRipple(); return () -> { // create fade out transition for the ripple releaseRipple(); }; } return () -> { }; }
void createOverlay() { if (overlayRect == null) { overlayRect = new OverLayRipple(); overlayRect.setClip(getMask()); getChildren().add(0, overlayRect); if (ripplerFill.get() instanceof Color) { overlayRect.setFill(new Color(((Color) ripplerFill.get()).getRed(), ((Color) ripplerFill.get()).getGreen(), ((Color) ripplerFill.get()).getBlue(), 0.2)); }else{ overlayRect.setFill(Color.TRANSPARENT); } } }
@Override protected void layoutChildren() { super.layoutChildren(); if (!getChildren().contains(selectedPane)) { getChildren().add(0, cellRippler); cellRippler.rippler.clear(); getChildren().add(0, selectedPane); } cellRippler.resizeRelocate(0, 0, getWidth(), getHeight()); cellRippler.releaseRipple(); selectedPane.resizeRelocate(0, 0, selectedPane.prefWidth(-1), getHeight()); selectedPane.setVisible(isSelected() ? true : false); }
private void resetOverLay() { if (rippler.overlayRect != null) { rippler.overlayRect.inAnimation.stop(); final RippleGenerator.OverLayRipple oldOverlay = rippler.overlayRect; rippler.overlayRect.outAnimation.setOnFinished((finish) -> rippler.getChildren().remove(oldOverlay)); rippler.overlayRect.outAnimation.play(); rippler.overlayRect = null; } }
/** * creates Ripple effect */ protected void createRipple(double x, double y) { if(!isRipplerDisabled()) { rippler.setGeneratorCenterX(x); rippler.setGeneratorCenterY(y); rippler.createRipple(); } }
protected final void createRippleUI() { // create rippler panels rippler = new RippleGenerator(); ripplerPane = new StackPane(); ripplerPane.setMouseTransparent(true); ripplerPane.getChildren().add(rippler); getChildren().add(ripplerPane); }
RippleGenerator() { // improve in performance, by preventing // redrawing the parent when the ripple effect is triggered this.setManaged(false); this.setCache(true); this.setCacheHint(CacheHint.SPEED); }
public void clear() { getChildren().clear(); rippler.overlayRect = null; generating.set(false); } }
/** * this method will be set to private in future versions of JFoenix, * user the method {@link #setOverlayVisible(boolean)} */ @Deprecated public void showOverlay() { if (rippler.overlayRect != null) { rippler.overlayRect.outAnimation.stop(); } rippler.createOverlay(); rippler.overlayRect.inAnimation.play(); }
if (currentNode == null || !currentNode.equals(newNode)) { cellContent = newNode; cellRippler.rippler.cacheRippleClip(false); cellRippler.rippler.cacheRippleClip(true);
makeChildrenTransparent(); getChildren().add(0, cellRippler); cellRippler.rippler.clear();
if (getListView() instanceof JFXListView) { ((JFXListView<?>) newList).currentVerticalGapProperty().addListener((o, oldVal, newVal) -> { cellRippler.rippler.setClip(null); if (newVal.doubleValue() != 0) { playExpandAnimation = true;