Skip to content

Instantly share code, notes, and snippets.

@ksky
Created November 5, 2011 05:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save ksky/1341142 to your computer and use it in GitHub Desktop.
Save ksky/1341142 to your computer and use it in GitHub Desktop.
Self introduction by Google+ API and GroovyFX
import groovyx.javafx.*
key = '<YOUR Google+ API KEY HERE>'
uid = 110611905999186598367 // user ID
url = "https://www.googleapis.com/plus/v1/people/$uid?key=$key".toURL()
json = new groovy.json.JsonSlurper().parseText(url.text)
GroovyFX.start {
def sg = new SceneGraphBuilder()
stage = sg.stage(title: "Profile", width: 640, height:380) {
scene(fill: black) {
imageView(x: 20, y: 40, rotationAxis: [0, 1.0, 0]) {
image(json.image.url.replaceAll(/sz=50/, 'sz=200'))
effect reflection(fraction: 0.25)
transition =
rotateTransition(1.s, from:0, to:360, tween: ease_out)
onMouseClicked { transition.play() }
}
text(x: 240, y: 60, text: json.displayName,
fill: white, font: "32pt", textOrigin: "top") {
effect bloom()
}
text(x: 240, y: 120, text: json.tagline,
fill: white, font: "16pt", textOrigin: "top")
}
}
stage.show()
transition.play()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment