Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Using Perlin noise. Example adapted from http://courses.haigarmen.com/desn315/files/2013/10/GenerativeArt-2.pdf
- See the Processing reference for the noise() function
- */
- int step = 10;
- float lastx = -999;
- float lasty = -999;
- float ynoise = random(10);
- float y;
- void setup(){
- size(500, 100);
- background(255);
- strokeWeight(5);
- smooth();
- stroke(0, 30);
- }
- void draw(){
- stroke(20, 50, 70,1);
- for (int x=20; x<=480; x+=step) {
- y = 10 + noise(ynoise) * 80;
- if (lastx > -999) {
- line(x, y, lastx, lasty);
- }
- lastx = x;
- lasty = y;
- ynoise += 0.1;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement