[ Video ]
[ About ]
Processingのイベント参加に備えて久々にやってみました。不揃いの四角形を3層重ねています。
Three layers overlapped square. I used Processing after a long absence.
[ Source ]
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
// Variable int len; ArrayList<PVector> locations; IntList seeds; void setup(){ // Initialize size(720, 720); frameRate(25); stroke(255); strokeWeight(2); colorMode(HSB); blendMode(ADD); // Initialize Variable len = 144; locations = new ArrayList<PVector>(); seeds = new IntList(); for(int y = len / 2; y < height; y += len){ for(int x = len / 2; x < width; x += len){ locations.add(new PVector(x, y)); seeds.append((int)random(1000)); } } } void draw(){ background(0); for(int i = 0; i < locations.size(); i++){ // Draw Rectangle for(int n = 0; n < 3; n++){ fill(random(255), 255, 255, 200); int start_param = (int)random(100); int end_param = start_param + (int)random(30, 70); beginShape(); for(int param = start_param; param < end_param; param++){ PVector location = make_point(len * 0.9, param); location.add(locations.get(i)); vertex(location.x, location.y); } endShape(CLOSE); } // Update seed value if(frameCount % locations.size() == i){ seeds.set(i, frameCount); } randomSeed(seeds.get(i)); } } PVector make_point(float len, int param){ param = param % 100; if(param < 25){ return new PVector(map(param, 0, 25, -len * 0.5, len * 0.5), -len * 0.5); }else if(param < 50){ return new PVector(len * 0.5, map(param, 25, 50, -len * 0.5, len * 0.5)); }else if(param < 75){ return new PVector(map(param, 50, 75, len * 0.5, -len * 0.5), len * 0.5); }else{ return new PVector(-len * 0.5, map(param, 75, 100, len * 0.5, -len * 0.5)); } } |