Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- float xstart, ystart, xnoise, ynoise;
- float xstartnoise, ystartnoise;
- int maxSize;
- int step = 20;
- void setup() {
- size(490, 305);
- background(0);
- rectMode(CENTER);
- //noFill();
- noStroke();
- xstartnoise = random(20);
- ystartnoise = random(20);
- xstart = random(10);
- ystart = random(10);
- }
- void draw() {
- background(0);
- maxSize = 20;
- xstartnoise += 0.01;
- ystartnoise += 0.01;
- xstart += (noise(xstartnoise)*0.05)-0.025;
- ystart += (noise(ystartnoise)*0.05)-0.025;
- xnoise=xstart;
- ynoise=ystart;
- for (int y=maxSize/2; y < height-maxSize/4; y+=step) {
- ynoise += 0.1;
- xnoise = xstart;
- for (int x=maxSize/2; x < width-maxSize/4; x+=step) {
- xnoise += 0.1;
- drawPoint(x, y, noise(xnoise, ynoise));
- }
- }
- }
- void drawPoint(float x, float y, float noiseFactor) {
- float sz = noiseFactor * maxSize;
- float a = 100 + int(noiseFactor *155);
- fill(255, a);
- pushMatrix();
- translate(x, y);
- rotate(noiseFactor*TAU);
- rect(0,0,sz,sz);
- popMatrix();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement