xxxxxxxxxx
103
// function setup(){
// createCanvas(1200,800);
// background(0);
// colorMode(RGB);
// }
// function draw(){
// let x =frameCount;
// let r = map(x, 0, width, 2.6, 4.2 );
// let y= 0.1;
// for( i=0;i<200;i++){
// stroke(200-i, 255,255);
// y= r*y*(1-y);
// point(x, 800*y);
// }
// }
// another example
// let x=0;
// let y=0;
// let a=-1.24;
// let b=-1.25;
// let c=-1.81;
// let d=-1.9;
// let sc=400;
// function setup() {
// createCanvas(840, 840);
// background(0);
// }
// function draw() {
// translate(width/2, height/2);
// stroke(255,20);
// for (i=0; i<1000; i++)
// cal();
// }
// function cal() {
// let nx= sin(a * y) - cos(b * x); //De Jong attractors
// let ny= sin(c * x) - cos(d * y);
// point(sc*x, sc*y);
// x=nx;
// y=ny;
// }
// another
// let h=300;
// let w=400;
// function setup() {
// createCanvas(800, 600);
// }
// function draw() {
// background(255);
// noStroke();
// fill(0);
// let s=5.0;
// for ( i=0; i<h; i++) {
// for (j=0; j<w; j++) {
// let x=noise(s*(j+3*frameCount)/w, s*i/h);
// let y=noise(s*j/w, s*(i+2*frameCount)/h);
// let nx=j + 18*map(x, 0, 1, -0.6, 0.6);
// let ny=i + 18*map(y, 0, 1, -0.6, 0.6);
// let t= map(cos(0.005*frameCount), -1, 1, 0.01, 0.0005); //0.02, 0.0005
// let theta= lerp(noise(t*nx, t*ny ), noise(4*t*nx, 4*t*ny ), 0.2);
// fill(map( cos(theta*0.04*(1+0.004*frameCount)/t), -1, 1, 0, 255));
// rect( j*2, i*2, 2, 2);
// }
// }
// }
//example
let freq = 0.005;
let x = 0;
let rectWidth = 1;
let y=[]
function setup() {
createCanvas(520, 480);
background(28, 28, 28);
}
function draw() {
noise1D();
}
function noise1D() {
if (x < width/rectWidth) {
// perlin noise (processing default)
let n = noise(x * freq);
n = map(n, 0, 1, height, 0);
noStroke();
fill(255);
rect(x * rectWidth, height - n, rectWidth, 5);
x++
}
}