Created
January 16, 2010 17:27
-
-
Save bluepapa32/278908 to your computer and use it in GitHub Desktop.
ParallelTransition Sample
This file contains 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 characters
import javafx.animation.*; | |
import javafx.animation.transition.*; | |
import javafx.scene.*; | |
import javafx.scene.image.*; | |
import javafx.scene.layout.*; | |
import javafx.scene.shape.*; | |
import javafx.stage.*; | |
public function run(args: String[]) { | |
var rate = -1; | |
var visible = true; | |
var node = ImageView { | |
image: Image { url: args[0] } | |
visible: bind visible | |
}; | |
var trans = ParallelTransition { | |
node: node | |
content: [ | |
FadeTransition { | |
duration: 0.5s | |
fromValue: 1.0 | |
toValue: 0.0 | |
rate: bind rate | |
} | |
ScaleTransition { | |
duration: 0.5s | |
fromX: 1.0 | |
fromY: 1.0 | |
toX: 0.0 | |
toY: 0.0 | |
rate: bind rate | |
} | |
] | |
rate: bind rate | |
action: function() { | |
visible = not visible; | |
} | |
} | |
Stage { | |
scene: Scene { | |
content: Stack { | |
content: [ | |
Rectangle { | |
width: 300 | |
height: 300 | |
onMouseClicked: function(e) { | |
if (not trans.running) { | |
rate = -1 * rate; | |
trans.play(); | |
} | |
} | |
} | |
node | |
] | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment