Skip to content

Instantly share code, notes, and snippets.

@tetsurokitahara
Created November 5, 2011 06: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 tetsurokitahara/1341180 to your computer and use it in GitHub Desktop.
Save tetsurokitahara/1341180 to your computer and use it in GitHub Desktop.
GroovyでProcesssing風にプログラムを書くサンプル
import processing.core.*
/** GroovyでProcessing風にプログラムを書くサンプル.
Processingに付属する core.jar が必要. */
class MyApplet extends PApplet {
def t = 0
void setup() {
size(240, 240)
}
void draw() {
background(0)
float x = (cos(0.1 * t) + 1) * width / 2
float y = (sin(0.1 * t) + 1) * height / 2
ellipse(x, y, 10, 10)
t++
}
}
MyApplet.main(["MyApplet"] as String[])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment