Created
November 5, 2011 06:26
-
-
Save tetsurokitahara/1341180 to your computer and use it in GitHub Desktop.
GroovyでProcesssing風にプログラムを書くサンプル
This file contains 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 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