Created
December 1, 2017 08:01
-
-
Save micromeeeter/eba7230e22aa608faa53c4ee0c8c557b to your computer and use it in GitHub Desktop.
p5で描いた絵をpdfで吐くサンプル
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.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