Skip to content

Instantly share code, notes, and snippets.

@aalmiray
Created July 3, 2009 00:56
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 aalmiray/139855 to your computer and use it in GitHub Desktop.
Save aalmiray/139855 to your computer and use it in GitHub Desktop.
import java.awt.Color
import groovy.swing.SwingBuilder
import griffon.builder.gfx.GfxBuilder
import griffon.builder.gfx.swing.GfxPanel
def gfx = new GfxBuilder()
def node = gfx.group {
antialias true
ellipse(cx: 150, cy: 150, rx: 100, ry: 50, f: Color.WHITE)
ellipse(cx: 150, cy: 150, rx: 100, ry: 50, o: 0.5f) {
radialGradient(fx:50, fy: 50, /*r: 50,*/ fit: true) {
stop(offset: 0.0f, c: Color.WHITE)
stop(offset: 0.5f, c: Color.YELLOW)
stop(offset: 1.0f, c: Color.RED)
transforms {
rotate(a: 15, x: 150, y: 150)
}
}
}
}
new SwingBuilder().edt {
frame(title: "Bouncing Ball", size: [300,300], visible: true) {
panel(new GfxPanel(), node:node)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment