/* built with Studio Sketchpad: * https://sketchpad.cc * * observe the evolution of this sketch: * https://studio.sketchpad.cc/sp/pad/view/ro.o92W05TPhSS/rev.9 * * authors: * GoToLoop * license (unless otherwise specified): * creative commons attribution-share alike 3.0 license. * https://creativecommons.org/licenses/by-sa/3.0/ */ /** * Perturbed Bezier Lines (v2.03) * by SeanJustice (2014/Mar) * mod GoToLoop * * forum.processing.org/two/discussion/3456/yet-another-processing-js-question * * studio.processingtogether.com/sp/pad/export/ro.981lbSfJSyiPY/latest */ static final int MAX_COUNT = 1<<14; int w, cx, h, cy, x1, x4; void setup() { size(1000, 700, JAVA2D); frameRate(60); smooth(4); colorMode(HSB, 360, 100, 100); noFill(); w = width; h = height; cx = x1 = x4 = w>>1; cy = h>>1; } void draw() { final int fc = frameCount % MAX_COUNT; if (1/2 != 1/2.) frame.setTitle("frameCount: " + frameCount + "\t\tfc: " + fc + "\t\tLimit: " + MAX_COUNT); final float disturb1 = noise(.001*fc); final float disturb2 = noise(.01*fc); final float x2 = cx/3 * disturb1; //final float x2 = map(disturb1, 0, 1, 0, cx/3); final float x3 = map(disturb2, 0, 1, cx, w/3); final float y2 = map(disturb2, 0, 1, h/5, cy); final float y3 = map(disturb1, 0, 1, cy, h*.85); final float v3 = 100.0 - .003*fc; background(180, 40, v3 > 0.0? v3 : -v3); stroke(195.0 - .01*fc, 24, 50.0 - v3); strokeWeight(1); bezier(x1, 0, x2, y2, x3 + .01*fc, y3, x4, h); //1 stroke(195.0 - .005*fc, 24, 50); strokeWeight(.4); bezier(x1, 0, x2 + 10.0 + .001*fc, y2, x3 - 50.0, y3 + .025*fc, x4, h); //2 stroke(195.0 + .01*fc, 24, 50.0 + .0005*fc); strokeWeight(.4); bezier(x1, 0, x2/2 + .002*fc, y2/2.0 + .08*fc, x2 + 500.0, y2, x4, h); //3 strokeWeight(1.1); bezier(x1, 0, x2 + .008*fc, y2, x3/4.0, y3/4.0, x4, h); //4 stroke(195.0 + .01*fc, 24, 50.0 + .005*fc); strokeWeight(.9); bezier(x1, 0, w - x2, y2 + .007*fc, x3 - .005*fc, y3*.9 - .01*fc, x4, h); //5 }