Skip to content

Instantly share code, notes, and snippets.

@ksky
Created November 13, 2011 16:00
Show Gist options
  • Save ksky/1362259 to your computer and use it in GitHub Desktop.
Save ksky/1362259 to your computer and use it in GitHub Desktop.
Playing movie by GroovyFX
import groovyx.javafx.*
GroovyFX.start {
def sg = new SceneGraphBuilder()
sg.stage(title: "MediaView Demo", width: 640, height: 380, visible: true) {
scene(fill: black) {
mview = mediaView(fitWidth: 640, fitHeight: 380) {
player(autoPlay: true, source: "<URL to movie file(.flv)>")
transition = parallelTransition {
rotateTransition(5.s, from:0, to:360)
fadeTransition(5.s, from:0.0, to:1.0)
scaleTransition(5.s, from:0.0, to:1.0)
}
}
onKeyReleased { e ->
println "media key: ${e.text}"
if (e.text == 's') {
mview.effect = (mview.effect) ? null : sepiaTone()
} else if (e.text == 'b') {
mview.effect = (mview.effect) ? null : gaussianBlur(radius:30)
} else if (e.text == 't') {
transition.playFromStart()
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment