0x18b75119…b783sent to0x381233d5…7acd·#19,594,914·view on Etherscan
[0,()=>{console.log("Artist 38. Florian Zumbrunn -- platform 0");
const fzr = () => { return R.random_dec() }
class At{constructor(){this._entities=[]}add(n){if(typeof n!="function")throw new Error("Entity must be a function");this._entities.push(n)}remove(n){const o=this._entities.indexOf(n);o!==-1&&this._entities.splice(o,1)}dispatch(...n){for(const o of this._entities)typeof o=="function"?o(...n):console.error("Event: dispatch: entity is not a function")}clear(){this._entities=[]}dispose(){this._entities=null}}const e={id:"bmfloz",screen:{width:0,height:0},size:{width:2160,height:3840},onRender:new At,rand:null},W=[];function rt(){e.screen.width=window.innerWidth,e.screen.height=window.innerHeight;for(const t of W)t()}window.addEventListener("resize",rt,!1);window.addEventListener("orientationchange",rt,!1);rt();const Rt={add:t=>{W.push(t)},remove:t=>{const n=W.indexOf(t);n!==-1&&W.splice(n,1)}};function Et(t,n="center"){t.style.boxShadow="0 0 10px rgba(0,0,0,0.5)",t.style.position="absolute";function o(){let{width:r,height:i}=e.screen;r=Math.min(e.size.width,r),i=Math.min(e.size.height,i),r=r,i=i;let a=t.width,s=t.height;if(e.screen.height<t.height){let v=a/s;s=i,a=i*v,a>r&&(v=s/a,a=r,s=r*v)}else{let v=s/a;a=r,s=r*v,s>i&&(v=a/s,s=i,a=i*v)}t.style.height=s+"px",t.style.width=a+"px"}Rt.add(o),o()}const ot=(t,n,o)=>{const r=t.createShader(n);if(t.shaderSource(r,o),t.compileShader(r),t.getShaderParameter(r,t.COMPILE_STATUS))return r;console.warn(t.getShaderInfoLog(r))},Pt=(t,n,o)=>{const r=t.createProgram();t.attachShader(r,n),t.attachShader(r,o),t.linkProgram(r);var i=t.getProgramParameter(r,t.LINK_STATUS);if(i)return r;console.warn(t.getProgramInfoLog(r)),t.deleteProgram(r)},ft=(t,n,o)=>{const r=ot(t,t.VERTEX_SHADER,n),i=ot(t,t.FRAGMENT_SHADER,o);return{vert:r,frag:i,program:Pt(t,r,i)}};function gt(t,n,o){const r=t.createTexture();t.bindTexture(e.glt2,r),t.texImage2D(e.glt2,0,t.RGBA,n,o,0,t.RGBA,t.UNSIGNED_BYTE,null),t.texParameteri(e.glt2,e.gltmi,t.LINEAR),t.texParameteri(e.glt2,e.gltma,t.LINEAR),t.texParameteri(e.glt2,e.gltws,t.CLAMP_TO_EDGE),t.texParameteri(e.glt2,e.gltwt,t.CLAMP_TO_EDGE);const i=t.createFramebuffer();return t.bindFramebuffer(e.glfb,i),t.framebufferTexture2D(e.glfb,t.COLOR_ATTACHMENT0,e.glt2,r,0),t.bindFramebuffer(e.glfb,null),{framebuffer:i,texture:r}}let nt=e.rand;function Ut(){nt=e.rand}function Mt(t){return t!=0?t<0?-1:1:0}function Ft(){return St()?1:-1}function St(){return nt()>.5}function O(t,n,o){if(t==n)return t;const r=nt()*(n-t)+t;return Lt(r,t,n,o)}function Lt(t,n,o,r){const i=Mt(t);return r=Math.abs(r),t=(t-n)/(o-n),t=i>0?t:t-1,t=Math.pow(t*i,Math.abs(r)),t=i>0?t:1-t,t*(o-n)+n}function $(t){return t=t.replace(/_f/g,"float"),t=t.replace(/_v2/g,"vec2"),t=t.replace(/_v3/g,"vec3"),t=t.replace(/_v4/g,"vec4"),t=t.replace(/_s2/g,"sampler2D"),t=t.replace(/_t/g,"texture2D"),t=t.replace(/_v/g,"varying"),t=t.replace(/_u/g,"uniform"),t=t.replace(/_a/g,"attribute"),t=t.replace(/_smst/g,"smoothstep"),t=t.replace(/_re/g,"return"),t}let C=null,K=null,Z=null,J=null;const j=5e4;function Bt(t){const n=$(`
precision mediump _f;
_a _v2 avp;
_a _v3 ao;
_a _v3 ac;
_v _v3 vc;
void main() {
_v2 pos = avp.xy;
pos += ao.xy;
vc = ac;
gl_Position = vec4( pos.xy, ao.z, 1.0 );
}`),o=$(`
precision mediump _f;
_v _v3 vc;
void main() {
gl_FragColor = vec4( vc, 1. );
}`);C=ft(t,n,o).program;let i=null,a=null;const s=()=>{const u=p(j);i=u.vertices,K=t.createBuffer(),t.bindBuffer(t.ARRAY_BUFFER,K),t.bufferData(t.ARRAY_BUFFER,i,t.STATIC_DRAW),Z=t.createBuffer(),t.bindBuffer(t.ARRAY_BUFFER,Z),t.bufferData(t.ARRAY_BUFFER,u.offsets,t.STATIC_DRAW),J=t.createBuffer(),t.bindBuffer(t.ARRAY_BUFFER,J),t.bufferData(t.ARRAY_BUFFER,u.colors,t.STATIC_DRAW)};function v(u){if(u<j*.1){const c=e.rand()*10+12+O(0,10,5),_=e.rand()*2-1;return{x:_,y:e.rand()*.5-.5-O(0,.025,5)+Math.sin(_*2.1)*.035,z:e.rand()*-1,w:c*e.rand()*2,h:c*.25+e.rand()*c*.25}}else if(u<j*.2){const c=e.rand()*10+10+O(0,35,5),_=e.rand()*2-1;return{x:_,y:e.rand()*1.8-.7+Math.sin(_*2.1)*.035,z:e.rand()*1,w:c*2*e.rand(),h:c*.25+e.rand()*c*.25}}else{const c=e.rand()*15+20+O(0,35,5),_=e.rand()*2-1;return{x:_,y:e.rand()*1.8-.65-O(0,Math.cos(_)*.05,2)+Math.sin(_*1.1)*.035,z:e.rand()*1,w:c*1.5,h:c*.2+e.rand()*c*.75}}}function p(u){const c=[[.984313725490196,.9372549019607843,.9764705882352941],[.9725490196078431,.7215686274509804,.9333333333333333],[.9176470588235294,.8509803921568627,.9058823529411765],[.984313725490196,.5137254901960784,.9137254901960784],[1,.984313725490196,.996078431372549],[.9764705882352941,.47058823529411764,.7803921568627451],[.996078431372549,.984313725490196,1],[.9921568627450981,.8666666666666667,.9607843137254902],[.8274509803921568,.9450980392156862,.7019607843137254],[.984313725490196,.9372549019607843,.9764705882352941],[.9725490196078431,.7215686274509804,.9333333333333333],[.9176470588235294,.8509803921568627,.9058823529411765],[.984313725490196,.5137254901960784,.9137254901960784],[1,.984313725490196,.996078431372549],[.8274509803921568,.9450980392156862,.7019607843137254],[.5843137254901961,.4196078431372549,.4627450980392157],[.2196078431372549,.14901960784313725,.16470588235294117],[.32941176470588235,.6431372549019608,.24705882352941178],[.25882352941176473,.6784313725490196,.8352941176470589],[.9490196078431372,.8980392156862745,.9215686274509803]],_=6,l=_*2,h=_*3;a=new Float32Array(u*l);const T=new Float32Array(u*h),P=new Float32Array(u*h);for(let x=0;x<u;x++){const y=x*l,A=x*h,{x:g,y:b,z,w:U,h:V}=v(x),w=U/e.size.width,m=V/e.size.height,F=[-w,-m,w,-m,-w,m,-w,m,w,-m,w,m],d=[g,b,z],I=[...d,...d,...d,...d,...d,...d],S=c[e.rand()*c.length>>0],Tt=[...S,...S,...S,...S,...S,...S];a.set(F,y),T.set(I,A),P.set(Tt,A)}return{vertices:a,offsets:T,colors:P}}s()}function Dt(t){t.useProgram(C);const n=t.getAttribLocation(C,"avp");t.bindBuffer(t.ARRAY_BUFFER,K),t.vertexAttribPointer(n,2,t.FLOAT,!1,0,0),t.enableVertexAttribArray(n);const o=t.getAttribLocation(C,"ao");t.bindBuffer(t.ARRAY_BUFFER,Z),t.vertexAttribPointer(o,3,t.FLOAT,!1,0,0),t.enableVertexAttribArray(o);const r=t.getAttribLocation(C,"ac");t.bindBuffer(t.ARRAY_BUFFER,J),t.vertexAttribPointer(r,3,t.FLOAT,!1,0,0),t.enableVertexAttribArray(r);const i=t.getUniformLocation(C,"uc");t.uniform4f(i,1,0,1,1);const a=t.getUniformLocation(C,"ur");t.uniform1f(a,e.size.width/e.size.height),t.drawArrays(t.TRIANGLES,0,6*j)}function Vt(t){return t*t*t}function it(t){const n=t-1;return n*n*n+1}function vt(t){this.p=new Uint8Array(256),this.perm=new Uint8Array(512),this.permMod12=new Uint8Array(512);for(var n=0;256>n;n++)this.p[n]=256*e.rand();for(n=0;512>n;n++)this.perm[n]=this.p[255&n],this.permMod12[n]=this.perm[n]%12}var It=.5*(Math.sqrt(3)-1),Y=(3-Math.sqrt(3))/6;vt.prototype={grad3:new Float32Array([1,1,0,-1,1,0,1,-1,0,-1,-1,0,1,0,1,-1,0,1,1,0,-1,-1,0,-1,0,1,1,0,-1,1,0,1,-1,0,-1,-1]),noise2D:function(t,n){var o,r,i=this.permMod12,a=this.perm,s=this.grad3,v=0,p=0,u=0,c=(t+n)*It,_=Math.floor(t+c),l=Math.floor(n+c),h=(_+l)*Y,T=_-h,P=l-h,x=t-T,y=n-P;x>y?(o=1,r=0):(o=0,r=1);var A=x-o+Y,g=y-r+Y,b=x-1+2*Y,z=y-1+2*Y,U=255&_,V=255&l,w=.5-x*x-y*y;if(w>=0){var m=3*i[U+a[V]];w*=w,v=w*w*(s[m]*x+s[m+1]*y)}var F=.5-A*A-g*g;if(F>=0){var d=3*i[U+o+a[V+r]];F*=F,p=F*F*(s[d]*A+s[d+1]*g)}var I=.5-b*b-z*z;if(I>=0){var S=3*i[U+1+a[V+1]];I*=I,u=I*I*(s[S]*b+s[S+1]*z)}return 70*(v+p+u)}};let st=null;const ut=(t=e.rand)=>(st=new vt,st);function G(t,n,{rad:o=50,radVar:r=5,radReduction:i=.4,offsetX:a=0,offsetY:s=0,aOrigin:v=Math.PI*.5,color:p="#f0f"}={}){let u=n[0].x,c=n[0].y,_=u+Math.cos(v+Math.PI*.5)*o,l=c+Math.sin(v+Math.PI*.5)*o,h=u+Math.cos(v-Math.PI*.5)*o,T=c+Math.sin(v-Math.PI*.5)*o,P,x,y,A=0;const g=n.length;for(let b=1;b<g;b++){const{x:z,y:U}=n[b],V=u-z,w=c-U,m=Math.atan2(w,V),F=Vt(b/g);let d=o+e.rand()*r;d*=1-i*F,b==1&&(_+=Math.cos(m+Math.PI*.5)*d,l+=Math.sin(m+Math.PI*.5)*d,h+=Math.cos(m-Math.PI*.5)*d,T+=Math.sin(m-Math.PI*.5)*d),P=z+Math.cos(m+Math.PI*.5)*d,y=U+Math.sin(m+Math.PI*.5)*d,x=z+Math.cos(m-Math.PI*.5)*d,A=U+Math.sin(m-Math.PI*.5)*d,t.fillStyle=p,t.strokeStyle=p,t.beginPath(),t.moveTo(a+_,s+l),t.lineTo(a+P,s+y),t.lineTo(a+x,s+A),t.lineTo(a+h,s+T),t.stroke(),t.fill(),t.closePath(),_=P,l=y,h=x,T=A,u=z,c=U}}const L=document.createElement("canvas");L.width=e.size.width;L.height=e.size.height;L.style.width=`${e.size.width}px`;L.style.height=`${e.size.height}px`;const M=L.getContext("2d");let H=[],at=0,tt=null,B=null;function Ct(t){const n=t.vertices;let o=t.a;const r=e.rand()*10+10,i=10*e.rand()+30>>0;let a=t.x,s=t.y;for(let v=0;v<i;v++){a+=Math.cos(o)*r,s+=Math.sin(o)*r;const p=tt.noise2D(a*.001,s*(8e-4+e.rand()*.01))*Math.PI*.1;o+=p,n.push({x:a,y:s})}}function Nt(){tt=ut(),at=20+e.rand()*10>>0;const t=[110,50,20,10,5];for(let n=0;n<at;n++){const o=[],r=[],i=e.rand()*5>>0,a=e.size.height-i*(200*it(1-i/5))+50,s=1-i/5;let v=t[i]+e.rand()*10;const p={x:e.rand()*(e.size.width+400)-200,y:a,z:it(s),rad:v,vertices:o,branches:r,layer:i};H.push(p);let u=20,c=p.x,_=p.y,l=0;const h=e.size.height/u;for(;;){const T=l/h,P=c,x=_;c+=tt.noise2D(c*.001,_*8e-4)*(10*T),_-=u;const y=c-P,A=_-x,g=Math.atan2(A,y);if(T>.2&&r.length<20&&e.rand()<.315*T){const b=Ft(),z={x:c,y:_,a:g+b*Math.PI*.5+e.rand()*Math.PI*.4*-b,rad:v*(.4+e.rand()*.1),vertices:[]};r.push(z),Ct(z)}if(o.push({x:c,y:_}),l++,_<0)break}}H=H.sort((n,o)=>o.layer-n.layer)}function Ot(){M.fillStyle="#57aff2",M.fillRect(0,0,L.width,L.height)}function Gt(){for(const t of H){const n=t.rad,o=t.vertices;G(M,o,{rad:n*t.z,color:"#281a17"}),G(M,o,{rad:n*t.z*.7,offsetX:5,color:"#311f2f"}),G(M,o,{rad:n*t.z*.3,offsetX:10,color:"#47461c"});for(const r of t.branches){const i=r.vertices;G(M,i,{rad:r.rad*t.z,radReduction:.8,color:"#281a17"}),G(M,i,{rad:r.rad*t.z*.3,offsetY:10,radReduction:.8,color:"#47461c"})}}}let D=[],dt=[];function Yt(){B=ut();const t=10,n=(e.size.width+200)/t;let o=-100,r=150-60,i=[];D.push({rad:400,color:"#2a5543",vertices:i});for(let s=0;s<11;s++)i.push({x:o,y:e.size.height-r}),r+=B.noise2D(o*.001,r*1e-4)*10,o+=n;i=[],o=-100,r=200-60,D.push({rad:400,color:"#404043",vertices:i});for(let s=0;s<12;s++)i.push({x:o,y:e.size.height-r+100}),r+=B.noise2D(o*.001,r*1e-4)*10,o+=n;i=[],o=-300,r=200-60,D.push({rad:200,color:"#45844b",vertices:i});for(let s=0;s<12;s++)i.push({x:o,y:e.size.height-r}),r+=B.noise2D(o*.1,r*.01)*50,o+=n;i=[],o=-200,r=200-60,D.push({rad:100,color:"#3e782d",vertices:i});for(let s=0;s<12;s++)i.push({x:o,y:e.size.height-r}),r+=B.noise2D(o*.01,r*.01)*20,o+=n;i=[],o=-200,r=50-60,D.push({rad:100,color:"#748630",vertices:i});for(let s=0;s<6;s++)i.push({x:o,y:e.size.height-r-100}),r+=B.noise2D(o*.01,r*.01)*50,o+=n;i=[],o=800,r=100-60,D.push({rad:50,color:"#748630",vertices:i});for(let s=0;s<8;s++)i.push({x:o,y:e.size.height-r-100}),r+=B.noise2D(o*.01,r*.01)*50,o+=n;i=[],o=-100,r=50-60,D.push({rad:50,color:"#226f42",vertices:i});for(let s=0;s<12;s++)i.push({x:o,y:e.size.height-r+50}),r+=B.noise2D(o*.01,r*.01)*50,o+=n;const a=["#2a5543","#404043","#45844b","#3e782d","#748630","#226f42"];for(let s=0;s<200;s++){const v=e.rand()*e.size.width,p=e.size.height-e.rand()*600+50,u=e.rand()*60+10,c=u*.6,_=a[e.rand()*a.length>>0],l=e.rand()*255;dt.push({x:v,y:p,w:u,h:c,color:_,aColor:l})}}function kt(){for(const t of D)G(M,t.vertices,{rad:t.rad,color:t.color});for(const t of dt)M.fillStyle=t.color,M.fillRect(t.x,t.y,t.w,t.h)}let q=null;function Xt(t){q=t.createTexture(),t.bindTexture(e.glt2,q),t.texParameteri(e.glt2,e.gltws,t.CLAMP_TO_EDGE),t.texParameteri(e.glt2,e.gltwt,t.CLAMP_TO_EDGE),t.texParameteri(e.glt2,e.gltmi,t.LINEAR),t.texParameteri(e.glt2,e.gltma,t.LINEAR),t.texImage2D(e.glt2,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,L),t.bindTexture(e.glt2,null)}function Wt(t){return t.bindTexture(e.glt2,q),t.texImage2D(e.glt2,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,L),t.bindTexture(e.glt2,null),q}let lt=-1,xt=1,mt=.78,pt=0,ht=0,E=null,jt=$(`
precision mediump _f;
_a _v2 aPosition;
_a _v2 aUV;
_v _v2 vUV;
void main() {
vUV = aUV;
gl_Position = _v4(aPosition, 0.0, 1.0);
}
`);const Ht=$(`
#extension OES_standard_derivatives : enable
#extension GL_OES_standard_derivatives : enable
precision mediump _f;
_v3 mod289(_v3 x) {
_re x - floor(x * (1.0 / 289.0)) * 289.0;
}
_v4 mod289(_v4 x) {
_re x - floor(x * (1.0 / 289.0)) * 289.0;
}
_v4 prm(_v4 x) {
_re mod289(((x * 34.0) + 1.0) * x);
}
_v4 tis(_v4 r) {
_re 1.792 - 0.853 * r;
}
_u _s2 uTPet;
_u _s2 uTLand;
_u _f uTime;
_u _f uSeed;
_u _v2 uResolution;
_u _f uRatio;
_u _f uSV;
_v _v2 vUV;
_v2 fade(_v2 t) {_re t*t*t*(t*(t*6.0-15.0)+10.0);}
_f cns(_v2 P){
_v4 Pi = floor(P.xyxy) + _v4(0.0, 0.0, 1.0, 1.0);
_v4 Pf = fract(P.xyxy) - _v4(0.0, 0.0, 1.0, 1.0);
Pi = mod(Pi, 289.0); // To avoid truncation effects in permutation
_v4 ix = Pi.xzxz;
_v4 iy = Pi.yyww;
_v4 fx = Pf.xzxz;
_v4 fy = Pf.yyww;
_v4 i = prm(prm(ix) + iy);
_v4 gx = 2.0 * fract(i * 0.024) - 1.0; // 1/41 = 0.024...
_v4 gy = abs(gx) - 0.5;
_v4 tx = floor(gx + 0.5);
gx = gx - tx;
_v2 g00 = _v2(gx.x,gy.x);
_v2 g10 = _v2(gx.y,gy.y);
_v2 g01 = _v2(gx.z,gy.z);
_v2 g11 = _v2(gx.w,gy.w);
_v4 norm = 1.793 - 0.853 *
_v4(dot(g00, g00), dot(g01, g01), dot(g10, g10), dot(g11, g11));
g00 *= norm.x;
g01 *= norm.y;
g10 *= norm.z;
g11 *= norm.w;
_f n00 = dot(g00, _v2(fx.x, fy.x));
_f n10 = dot(g10, _v2(fx.y, fy.y));
_f n01 = dot(g01, _v2(fx.z, fy.z));
_f n11 = dot(g11, _v2(fx.w, fy.w));
_v2 fade_xy = fade(Pf.xy);
_v2 n_x = mix(_v2(n00, n01), _v2(n10, n11), fade_xy.x);
_f n_xy = mix(n_x.x, n_x.y, fade_xy.y);
_re 2.3 * n_xy;
}
_f s3mod( _v3 v, _f nb ) {
const _v2 C = _v2(1.0 / 6.0, 1.0 / 3.0);
const _v4 D = _v4(0.0, 0.5, 1.0, 2.0);
_v3 i = floor(v + dot(v, C.yyy));
_v3 x0 = v - i + dot(i, C.xxx);
_v3 g = step(x0.yzx, x0.xyz);
_v3 l = 1.0 - g;
_v3 i1 = min(g.xyz, l.zxy);
_v3 i2 = max(g.xyz, l.zxy);
_v3 x1 = x0 - i1 + C.xxx;
_v3 x2 = x0 - i2 + C.yyy;
_v3 x3 = x0 - D.yyy;
i = mod289(i);
_v4 p = prm(prm(prm(i.z + _v4(0.0, i1.z, i2.z, 1.0)) + i.y + _v4(0.0, i1.y, i2.y, 1.0)) + i.x + _v4(0.0, i1.x, i2.x, 1.0));
_v3 ns = 0.1428 * D.wyz - D.xzx;
_v4 j = p - 49.0 * floor(p * ns.z * ns.z);
_v4 x_ = floor(j * ns.z);
_v4 y_ = floor(j - 7.0 * x_);
_v4 x = x_ * ns.x + ns.yyyy;
_v4 y = y_ * ns.x + ns.yyyy;
_v4 h = 1.0 - abs(x) - abs(y);
_v4 b0 = _v4(x.xy, y.xy);
_v4 b1 = _v4(x.zw, y.zw);
_v4 s0 = floor(b0) * 2.0 + 1.0;
_v4 s1 = floor(b1) * 2.0 + 1.0;
_v4 sh = -step(h, _v4(0.));
_v4 a0 = b0.xzyw + s0.xzyw * sh.xxyy;
_v4 a1 = b1.xzyw + s1.xzyw * sh.zzww;
_v3 p0 = _v3(a0.xy, h.x);
_v3 p1 = _v3(a0.zw, h.y);
_v3 p2 = _v3(a1.xy, h.z);
_v3 p3 = _v3(a1.zw, h.w);
p0 = max(p0, _v3(0.) );
p1 = max(p1, _v3(0.) );
p2 = max(p2, _v3(0.) );
p3 = max(p3, _v3(0.) );
_v4 norm = tis(_v4(dot(p0, p0), dot(p1, p1), dot(p2, p2), dot(p3, p3)));
p0 *= norm.x;
p1 *= norm.y;
p2 *= norm.z;
p3 *= norm.w;
_f m0 = floor(abs(dot(x0, x0)) * uSV) / uSV;
_f m1 = floor(abs(dot(x1, x1)) * uSV) / uSV;
_f m2 = floor(abs(dot(x2, x2)) * uSV) / uSV;
_f m3 = floor(abs(dot(x3, x3)) * uSV) / uSV;
_v4 m = _v4( 0. );
m = max(nb - _v4(m0, m1, m2, m3), 0. );
m = ( m );
_f noise = 42. * dot(m * m, _v4(dot(p0, x0), dot(p1, x1), dot(p2, x2), dot(p3, x3)));
_re noise;
}
_v3 sv3(_v3 x, _f nb ) {
_f s = s3mod(_v3(x), nb);
_v3 c = _v3(s, s * 10., s);
_re c;
}
_v3 crl( _v3 p, _f nob ){
const _f e = .1;
_v3 dx = _v3( e , 0.0 , 0.0 );
_v3 dy = _v3( 0.0 , e , 0.0 );
_v3 dz = _v3( 0.0 , 0.0 , e );
_v3 p_x0 = sv3( p - dx, nob );
_v3 p_x1 = sv3( p + dx, nob );
_v3 p_y0 = sv3( p - dy, nob );
_v3 p_y1 = p_y0;
_v3 p_z0 = sv3( p - dz, nob );
_v3 p_z1 = p_x0;
_f x = p_y1.z - p_y0.z - p_z1.y + p_z0.y;
_f y = p_z1.x - p_z0.x - p_x1.z + p_x0.z;
_f z = p_x1.y - p_x0.y - p_y1.x + p_y0.x;
const _f divisor = 1.0 / ( 2.0 * e );
_re normalize( _v3( x , y , z ) * divisor );
}
_v4 perm(_v4 x){_re mod289(((x * 34.0) + 1.0) * x);}
_f ns(_v3 p){
_v3 a = floor(p);
_v3 d = p - a;
d = d * d * (3.0 - 2.0 * d);
_v4 b = a.xxyy + _v4(0.0, 1.0, 0.0, 1.0);
_v4 k1 = perm(b.xyxy);
_v4 k2 = perm(k1.xyxy + b.zzww);
_v4 c = k2 + a.zzzz;
_v4 k3 = perm(c);
_v4 k4 = perm(c + 1.0);
_v4 o1 = fract(k3 * (1.0 / 41.0));
_v4 o2 = fract(k4 * (1.0 / 41.0));
_v4 o3 = o2 * d.z + o1 * (1.0 - d.z);
_v2 o4 = o3.yw * d.x + o3.xz * (1.0 - d.x);
_re o4.y * d.y + o4.x * (1.0 - d.y);
}
_f grain(_v2 tc, _v2 r, _f f, _f m) {
_v2 mult = tc * r;
_f offset = ns(_v3(mult / m, f));
_f n1 = ns(_v3(mult, vUV));
_re n1 / 2.0 + 0.5;
}
_f grain(_v2 tc, _v2 r) {
_re grain(tc, r, 0., 2.5);
}
_v3 gtgrn(_f gs) {
_f gp = ns(_v3(vUV * _v2(4., 1.), 0.));
_v3 cns = _v3(grain(vUV, uResolution * gs ));
_re cns;
}
_f blo(_f ba, _f bl) {
_re ba < 0.5 ? (2.0 * ba * bl) : (1.0 - 2.0 * (1.0 - ba) * (1.0 - bl));
}
_v3 blo(_v3 ba, _v3 bl) {
_re _v3(blo(ba.r, bl.r), blo(ba.g, bl.g), blo(ba.b, bl.b));
}
_v3 blo(_v3 ba, _v3 bl, _f op) {
_re (blo(ba, bl) * op + ba * (1.0 - op));
}
_f brd( _f w ) {
_f xb = _smst( 0., w, vUV.x ) - (_smst( 1. - w, 1., vUV.x ) );
_f yb = _smst( 0., w * 9./16., vUV.y ) - (_smst( 1. - w * 9./16., 1., vUV.y ) );
_f b = xb * yb;
_re b;
}
_f brd2( _f w ) {
_f xb = step(w, vUV.x) * (1.0 - step(1.0 - w, vUV.x));
_f yb = step(w * 9.0 / 16.0, vUV.y) * (1.0 - step(1.0 - w * 9.0 / 16.0, vUV.y));
_f b = xb * yb;
_re b;
}
_v2 stdNormalMap(_f height)
{
_re -_v2(dFdx(height), dFdy(height));
}
_u _f uNbase;
void main() {
_v2 uvs = vUV;
uvs.y *= uRatio;
_f bdimp = brd( .12 + cos( uTime * .1 ) * .05);
_f bdimp2 = brd( .06 + cos( uTime * .1 ) * .05);
_v2 uvcl = vUV;
_f uvclMult = 4.;
_f seed = 32.;
_f csm = 4000. + uSeed;
_v3 cl = crl(_v3(uvcl * uvclMult * bdimp + seed * csm, 100.), uNbase + cos( uTime *.001 ) * .1);
seed += uTime * .05;
uvclMult *= cl.y;
seed += cl.x * .1 + cl.y * .01;
_v3 cl2 = cl * .1 + cl.x * 10.;
seed += uSeed;
_f cnuvm = 4.0;
_f cnsm = 1.8 - uTime * .00001;
_f cnv1 = cns( uvs * cnuvm * bdimp + _v2( ( seed ) * cnsm, 5. + 1. * bdimp + uTime * .001 ) );
_f cnv2 = cns( uvs * cnuvm + _v2( ( seed ) * cnsm + 5.2, 7.3 + uTime * .01 ) );
_f cnv = cns( _v2( cnv1, cnv2 + uTime * .1 ) ) * 5.435;
_f mult = ( 1. / 6. ) * 2.;
_v2 wu = vUV;
wu.y += uTime * .09;
wu += cnv * .1;
wu += max( cnv, cl.r ) * max( cl.g, cl.b ) * mult;
wu += max( 0., cl.g ) * max( cl2.r, cl2.b ) * mult;
_v2 wu2 = _v2( vUV.x, 1. - vUV.y );
wu2 = 1. - vUV;
wu2.x += uTime * .07 + cos( uTime * .04 ) * cl.r * .04;
wu2 -= cnv * .01;
wu2.x += max( cnv, cl.r ) * max( cl.g, cl.b) * mult;
wu2.x -= max( cnv, cl.g ) * max( cl.r, cl2.b ) * mult;
wu2.y -= max( 0., cl.r ) * max( cl.g, cl.b + uTime * .1 ) * mult * 3.;
wu = mod( wu, 1. );
wu2 = mod( wu2, 1.5 );
_v4 lnd = _t(uTLand, wu);
_v4 lnd2 = _t(uTLand, vUV * cnv1 );
_v2 uvp = wu2;
_v4 pt = _t(uTPet, uvp );
_v4 pt2 = _t(uTPet, ( 1. - vUV ) * cnv1 );
_v4 r = _v4( 0. );
r = mix( lnd, pt, pt.a );
r = mix( lnd2, r, 1. - pt2.a );
r = mix( r, pt2, pt2.a );
_v3 gn1 = gtgrn(10.);
r.rgb = mix( r.rgb,_t( uTPet,1. - vUV).rgb, ( wu2.x * wu2.y * cnv1 * 2. ) > .5 ? 1. : 0. );
r.rgb = mix( r.rgb, _v3( ( r.r + r.g + r.b ) / 3. ) * _v3( 7. /255., 137./255., 237./255.), 1. - brd2( .0125 + .008 * cl.z ) );
r.rgb = blo( r.rgb, gn1, .1 + .32 * wu2.x ); // ptet .72
_f height = ( r.r + r.g + r.b ) / 3.;
_v2 nrm = stdNormalMap( height );
nrm *= .2;
nrm += .5;
_f lt = dot(nrm, normalize(_v2( -.9, .9 )));
r.rgb += lt * .5 * .05;
gl_FragColor = r;
}
`),$t=new Float32Array([-1,-1,0,1,1,-1,1,1,-1,1,0,0,-1,1,0,0,1,-1,1,1,1,1,1,0]);let et=null;function qt(t){lt=e.rand()*100,xt=e.rand()<.5?e.size.width/e.size.height:e.size.height/e.size.width,mt=.6+O(0,2,3),pt=10+e.rand()*24,ht+=e.rand()*.004,et=t.createBuffer(),t.bindBuffer(t.ARRAY_BUFFER,et),t.bufferData(t.ARRAY_BUFFER,$t,t.STATIC_DRAW),E=ft(t,jt,Ht).program}let ct=0;function Qt(t,{texturePetals:n=null,textureLandscape:o=null,dt:r=1}={}){t.useProgram(E);const i=t.getUniformLocation(E,"uTPet");t.activeTexture(t.TEXTURE0),t.bindTexture(t.TEXTURE_2D,n),t.uniform1i(i,0);const a=t.getUniformLocation(E,"uTLand");t.activeTexture(t.TEXTURE1),t.bindTexture(t.TEXTURE_2D,o),t.uniform1i(a,1);const s=t.getUniformLocation(E,"uTime");t.uniform1f(s,ct),ct+=(.0025+ht)*r;const v=t.getUniformLocation(E,"uSeed");t.uniform1f(v,lt);const p=t.getUniformLocation(E,"uResolution");t.uniform2f(p,e.size.width,e.size.height);const u=t.getUniformLocation(E,"uRatio");t.uniform1f(u,xt);const c=t.getUniformLocation(E,"uNbase");t.uniform1f(c,mt);const _=t.getUniformLocation(E,"uSV");t.uniform1f(_,pt);const l=t.getAttribLocation(E,"aPosition"),h=t.getAttribLocation(E,"aUV");t.enableVertexAttribArray(l),t.enableVertexAttribArray(h),t.bindBuffer(t.ARRAY_BUFFER,et),t.vertexAttribPointer(l,2,t.FLOAT,!1,4*Float32Array.BYTES_PER_ELEMENT,0),t.vertexAttribPointer(h,2,t.FLOAT,!1,4*Float32Array.BYTES_PER_ELEMENT,2*Float32Array.BYTES_PER_ELEMENT),t.drawArrays(t.TRIANGLES,0,6)}const yt=[];function bt(){requestAnimationFrame(bt);for(const t of yt)t()}bt();const Kt={add:t=>{yt.push(t)}},Zt=document.querySelectorAll("canvas");for(const t of Zt)t.remove();e.rand=fzr;Ut();let N=null,f=null;const Jt=()=>{N=document.createElement("canvas"),N.width=e.size.width,N.height=e.size.height,Et(N),document.body.appendChild(N),f=N.getContext("webgl",{antialias:!0,alpha:!0}),f.getExtension("OES_standard_derivatives"),f.getExtension("GL_OES_standard_derivatives"),e.glt2=f.TEXTURE_2D,e.gltws=f.TEXTURE_WRAP_S,e.gltwt=f.TEXTURE_WRAP_T,e.gltmi=f.TEXTURE_MIN_FILTER,e.gltma=f.TEXTURE_MAG_FILTER,e.glfb=f.FRAMEBUFFER};Jt();Yt();Nt();Ot();kt();Gt();Xt(f);const te=Wt(f);let k=null,wt=null,zt=null;qt(f);Bt(f);function ee(t){f.enable(f.BLEND),f.blendFunc(f.SRC_ALPHA,f.ONE_MINUS_SRC_ALPHA),f.clearColor(0,0,0,0),f.clear(f.COLOR_BUFFER_BIT),Qt(f,{texturePetals:zt,textureLandscape:te,dt:t})}k||(k=gt(f,e.size.width,e.size.height),wt=k.framebuffer,zt=k.texture);f.bindFramebuffer(f.FRAMEBUFFER,wt);f.viewport(0,0,e.size.width,e.size.height);f.clearColor(0,0,0,0);f.clear(f.COLOR_BUFFER_BIT);Dt(f);f.bindFramebuffer(f.FRAMEBUFFER,null);const re=60,Q=1e3/re;let _t=Date.now(),X=0;Kt.add(()=>{const t=Date.now();if(X+=t-_t,_t=t,X>=Q){const n=X/Q;X-=Q*n,ee(n)}});
}],