-
-
Save p5info/68f026142d8ada895280 to your computer and use it in GitHub Desktop.
Processing2.0b8 new function sample
Lite version is https://gist.github.com/p5info/5027951
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
final int RATIO = 10; | |
float x, y; | |
PGraphics g1, g2; | |
int SIDE=200; | |
int WIDTH=SIDE*2, HEIGHT=SIDE; | |
void setup() { | |
frameRate(1000); | |
clear();//more than 2.0b8 (If less than 2.0b7 background(0, 0, 0, 0)) | |
size(WIDTH, HEIGHT); | |
stroke(255); | |
g1 = createGraphics(SIDE, SIDE); | |
g1.beginDraw(); | |
g1.clear();//more than 2.0b8 (If less than 2.0b7 background(0, 0, 0, 0)) | |
g1.stroke(255); | |
g1.endDraw(); | |
g2 = createGraphics(SIDE, SIDE); | |
g2.beginDraw(); | |
g2.clear();//more than 2.0b8 (If less than 2.0b7 background(0, 0, 0, 0)) | |
g2.stroke(255); | |
g2.endDraw(); | |
} | |
void draw() { | |
g1.beginDraw(); | |
x =g1.width/2+ random(-1, 1)*RATIO; | |
y =g1.height/2+ random(-1, 1)*RATIO; | |
g1.point(x, y); | |
g1.endDraw(); | |
image(g1, 0, 0); | |
g2.beginDraw(); | |
x =g2.width/2+ randomGaussian()*RATIO;//more than 2.0b8 | |
y =g2.height/2+ randomGaussian()*RATIO;//more than 2.0b8 | |
g2.point(x, y); | |
g2.endDraw(); | |
image(g2, width/2, 0); | |
line(width/2, 0, width/2, height); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment