Created
June 13, 2012 07:58
-
-
Save ksky/2922653 to your computer and use it in GitHub Desktop.
Revisions
-
ksky created this gist
Jun 13, 2012 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,43 @@ // GroovyFX version of "JavaFX Animation Sample": https://gist.github.com/2917266 @Grab('org.codehaus.groovyfx:groovyfx:0.2') import static groovyx.javafx.GroovyFX.start start { stage = stage { scene(width: 400, height: 250) { // --- >8 --- Cut here for GroovyFxPad --- >8 --- root = group { rect = rectangle(x: 50, y: 50, width: 100, height: 75, fill: red, opacity: 0.0) { fadein = fadeTransition(500.ms, to: 1.0) translate = translateTransition(1000.ms, fromX: 0.0, toX: 200.0, autoReverse: true, cycleCount: 5) } colorchange = timeline(autoReverse: true, cycleCount: 4) { at (600.ms) { change (rect, 'fill') { to green } } } circ = circle(centerX: 150, centerY: 150, radius: 50, fill: cyan, opacity: 0.0) { fadein2 = fadeTransition(500.ms, to: 1.0) scale = scaleTransition(1000.ms, fromX: 1.0, toX: 2.0, fromY: 1.0, toY: 0.75, autoReverse: true, cycleCount: 2) fadeout = fadeTransition(500.ms, to: 0.0, onFinished: { root.children.remove(circ) }) } timeline = timeline { at ( 500.ms, onFinished: { fadein.play() }) at (1000.ms, onFinished: { translate.play() }) at (1500.ms, onFinished: { colorchange.play() }) at (2000.ms, onFinished: { fadein2.play() }) at (2500.ms, onFinished: { scale.play() }) at (5000.ms, onFinished: { fadeout.play() }) } timeline.play() } // --- >8 --- Cut here for GroovyFxPad --- >8 --- } } stage.show() }