Skip to content

Instantly share code, notes, and snippets.

@ksky
Created December 3, 2011 14:31
Show Gist options
  • Select an option

  • Save ksky/1427262 to your computer and use it in GitHub Desktop.

Select an option

Save ksky/1427262 to your computer and use it in GitHub Desktop.

Revisions

  1. ksky created this gist Dec 3, 2011.
    43 changes: 43 additions & 0 deletions lupinfx.groovy
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,43 @@
    import groovyx.javafx.*
    import javafx.scene.text.Font
    import javafx.scene.media.*

    def sound1 = new AudioClip("ルパン風タイプ音.aif")
    def sound2 = new AudioClip("ルパン風BGM音.aif")

    String message = "プログラミングGROOVY"
    int len = message.size()

    GroovyFX.start({
    def sgb = new SceneGraphBuilder()
    def stage = sgb.stage {
    scene(fill: black, width: 1024, height: 768) {
    borderPane {
    center {
    txt = text(text:' ', fill: white, font: new Font(600)) {
    transition = scaleTransition(300.ms, from: 5.0, to: 1.6/len)
    }
    }
    }
    }
    }
    def tlb = new TimelineBuilder()
    def timeline = tlb.timeline(
    onFinished: {
    txt.text = message
    transition.play()
    sound2.play()
    }
    ) {
    message.eachWithIndex { ch, i ->
    if (ch != ' ') {
    at ((i*300).ms, onFinished: {sound1.play()}) {
    change (txt, 'text') { to ch }
    }
    }
    }
    at ((len*300).ms) { change (txt, 'text') { to ' ' } }
    }
    stage.show()
    timeline.play()
    })