memoscan
← all memos

Memo 0x11c5727d…f2f38b on Ethereum

let pals=[["#EED6B5","#EBDAD2","#E36D32","#BDAB57","#9F9F74","#fbbb00",],["#D6CEC7","#E6D3C5","#C7C1CF","#A797BD","#FF9820",],["#BDAB57","#9F9F74","#696F4D","#EED6B5","#F0C4B0","#EBDAD2",],["#EED6B5","#EBDAD2","#FF9820","#fbbb00","#BDAB57",],],pals2=[["#A797BD",],["#E36D32",],["#C7C1CF","#A797BD",],["#CEDADD",],],clrs,sha,vert=` attribute vec3 aPosition; attribute vec2 aTexCoord; varying vec2 vTexCoord; void main() { vTexCoord = aTexCoord; vec4 positionVec4 = vec4(aPosition, 1.0); positionVec4.xy = positionVec4.xy * 2.0 - 1.0; gl_Position = positionVec4; }`,frag=` #ifdef GL_ES precision highp float; #endif varying vec2 vTexCoord; uniform sampler2D tex0; uniform float ws; uniform vec2 u_resolution; uniform float w; uniform float m; uniform float z; uniform vec2 d; uniform float t; uniform vec2 fbm[6]; const int dir = 13; const int rng = 3; float map(float x, float imin, float imax, float omin, float omax) { return imin + (x-omin)*((imax-imin)/(omax-omin)); } vec4 blur(sampler2D txt, vec2 st, float s, float ph) { vec4 col = vec4(0.0); for (int j = 1; j < rng+1; j++) { float r = float(j)*(s/float(rng)); for (int i = 0; i<dir; i++) { float a = float(i)*(ph/float(dir)); vec2 p = st + (vec2(cos(a),sin(a)))*r; vec4 cs = texture2D(txt, p); cs = pow(cs,vec4(2.2)); col += cs; } } return col/(float(rng)*float(dir)); } vec2 wrp(vec2 st, float freq, float t) { vec2 result = 0.5*cos(st.xy*1.1*freq + vec2(fbm[0].x,fbm[0].y) + t) + 0.35*cos(st.yx*2.3*freq + vec2(fbm[1].x,fbm[1].y) + t) + 0.13*cos(st.xy*4.1*freq + vec2(fbm[2].x,fbm[2].y) + t) + 0.062*cos(st.yx*8.1*freq + vec2(fbm[3].x,fbm[3].y) + t); 0.031*cos(st.xy*16.1*freq + vec2(fbm[3].x,fbm[3].y) + t); return result; } void main() { vec2 uv = vTexCoord; uv.y = 1.0 - uv.y; vec2 wrp = wrp(uv, 3.0*sin(0.5*w), w); vec4 bg = vec4(0.0); for (int i = 0; i<9; i++) { float a = float(i)*(2.28/float(dir)); vec2 p = uv/z + d + (vec2(cos(a),sin(a)))*0.004; vec4 cs = texture2D(tex0, p); cs = pow(cs,vec4(2.2)); bg += cs; } bg = bg/float(dir); float avg = dot(bg.rgb, vec3(0.333)); avg = avg*2.0 - 1.0; vec2 st = uv + wrp*ws*sin(uv*3.1415) + 0.3*avg; st += (1.0/z)*0.48*cos(13.0*(st.xy+fbm[1]/2.0)*sin(t*0.00001 + fbm[3].y)) + (1.0/z)*0.24*cos(15.3*(st.yx+fbm[2]/2.0)*cos(t*0.000008 + fbm[3].x)); if (z == 4.0) { st.x = map(st.x, 0.7, 0.79, 0.0, 1.0); st.y = map(st.y, 0.2, 0.29, 0.0, 1.0); } else { st.x = map(st.x, 0.6, 0.75, 0.0, 1.0); st.y = map(st.y, 0.25, 0.4, 0.0, 1.0); } vec4 col = blur(tex0,st,0.005, 2.28); col = pow(col, vec4(1.0 / 2.3)); if (m == 1.0) { col = 1.1*col*col; } gl_FragColor = vec4(col); }`,seed=parseInt(tokenData.hash.slice(0,16),16),field=[],dims=[32,32],pg,art;function setup(){randomSeed(seed),noiseSeed(seed),setAttributes("perPixelLighting",!0),setAttributes("antialias",!0),windowHeight>=(ar=1.44)*windowWidth?(ww=windowWidth,wh=ar*windowWidth):(wh=windowHeight,ww=windowHeight/ar),createCanvas(ww,wh,WEBGL),pixelDensity(min(2,displayDensity())),colorMode(HSB,360,100,100,100),pB(),tB();let t=floor(random(pals.length));if(mlt=.25>random()?1:0,clrs=pals[t],.65>random()){let e=pals2[t];for(let $=0;$<e.length;$++)clrs.push(e[$]);3==t&&(mlt=0)}art=createGraphics(1024,1024),bg=.35>random()?color("#2E2E2E"):color(random(clrs)),art.background(bg),dC(field,50),fbm=[];for(let i=0;i<12;i++)fbm.push(random(TWO_PI));wrp=random([.2,.25,.3,.35]),zm=random([2.5,3,3.5,3,3.5,4]),ts=random(5,10),dpl=[random([.05,.55]),random([.05,.55])],shader(sha=createShader(vert,frag)),sha.setUniform("tex0",art),sha.setUniform("u_resolution",[width,height]),sha.setUniform("m",mlt),sha.setUniform("w",ts),sha.setUniform("ws",wrp),sha.setUniform("z",zm),sha.setUniform("d",dpl),sha.setUniform("fbm",fbm)}function draw(){clear(),background(0),sha.setUniform("t",millis()),rect(0,0,width,height)}function genC(t){let e=8;return("#fbbb00"==t||"#F0C4B0"==t)&&(e=4),rC=color(hue(t)+randomGaussian()*(e/2),saturation(t)+abs(randomGaussian())*e,brightness(t)+abs(randomGaussian())*e,100)}function dC(t,e){for(let $=0;$<e;$++){start=-.5+1*($/e)+random(-.15,.15),end=this.start+.08,steps=floor(random(5,10)),increm=abs(this.end-this.start)/this.steps,c=random(clrs),dx=art.width/31,dy=art.height/31;for(let i=start;i<end;i+=increm){let s=random(1e3),r=genC(random(clrs));for(let o=0;o<31;o++){s+=.03,yoff=100*start;for(let a=0;a<31;a++){let n=t[o][a]-i,l=t[o+1][a]-i,f=t[o+1][a+1]-i,_=t[o][a+1]-i,m=o*dx,u=a*dy,p=createVector(m+dx*n/(n-l),u),g=createVector(m+dx,u+dy*l/(l-f)),d=createVector(m+dx*(1-f/(f-_)),u+dy),v=createVector(m,u+dy*(1-_/(_-n)));switch(st=map(noise(s,yoff),0,1,-5,10)*dx*.1,art.strokeWeight(st),art.stroke(r),state=gS(n,l,f,_)){case 1:case 14:dL(d,v);break;case 2:case 13:dL(g,d);break;case 3:case 12:dL(g,v);break;case 4:case 11:dL(p,g);break;case 5:dL(p,v),dL(g,d);break;case 6:case 9:dL(p,d);break;case 7:case 8:dL(p,v);break;case 10:dL(p,g),dL(d,v)}yoff+=.03}}}}}function dL(t,e){art.line(t.x,t.y,e.x,e.y)}function gS(t,e,$,i){return(t>0?8:0)+(e>0?4:0)+($>0?2:0)+(i>0?1:0)}function pB(){(pg=createGraphics(dims[0],dims[1],WEBGL)).setAttributes("premultipliedAlph",!1),pg.pixelDensity(1),pg.setAttributes("antialias",!0),pg.rectMode(CENTER),pg.background(0),pg.noFill(),pg.stroke(255),pg.push(),pg.rotate(random(.17,.33)*PI);let t=pg.width*random(.25,.75),e=pg.width*random(.04,.07),$=pg.width*random(.05,.1);pg.ellipse(0,0,$,$),pg.rect(0,0,t,e),pg.pop()}function tB(){let t=[];for(let e=0;e<dims[0];e++)for(let $=0;$<dims[1];$++){let i=pg.get(e,$),s=0==i[0]?0:255,r=0==i[1]?0:255,o=0==i[2]?0:255;t.push(s),t.push(r),t.push(o),t.push(255)}let a=[];Fourier.transform(t,a);let n=[],l=0;for(let f=0;f<a.length;f++){let _=log(abs(a[f].magnitude()));_>l&&(l=_),n.push(_)}dx=width/dims[0],dy=height/dims[1];let m=random([.025,.05,.08]),u=random([.025,.05,.08]);noiseDetail(8,.3),nsc=.25;let p=random(1e3);for(let g=0;g<dims[0];g++){field[g]=[],p+=m;let d=0;for(let v=0;v<dims[1];v++){let h=map(noise(p,d),0,1,-1,1),b=map(n[dims[1]*g+v],0,l,-1,1);field[g][v]=b<-1e4?h:b+nsc*h,d+=u}}field[0][0]=(field[1][0]+field[0][1])/2}var Fourier=function(){function t(t){return new e(cos(t),sin(t))}function e(t,e){this.real=t,this.imag=e}return e.prototype.magnitude2=function(){return this.real*this.real+this.imag*this.imag},e.prototype.magnitude=function(){return sqrt(this.magnitude2())},e.prototype.plus=function(t){return new e(this.real+t.real,this.imag+t.imag)},e.prototype.minus=function(t){return new e(this.real-t.real,this.imag-t.imag)},e.prototype.times=function(t){if("object"!=typeof t)return new e(t*this.real,t*this.imag);var $=this.real*t.real-this.imag*t.imag,i=this.real*t.imag+this.imag*t.real;return new e($,i)},{Complex:e,transform:function $(i,s){(function $(i,s,r,o,a,n){if(1===a)i[s]=new e(r[o],0);else{$(i,s,r,o,a/2,2*n),$(i,s+a/2,r,o+n,a/2,2*n);for(var l=0;l<a/2;l++){var f=t(-2*PI*l/a),_=i[s+l];i[s+l]=_.plus(f.times(i[s+l+a/2])),i[s+l+a/2]=_.minus(f.times(i[s+l+a/2]))}}})(s,0,i,0,i.length,1)}}}();