Skip to content

Instantly share code, notes, and snippets.

@bluepapa32
Created January 16, 2010 17:27
Show Gist options
  • Save bluepapa32/278908 to your computer and use it in GitHub Desktop.
Save bluepapa32/278908 to your computer and use it in GitHub Desktop.
ParallelTransition Sample
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