Skip to content

Instantly share code, notes, and snippets.

@micromeeeter
Created December 1, 2017 08:01
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 micromeeeter/eba7230e22aa608faa53c4ee0c8c557b to your computer and use it in GitHub Desktop.
Save micromeeeter/eba7230e22aa608faa53c4ee0c8c557b to your computer and use it in GitHub Desktop.
p5で描いた絵をpdfで吐くサンプル
import processing.pdf.*; //pdf吐くためのライブラリをインポート
size(500, 500, PDF, "test.pdf");
stroke(0);
for(int i = 0; i < 50; i++){
for(int j = 0; j < 50; j++){
float a = random(1);
if(a < 0.5){
line(10*i, 10*j, 10*(i+1), 10*(j+1));
}
if(a >= 0.5){
line(10*(i+1), 10*j, 10*i, 10*(j+1));
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment