Created
December 3, 2011 14:31
-
-
Save ksky/1427262 to your computer and use it in GitHub Desktop.
GroovyFXでルパン風タイトル表示
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 characters
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() | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment