memoscan
← all memos

Memo 0xb77ee309…d63650 on Ethereum

const shadersSource = {"cy_display":{"frag":"precision mediump float;uniform vec2 u_resolution;uniform sampler2D u_texture;void main(){gl_FragColor=vec4(texture2D(u_texture,gl_FragCoord.st/u_resolution).rgb,1.);}"},"cy_distort":{"frag":"#extension GL_OES_standard_derivatives:enable\nprecision highp float;uniform sampler2D u_texture;uniform vec2 u_resolution,u_offset;uniform vec3 u_color;uniform float u_time,u_amount,u_freq,u_r[6];const vec3 i=vec3(0.),j=vec3(1.);vec2 k(vec2 d,float a){float b=sin(a),c=cos(a);mat2 e=mat2(c,-b,b,c);return e*d;}float g(float b,float c,float d){float a=mod((b+d)*c,1.);a=cos(a*3.141593*2.)*.5+.5;return a;}float l(float b,float c,float d){float a=mod((b+d)*c,1.);a=abs(a-.5)*2.;return a;}vec2 m(vec2 a){float b=l(a.y,u_freq,0.);return mod(a+vec2(0.,b*u_amount)+vec2(u_r[1],u_r[0])+u_offset,vec2(1.));}float o(vec2 a,float b){float d=sin(b)*.5+.5,e=cos(b)*.5+.5,c=clamp(length(vec2(a.x-d,a.y-e)),0.,1.);c=smoothstep(0.,1.,c);return 1.-c;}float p(float d,float c){float a=c,b=c,e=pow(a+b,a+b)/(pow(a,a)*pow(b,b));return e*pow(d,a)*pow(1.-d,b);}vec3 h(vec3 c,vec3 d,float e){const mat3 a=mat3(.412166,.211859,.08831,.536275,.680719,.281847,.051458,.107407,.630261),q=mat3(4.076725,-1.268144,-.004112,-3.307217,2.609332,-.703476,.230759,-.341134,1.706863);vec3 f=pow(a*c,vec3(.333333)),n=pow(a*d,vec3(.333333)),b=mix(f,n,e);return q*(b*b*b);}float r(float b){vec2 a=gl_FragCoord.xy/u_resolution.xy-.5+vec2(.015,0.);a=a*vec2(.95,.95)+.5,a*=1.-a;return pow(a.x*a.y*12.,b+.1);}void main(){float e=u_time*.2;vec3 f=u_color;vec2 a=gl_FragCoord.xy/u_resolution.xy;vec3 c=texture2D(u_texture,m(a)).rgb;float b[4];b[0]=p(mod(a.y,1.),1.5),b[1]=o(a,0.),b[2]=g(k(a,g(a.y,.2,e*-.1)).x,1.,e*.5)*.7+.3,b[3]=g(k(a,g(a.x,.2,(1.57+e)*.1)).y,1.,e*.5)*.7+.3;vec3 d=i;d+=c.r*.8*h(f,j,b[3]),d+=c.g*.8*h(f,j,b[2]),d-=(1.-c.r-c.b-c.g)*h(f,i,b[1])*.3,d*=h(1.-f,j,r(.1)*1.3),gl_FragColor=vec4(d,1.);}"},"cy_feedback":{"frag":"#extension GL_OES_standard_derivatives:enable\nprecision highp float;uniform sampler2D u_original,u_loop;uniform vec3 u_opacity;uniform vec2 u_resolution,u_scale,u_offset;uniform float u_time,u_brightness,u_contrast,u_random,u_r[8];vec3 j(vec3 a,float b,float c){return (a-.5)*c+.5+b;}vec3 h(vec2 a,vec2 c,sampler2D d){vec3 b=vec3(0.);b+=texture2D(d,c+vec2(-1.*a.x,0.*a.y)).rgb,b+=texture2D(d,c+vec2(0.*a.x,-1.*a.y)).rgb,b+=texture2D(d,c+vec2(0.*a.x,0.*a.y)).rgb,b+=texture2D(d,c+vec2(0.*a.x,1.*a.y)).rgb,b+=texture2D(d,c+vec2(1.*a.x,0.*a.y)).rgb,b*=.2;return b;}float i(vec2 a,float b){float c=length(vec2(a.x+.25-(cos(b)*.5+.5)*1.5,a.y+.25-(sin(b)*.5+.5)*1.5));return clamp(1.-smoothstep(0.,1.,c),0.,1.);}float k(float c,float b,float a){a=abs(a-c);if(a>b)return 0.;a/=b;return 1.-a*a*(3.-2.*a);}void main(){float b=u_time;vec2 a=gl_FragCoord.st/u_resolution,e=1./u_resolution;float f=clamp(u_resolution.y/742.,1.,2.);vec2 c=a;c-=.5,c*=u_scale,c+=u_offset*e*f*k(cos(b*.2)*.5+.5,(cos(b*.5)*.5+.5)*.3+.3,a.x),c+=.5;vec3 g=h(e*f,c,u_loop).rgb*(u_opacity+vec3(u_r[2],u_r[3],u_r[4]));float l=cos(a.x*3.14+b*35.)*-.05,m=i(a,u_random+b*.2);g=j(g,u_brightness+u_r[0]+u_r[5]*(m+l),u_contrast+u_r[1]);float d=abs(a.x-.5)*abs(a.x-.5);d=d*.25+.22;float n=cos(a.x*6.28*u_r[7])*.5+.5;d-=n*.1*u_r[6],gl_FragColor=vec4(mix(g,texture2D(u_original,a).rgb,vec3(d)),1.);}"},"cy_noise":{"frag":"precision mediump float;uniform vec2 u_resolution;vec2 d(vec2 b){vec3 a=fract(vec3(b.xyx)*vec3(.1031,.103,.0973));a+=dot(a,a.yzx+33.33);return fract((a.xx+a.yz)*a.zy);}float e(vec2 a){const vec2 c=1.-vec2(.754878,.56984);vec2 b=floor(a/4.);float f=mod(b.x+b.y,2.);a=mix(a,a.yx,f);float g=fract(dot(c,a)+d(b).x);return g;}void main(){vec2 a=gl_FragCoord.xy/u_resolution.xy*vec2(u_resolution.x/u_resolution.y,1.)*u_resolution.x*2.;gl_FragColor=vec4(vec3(e(a)*.1+.5),1.);}"},"cy_post":{"frag":"precision mediump float;uniform vec2 u_resolution;uniform sampler2D u_texture,u_noise;uniform vec3 u_color;float e(float a,float b){return a<.5?2.*a*b:1.-2.*(1.-a)*(1.-b);}vec3 g(vec3 a,vec3 b){return vec3(e(a.r,b.r),e(a.g,b.g),e(a.b,b.b));}vec3 h(vec3 a,vec3 c,float b){return g(a,c)*b+a*(1.-b);}float i(float a){return (a-1.)*-1.;}float j(vec2 a){a=(a-.5)*vec2(.97,.97)+.5,a*=1.-a;return i(pow(a.x*a.y*12.,.1)*1.2)*.5;}vec3 f(vec2 a,vec2 c,sampler2D d){vec3 b=vec3(0.);b+=texture2D(d,c+vec2(-1.*a.x,0.*a.y)).rgb,b+=texture2D(d,c+vec2(0.*a.x,-1.*a.y)).rgb,b+=texture2D(d,c+vec2(0.*a.x,0.*a.y)).rgb,b+=texture2D(d,c+vec2(0.*a.x,1.*a.y)).rgb,b+=texture2D(d,c+vec2(1.*a.x,0.*a.y)).rgb,b*=.2;return b;}float k(float b,float a){a=min(.99999,max(1e-5,a));return b<=.5?pow(2.*b,1./(1.-a))/2.:1.-pow(2.*(1.-b),1./(1.-a))/2.;}void main(){vec2 b=gl_FragCoord.st/u_resolution,c=1./u_resolution;vec3 a=f(c,b,u_texture);a.r=mix(a.r,smoothstep(0.,1.,a.r),.5),a.g=mix(a.g,smoothstep(0.,1.,a.g),.5),a.b=mix(a.b,smoothstep(0.,1.,a.b),.5);float d=dot(texture2D(u_noise,b).rgb,vec3(.299,.587,.114));a=h(a,vec3(k(d,.126)),1.),a=max(a,j(b)*u_color),gl_FragColor=vec4(a,1.);}"}}; (()=>{"use strict";function r(t,e,s){return e in t?Object.defineProperty(t,e,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[e]=s,t}class t{constructor(t,e,s,a){r(this,"draw",()=>(this.i={striped:0,piece:0,side:0},this.ctx.fillStyle=this.background,this.ctx.fillRect(0,0,this.width,this.height),this.drawGrid(this.drawStyle),this.canvas)),r(this,"afh",(t,e)=>!!e&&Math.abs(-1*Math.asin((t/.5-e)/e))),r(this,"afw",(t,e)=>!!e&&Math.abs(-1*Math.acos((t/.5-e)/e))),r(this,"drawGrid",(s,t={x:0,y:0,w:this.width,h:this.height,i:0})=>{const a={...this.grid,steps:{x:12,y:12},module:{w:t.w/12,h:t.h/12},data:this.grid.data};a.fullflip&&("y"===a.fullflip&&(a.data=a.data.map(t=>({...t,y:12-t.y,h:-1*t.h,padding:{x:t.padding.x,y:-1*t.padding.y}}))),"x"===a.fullflip&&(a.data=a.data.map(t=>({...t,x:12-t.x,w:-1*t.w,padding:{x:-1*t.padding.x,y:t.padding.y}})))),a.data.forEach(t=>{var e=t.padding||{x:0,y:0};s({m:{w:Math.abs(t.w),h:Math.abs(t.h),x:t.x,y:t.y,class:t.class,label:t.label||"module"},x:t.x*a.module.w,y:t.y*a.module.h,w:(t.w-e.x)*a.module.w,h:(t.h-e.y)*a.module.h})})}),r(this,"drawStyle",(t={m:null,x:0,y:0,w:this.width,h:this.height})=>{const e={};t={...t,hasClass:e=>!!t.m.class&&t.m.class.some(t=>t==e)},this.each(t),e.angle="function"==typeof this.style.angle?this.style.angle(t):this.style.angle,e.padding={top:this.style.padding("top"),left:this.style.padding("left"),right:this.style.padding("right"),bottom:this.style.padding("bottom")},e.extension=this.style.extension(),e.position=t,e.variations=this.style.variations||{type:"none"},"function"==typeof this.style.background&&(e.backgroundColor=this.style.background(),e.backgroundColor&&(this.ctx.fillStyle=e.backgroundColor,this.ctx.fillRect(e.position.x,e.position.y,e.position.w,e.position.h)));var s=this._getPointsOnCircle(e.angle,e.padding,e.position);this.i.side=0,this.i.piece++;for(const a in s.rect)this.i.side++,e.start=s.rect[a].start[e.extension[a].start],e.end=s.rect[a].end[e.extension[a].end],"stripes"===e.variations.type&&e.variations.density(t)&&this._drawRectStripedByCoords(e.start,e.end)||this._drawRectFillByCoords(e.start,e.end);this.debug&&this._drawDebugRect(s.bounds.tl.x,s.bounds.tl.y,s.bounds.width,s.bounds.height)}),r(this,"_drawRectStripedByCoords",(t,e)=>{const i=this.ctx,r=this.style.variations,l={w:e[0].x>t[0].x?e[0].x-t[0].x:t[0].x-e[0].x,h:e[1].y>t[1].y?e[1].y-t[1].y:t[1].y-e[1].y,x:(e[0].x<t[0].x?e:t)[0].x,y:(e[1].y<t[1].y?e:t)[1].y};let o=this.style.palette();if(o="function"==typeof this.style.variations.color?this.style.variations.color():o,o){this.i.striped++,i.fillStyle=o,i.strokeStyle=i.fillStyle;let e,t,s=r.spacing?r.spacing():10,a=r.thickness?r.thickness({spacing:s}):5;if("horizontal"==r.orientation){s=Math.max(2,Math.floor(s*this.vw*.12)),a=Math.max(1,Math.floor(a*this.vw*.12)),e=Math.floor(l.w/s),t=l.w-e*s,s+=0<t?t/e:0;for(let t=0;t<e;t++)i.fillRect(l.x+s*t,l.y,a,l.h),i.strokeRect(l.x+s*t,l.y,a,l.h)}return!0}}),r(this,"_drawRectFillByCoords",(t,e,s=0)=>{var a=e[0].x-t[0].x,i=e[1].y-t[1].y;if(this.hideTinyRect&&(Math.abs(a)<5||Math.abs(i))<5)return!1;var r="function"==typeof this.style.palette&&this.style.palette();if(r){const l=this.ctx;l.fillStyle=r;e="function"==typeof this.style.gradient&&this.style.gradient();if(e){const o=l.createLinearGradient(t[0].x,t[1].y,t[0].x+a,t[1].y);o.addColorStop(0,r),o.addColorStop(1,e),l.fillStyle=o}l.strokeStyle=l.fillStyle,l.fillRect(t[0].x,t[1].y,a,i),l.strokeRect(t[0].x,t[1].y,a,i)}}),r(this,"_drawDebugRect",(t,e,s,a)=>{const i=this.ctx;i.strokeStyle="rgb(110, 110, 110)",i.strokeRect(t,e,s,a),i.beginPath(),i.moveTo(t,e),i.lineTo(s+t,a+e),i.moveTo(s+t,e),i.lineTo(t,a+e),i.stroke()}),r(this,"_getPointsOnCircle",(t,e={top:0,right:0,bottom:0,left:0},s={x:0,y:0,w:this.width,h:this.height})=>{const a=s.w,i=s.h,r=s.x,l=s.y,o=[];o[0]={x:.5*(a*Math.cos(-t)+a),y:.5*(i*Math.sin(-t)+i)},o[1]={x:a-o[0].x,y:o[0].y},o[2]={x:o[0].x,y:i-o[0].y},o[3]={x:a-o[0].x,y:i-o[0].y},o[4]={x:.5*(a*Math.cos(0)+a),y:.5*(i*Math.sin(3.14)+i)},o[5]={x:.5*(a*Math.cos(3.14)+a),y:.5*(i*Math.sin(3.14)+i)},o[6]={x:.5*(a*Math.cos(4.71)+a),y:.5*(i*Math.sin(4.71)+i)},o[7]={x:.5*(a*Math.cos(1.57)+a),y:.5*(i*Math.sin(1.57)+i)};const n={top:e.top?o[0].y:0,right:e.right?o[0].x:0,bottom:e.bottom?o[0].y:0,left:e.left?o[0].x:0},d=a/(a+n.right+n.left),c=i/(i+n.bottom+n.top),h=n.left||0,u=n.top||0;n.top*=c,n.bottom*=c,n.right*=d,n.left*=d;const p=n.left+r,m=n.top+l,b=a*d,y=i*c,f=o.map(t=>({x:(h+t.x)*d,y:(u+t.y)*c})).map(t=>({x:t.x+=r,y:t.y+=l}));f[8]={x:p-n.left,y:m-n.top},f[9]={x:p+b+n.right,y:m-n.top},f[10]={x:p-n.left,y:m+y+n.bottom},f[11]={x:p+b+n.right,y:m+y+n.bottom};const g={};return g.circle={tl:f[0],tr:f[1],bl:f[2],br:f[3],top:f[6],right:f[4],left:f[5],bottom:f[7],width:f[4].x-f[5].x,height:f[7].y-f[6].y},g.bounds={tl:f[8],tr:f[9],bl:f[10],br:f[11],top:{x:g.circle.top.x,y:f[8].y},right:{x:f[8].x,y:g.circle.right.y},left:{x:f[5].x,y:g.circle.left.y},bottom:{x:g.circle.bottom.x,y:f[10].y},width:f[9].x-f[8].x,height:f[11].y-f[9].y},g.rect={},g.rect.top={start:[[g.circle.tl,{x:g.circle.tl.x,y:g.bounds.tl.y}],[{x:g.bounds.tl.x,y:g.circle.tl.y},g.bounds.tl]],end:[[{x:g.circle.tr.x,y:g.bounds.top.y},g.circle.tr],[g.bounds.tr,{x:g.bounds.tr.x,y:g.circle.tr.y}]]},g.rect.bottom={start:[[{x:g.circle.bl.x,y:g.bounds.bl.y},g.circle.bl],[g.bounds.bl,{x:g.bounds.bl.x,y:g.circle.bl.y}]],end:[[g.circle.br,{x:g.circle.br.x,y:g.bounds.br.y}],[{x:g.bounds.br.x,y:g.circle.bottom.y},g.bo