Skip to content

Instantly share code, notes, and snippets.

@uehaj
Created November 5, 2011 05:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save uehaj/1341145 to your computer and use it in GitHub Desktop.
Save uehaj/1341145 to your computer and use it in GitHub Desktop.
クソゲーによる自己紹介(by uehaj)
/*
* Copyright 2011 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License")
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import groovyx.javafx.GroovyFX
import groovyx.javafx.SceneGraphBuilder
/**
* @author dean
* @author uehaj
*/
GroovyFX.start { primaryStage ->
def sg = new SceneGraphBuilder()
def rand = new Random().&nextInt
def items = [
"名前":"上原潤二",
"会社":"NTTソフトウェア",
"年齢":"43",
"書いた本1":"プログラミングGroovy",
"書いた本2":"Grails徹底入門)",
"作者of":"GroovyServ",
"twitter":"@uehaj",
"ブログ":"Grな日々",
"JGGUG":"運営委員",
"告知1":"G*Workshop#19 11/22@品川NTTSOFT GEB,JavaOne,合宿",
"告知2":"Java Developer Workshop#2 12/1@Orcle",
"ステータス":"激しい時差ボケ",
]
def textItems = []
sg.stage(title: '自己紹介', show: true) {
scene(fill: black, width: 800, height: 600) {
items.each { entry ->
textItems << text(cache: true, x: rand(100), y: rand(600),
text: entry.key,
font: "bold 32pt Amble",
strokeWidth: bind('hover', converter: {val -> val ? 4 : 0})) {
fill rgb(rand(100)+155, rand(100)+155, rand(100)+155, 0.8)
onMouseClicked { e ->
e.target.text = entry.value
}
}
}
}
parallelTransition(cycleCount: 'indefinite', autoReverse: true) {
textItems.each { text ->
translateTransition(3.s, node: text, toX: rand(800), toY: rand(600))
}
}.play()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment