/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package preloaders; import javafx.animation.AnimationTimer; import javafx.animation.Interpolator; import javafx.animation.KeyFrame; import javafx.animation.KeyValue; import javafx.animation.PathTransition; import javafx.animation.Timeline; import javafx.application.Application; import javafx.application.Preloader; import javafx.beans.property.DoubleProperty; import javafx.beans.property.SimpleDoubleProperty; import javafx.scene.Group; import javafx.scene.Node; import javafx.scene.Scene; import javafx.scene.effect.BlurType; import javafx.scene.effect.BoxBlurBuilder; import javafx.scene.effect.DropShadowBuilder; import javafx.scene.effect.InnerShadowBuilder; import javafx.scene.paint.Color; import javafx.scene.shape.ClosePath; import javafx.scene.shape.LineTo; import javafx.scene.shape.MoveTo; import javafx.scene.shape.Path; import javafx.scene.shape.Rectangle; import javafx.scene.shape.SVGPath; import javafx.scene.shape.Shape; import javafx.scene.shape.StrokeLineJoin; import javafx.stage.Stage; import javafx.util.Duration; /** * * @author Jasper */ public class PathPreloader extends Preloader { public static void main(String[] args) { Application.launch(args); } @Override public void start(Stage stage) throws Exception { stage.setTitle("JavaFX Preloaders"); Group root = new Group(); final Scene scene = new Scene(root, 800, 600); scene.setFill(Color.gray(0.1)); final int itemCount = 500; final int itemSize = 5; final double length = 0.5; // // Path p = new Path(); // p.getElements().add(new MoveTo(300, 200)); // p.getElements().add(new LineTo(250, 350)); // p.getElements().add(new LineTo(350, 350)); // p.getElements().add(new ClosePath()); // root.getChildren().add(p); SVGPath p = new SVGPath(); p.setContent("M686.911,343.946c6.184-10.894,27.583-16.477,38.426-11.242"+ "c17.16,8.284,32.545,72.781-83.294,79.225c-47.176,2.624-78.244,11.899-213.155,18.408c-9.448,0.456-195.134-2.104-252.663-11.242"+ "C12.319,393.06,9.098,299.747,35.396,259.923c41.42-62.722,107.692-40.236,90.105,1.155c-5.153,12.127-8.413,20.786-8.413,22.514"+ "c0.592,5.917,4.733,14.793,10.059,7.692c10.059-14.201-15.385-24.852-26.036-22.485c-12.426,2.367-25.444,16.568-23.077,30.178"+ "c1.775,8.284,7.101,16.568,14.793,17.751c13.609,2.366,6.509-7.692-3.551-6.509c-17.16,1.775-24.26,26.035-18.935,40.236"+ "c4.142,11.242,26.035,15.977,36.095,13.018c17.16-4.142,28.959-2.366,47.894-18.343c3.838-3.238,3.585-24.853,10.094-23.669"+ "c7.101,1.775,6.509,18.344,7.101,23.669c0,5.917,0,11.243,0,16.567c1.775-9.467,19.527-44.378,33.728-32.544"+ "c10.059,8.284-0.592,40.829,17.751,32.544c13.018-5.324,38.461-45.562,54.438-35.502c11.834,7.1,9.467,41.42-4.142,42.604"+ "c-14.793,1.184-23.9-14.412-32.184-22.697c-1.184,20.711,28.634,32.756,45.793,26.839c16.568-5.325,27.219-18.935,34.32-33.136"+ "c3.55-6.51,20.71-34.32,21.893-10.651c0.592,10.06-24.852,33.136-28.994,21.302c7.692,8.876,8.284,14.793,18.935,19.527"+ "c9.468,4.142,16.568,4.142,25.444-1.775c4.734-3.551,12.426-9.468,15.385-13.609c5.325-5.918,5.917-15.385,11.834-21.303"+ "c7.101-5.916,28.402-11.242,28.994,2.367c0,4.143-5.326,11.834-6.509,15.977c-3.551,8.876-7.586,19.527-16.462,23.077"+ "c5.917-14.793,19.42-21.302,28.296-34.911c2.958-4.734,6.509-11.243,13.609-9.468c15.385,4.142,0.592,28.402,0,37.278"+ "c10.651-8.284,14.201-17.16,20.118-28.402c2.367-4.734,2.959-7.102,8.284-10.06c7.692-4.733,13.018-5.917,15.977,2.367"+ "c3.55,8.876-4.143,18.935-0.592,27.219c6.509,17.751,23.077,6.509,31.952-1.775c12.427-10.06,66.864-66.864,34.912-79.881"+ "c-14.201-5.326-24.261,13.018-27.812,24.26c-4.142,13.018-0.591,24.261,1.184,37.278c1.775,11.242,4.699,28.402,20.084,28.994"+ "c10.059,0,61.538-23.077-17.752-44.971c8.876,15.976,74,19.527,81.101,8.876c4.142-5.325,17.751-40.237,5.325-47.337"+ "c-10.06-6.509-22.485,34.911-23.669,42.604c-1.775,16.567,0.001,37.277,17.16,40.236c3.796,1.968,29.586-11.834,36.687-14.201"+ "c8.283-2.959,27.811-24.261,17.159-29.586c-16.568-8.876-28.994,34.911-15.385,42.012"+ "C657.325,374.716,676.852,356.964,686.911,343.946z"); // p.setContent("M125.372,262.29c-3.55,5.917-8.284,14.201-8.284,21.302c0.592,5.917,4.733,14.793,10.059,7.692c10.059-14.201-15.385-24.852-26.036-22.485c-12.426,2.367-25.444,16.568-23.077,30.178"+ // "c1.775,8.284,7.101,16.568,14.793,17.751c13.609,2.366,6.509-7.692-3.551-6.509c-17.16,1.775-24.26,26.035-18.935,40.236"+ // "c4.142,11.242,26.035,15.977,36.095,13.018c17.16-4.142,28.959-2.366,47.894-18.343c3.838-3.238,3.585-24.853,10.094-23.669"+ // "c7.101,1.775,6.509,18.344,7.101,23.669c0,5.917,0,11.243,0,16.567c1.775-9.467,19.527-44.378,33.728-32.544"+ // "c10.059,8.284-0.592,40.829,17.751,32.544c13.018-5.324,38.461-45.562,54.438-35.502c11.834,7.1,9.467,41.42-4.142,42.604"+ // "c-14.793,1.184-23.9-14.412-32.184-22.697c-1.184,20.711,28.634,32.756,45.793,26.839c16.568-5.325,27.219-18.935,34.32-33.136"+ // "c3.55-6.51,20.71-34.32,21.893-10.651c0.592,10.06-24.852,33.136-28.994,21.302c7.692,8.876,8.284,14.793,18.935,19.527"+ // "c9.468,4.142,16.568,4.142,25.444-1.775c4.734-3.551,12.426-9.468,15.385-13.609c5.325-5.918,5.917-15.385,11.834-21.303"+ // "c7.101-5.916,28.402-11.242,28.994,2.367c0,4.143-5.326,11.834-6.509,15.977c-3.551,8.876-7.586,19.527-16.462,23.077"+ // "c5.917-14.793,19.42-21.302,28.296-34.911c2.958-4.734,6.509-11.243,13.609-9.468c15.385,4.142,0.592,28.402,0,37.278"+ // "c10.651-8.284,14.201-17.16,20.118-28.402c2.367-4.734,2.959-7.102,8.284-10.06c7.692-4.733,13.018-5.917,15.977,2.367"+ // "c3.55,8.876-4.143,18.935-0.592,27.219c6.509,17.751,23.077,6.509,31.952-1.775c12.427-10.06,66.864-66.864,34.912-79.881"+ // "c-14.201-5.326-24.261,13.018-27.812,24.26c-4.142,13.018-0.591,24.261,1.184,37.278c1.775,11.242,4.699,28.402,20.084,28.994"+ // "c10.059,0,61.538-23.077-17.752-44.971c8.876,15.976,74,19.527,81.101,8.876c4.142-5.325,17.751-40.237,5.325-47.337"+ // "c-10.06-6.509-22.485,34.911-23.669,42.604c-1.775,16.567,0.001,37.277,17.16,40.236c3.796,1.968,29.586-11.834,36.687-14.201"+ // "c8.283-2.959,27.811-24.261,17.159-29.586c-16.568-8.876-28.994,34.911-15.385,42.012c18.936,9.468,38.462-8.284,48.521-21.302"); p.setStroke(Color.gray(0.2)); p.setStrokeWidth(8); p.setStrokeLineJoin(StrokeLineJoin.ROUND); p.setCache(true); p.setEffect(DropShadowBuilder.create() .color(Color.BLACK) .offsetX(0).offsetY(0).radius(20) .blurType(BlurType.ONE_PASS_BOX).build()); root.getChildren().add(p); Group shapes1 = new Group(); shapes1.setEffect(DropShadowBuilder.create() .color(Color.rgb(0, 255, 255)) .offsetX(0).offsetY(0).radius(20) .blurType(BlurType.ONE_PASS_BOX).build()); // shapes1.setEffect(BoxBlurBuilder.create().width(20).height(20).build()); Group shapes2 = new Group(); root.getChildren().addAll(shapes1, shapes2); shapes2.setEffect(DropShadowBuilder.create() .color(Color.rgb(255, 0, 255)) .offsetX(0).offsetY(0).radius(20) .blurType(BlurType.ONE_PASS_BOX).build()); // shapes2.setEffect(BoxBlurBuilder.create().width(20).height(20).build()); final Shape[] shapes = new Shape[itemCount]; final PathTransition[] pathTransitions = new PathTransition[itemCount]; final Shape[] shapesRev = new Shape[itemCount]; final PathTransition[] pathTransitionsRev = new PathTransition[itemCount]; for (int i=0; i max) return max; return val; } }