package homesky; import homesky.Star; import java.lang.*; import java.util.Random; import javafx.animation.Interpolator; import javafx.animation.KeyFrame; import javafx.animation.Timeline; import javafx.fxd.FXDLoader; import javafx.scene.*; import javafx.scene.paint.Color; import javafx.scene.shape.*; import javafx.stage.*; var group = Group { content: [] }; var fxdContent = FXDLoader.load("{__DIR__}House.fxz"); // loads the content insert fxdContent into group.content; // inserts the fxd content into the group fxdContent.translateX = 40; fxdContent.translateY = 180; var r = 0.0; var t = Timeline { repeatCount: Timeline.INDEFINITE keyFrames: [ KeyFrame { time: 3s canSkip: true values: [ r => 360.0 tween Interpolator.EASEBOTH ] } ] } t.play(); var op = 1.0; var op1 = 0.0; var t1 = Timeline { repeatCount: Timeline.INDEFINITE keyFrames: [ KeyFrame { time: 3s canSkip: true values: [ op => 0.0 tween Interpolator.EASEBOTH ] } ] } t1.play(); var t2 = Timeline { repeatCount: Timeline.INDEFINITE keyFrames: [ at(3s) { op1 => 1.0 } at(6s) {op1 => 0.0} ] } t2.play(); var rnd : Random = new Random(); var stars: Star[]; for(i in [0..100]) { insert Star { x: rnd.nextInt(500) y: rnd.nextInt(150) color: Color.YELLOWGREEN } into stars } Stage { title: "JavaFX + PhotoShop" resizable: true width: 400 height: 500 onClose: function() { System.exit (0); } scene: Scene { fill: Color.BLACK content: [ Polygon { rotate: bind r; translateX: 130 translateY: 100 scaleX: 0.5 scaleY: 0.5 points: [ 0,0, 2,-50, 4,0, 54,2,4,4,2,54,0,4,-50,2] fill: Color.YELLOWGREEN opacity: bind op1 }, Polygon { rotate: 45; scaleX: 0.25 scaleY: 0.25 translateX: 130 translateY: 100 points: [ 0,0, 2,-50, 4,0, 54,2,4,4,2,54,0,4,-50,2] fill: Color.YELLOWGREEN opacity: bind 1 - op1 }, Polygon { rotate: bind r; translateX: 330 translateY: 50 scaleX: 0.5 scaleY: 0.5 points: [ 0,0, 2,-50, 4,0, 54,2,4,4,2,54,0,4,-50,2] fill: Color.YELLOW opacity: bind op1 }, Polygon { rotate: 45; scaleX: 0.25 scaleY: 0.25 translateX: 330 translateY: 50 points: [ 0,0, 2,-50, 4,0, 54,2,4,4,2,54,0,4,-50,2] fill: Color.YELLOW opacity: bind 1 - op1 }, Polygon { rotate: bind r; translateX: 350 translateY: 150 scaleX: 0.5 scaleY: 0.5 points: [ 0,0, 2,-50, 4,0, 54,2,4,4,2,54,0,4,-50,2] fill: Color.WHITE opacity: bind op }, Polygon { rotate: 45; scaleX: 0.25 scaleY: 0.25 translateX: 350 translateY: 150 points: [ 0,0, 2,-50, 4,0, 54,2,4,4,2,54,0,4,-50,2] fill: Color.YELLOWGREEN opacity: bind 1 - op }, Polygon { rotate: bind r; translateX: 30 translateY: 120 scaleX: 0.5 scaleY: 0.5 points: [ 0,0, 2,-50, 4,0, 54,2,4,4,2,54,0,4,-50,2] fill: Color.YELLOWGREEN opacity: bind op }, Polygon { rotate: 45; scaleX: 0.25 scaleY: 0.25 translateX: 30 translateY: 120 points: [ 0,0, 2,-50, 4,0, 54,2,4,4,2,54,0,4,-50,2] fill: Color.YELLOW opacity: bind 1 - op }, Polygon { rotate: 45; scaleX: 0.25 scaleY: 0.25 translateX: 130 translateY: 100 points: [ 0,0, 2,-50, 4,0, 54,2,4,4,2,54,0,4,-50,2] fill: Color.YELLOW opacity: bind 1 - op1 }, Polygon { rotate: 45; scaleX: 0.25 scaleY: 0.25 translateX: 330 translateY: 150 points: [ 0,0, 2,-50, 4,0, 54,2,4,4,2,54,0,4,-50,2] fill: Color.YELLOWGREEN opacity: 1 }, Polygon { rotate: 45; scaleX: 0.25 scaleY: 0.25 translateX: 100 translateY: 100 points: [ 0,0, 2,-50, 4,0, 54,2,4,4,2,54,0,4,-50,2] fill: Color.YELLOW opacity: bind 1 - op1 }, Polygon { rotate: 45; scaleX: 0.25 scaleY: 0.25 translateX: 530 translateY: 100 points: [ 0,0, 2,-50, 4,0, 54,2,4,4,2,54,0,4,-50,2] fill: Color.WHITE opacity: bind 1 - op1 }, stars,group ] } };