by cino
33 lines of code
IPFS
14 September 2022•TEZOS•IPFS
A minimalist token I coded as a form of break from the complexity of my next project.
Below you can find the 33 lines of p5.js that generate all the variations of this piece: they may seem more than 33 due to some of them exceeding the page width; zoom out and you'll see that they're really 33 ;)
let h,a;
function setup() {
colorMode(HSB);
randomSeed(fxrand()*9999999999999);
createCanvas(min(windowWidth, windowHeight), min(windowWidth, windowHeight));
h = random(0,360);
a = fxrand()<0.5 ? random(0.01,1) : 1;
let mono = fxrand()<0.5 ? false : stro();
let d = random(1,50);
let s = fxrand()<0.5 ? random(15,300) : random(300,1000);
let n = random(0.01,1);
let focus = random(0,width);
for (let y=0; y<height; y+=height/(random(30,s))) {
let sat = random(30,100);
if (!mono) {stro()}
for (let x=0; x< width; x+=width/(random(1,s))) {
let d = dist(x,y,focus,y);
fill(color(h,sat,map(d,0,width/2,0,100),a));
rect(x,y,width,height);
sat = adj(sat,0,5,30,100,false);
}
h = fxrand()<n ? adj(h,-d,d,0,360,false) : h;
focus = adj(focus,-width/(d*0.5),width/(d*0.5),width*0.1,width*0.9,true);
}
fxpreview();
}
adj = (c,d1,d2,start,end,rebound) => {
let ac = c+random(d1,d2);
ac = ac<start ? (rebound ? ac+=d2 : ac+=end-start) : ac;
ac = ac>end ? (rebound ? ac-=d2 : ac-=end-start) : ac;
return ac;
}
stro = () => fxrand()<0.2 ? stroke(h,random(50,100),random(50,100),a) : (fxrand()<0.5 ? stroke(0,a) : noStroke());
Below you can find the 33 lines of p5.js that generate all the variations of this piece: they may seem more than 33 due to some of them exceeding the page width; zoom out and you'll see that they're really 33 ;)
let h,a;
function setup() {
colorMode(HSB);
randomSeed(fxrand()*9999999999999);
createCanvas(min(windowWidth, windowHeight), min(windowWidth, windowHeight));
h = random(0,360);
a = fxrand()<0.5 ? random(0.01,1) : 1;
let mono = fxrand()<0.5 ? false : stro();
let d = random(1,50);
let s = fxrand()<0.5 ? random(15,300) : random(300,1000);
let n = random(0.01,1);
let focus = random(0,width);
for (let y=0; y<height; y+=height/(random(30,s))) {
let sat = random(30,100);
if (!mono) {stro()}
for (let x=0; x< width; x+=width/(random(1,s))) {
let d = dist(x,y,focus,y);
fill(color(h,sat,map(d,0,width/2,0,100),a));
rect(x,y,width,height);
sat = adj(sat,0,5,30,100,false);
}
h = fxrand()<n ? adj(h,-d,d,0,360,false) : h;
focus = adj(focus,-width/(d*0.5),width/(d*0.5),width*0.1,width*0.9,true);
}
fxpreview();
}
adj = (c,d1,d2,start,end,rebound) => {
let ac = c+random(d1,d2);
ac = ac<start ? (rebound ? ac+=d2 : ac+=end-start) : ac;
ac = ac>end ? (rebound ? ac-=d2 : ac-=end-start) : ac;
return ac;
}
stro = () => fxrand()<0.2 ? stroke(h,random(50,100),random(50,100),a) : (fxrand()<0.5 ? stroke(0,a) : noStroke());
86 EDITIONS
•0 RESERVES
minted
86 / 86
fixed price
0 TEZ
Lorem ipsum project longer longer
0.00001 ETH
Lorem ipsum project longer longer
0.00001 ETH
Lorem ipsum project longer longer
0.00001 ETH
Lorem ipsum project longer longer
0.00001 ETH
Lorem ipsum project longer longer
0.00001 ETH
Lorem ipsum project longer longer
0.00001 ETH
Lorem ipsum project longer longer
0.00001 ETH
Lorem ipsum project longer longer
0.00001 ETH
Lorem ipsum project longer longer
0.00001 ETH
Lorem ipsum project longer longer
0.00001 ETH
Lorem ipsum project longer longer
0.00001 ETH
Lorem ipsum project longer longer
0.00001 ETH
Lorem ipsum project longer longer
0.00001 ETH
Lorem ipsum project longer longer
0.00001 ETH
Lorem ipsum project longer longer
0.00001 ETH
Lorem ipsum project longer longer
0.00001 ETH
Lorem ipsum project longer longer
0.00001 ETH
Lorem ipsum project longer longer
0.00001 ETH
Lorem ipsum project longer longer
0.00001 ETH
Lorem ipsum project longer longer
0.00001 ETH
Lorem ipsum project longer longer
0.00001 ETH
Lorem ipsum project longer longer
0.00001 ETH
Lorem ipsum project longer longer
0.00001 ETH
Lorem ipsum project longer longer
0.00001 ETH