// DSBH rules-regulations hero background: Home's glass engine over this page's own colour field and panes (WebGL fragment shader). // GENERATED by legal/figma/glass/make-hero-bands.py rules-regulations from Figma frame 1378:15382 (do not edit by hand). The engine // (the REFR.. constants, gPar, hash/noise/fbm/blob, sdPanel, glass) is copied verbatim from home/glass.frag, but for LIQ // (1., was 1.55: these bands have more contrast). precision highp float; uniform vec2 uRes;uniform float uScale,uPx,uTime;uniform vec2 uMouse; // Frame: the scene is the hero picture (2880 x 1070 at 2x of 1440 x 535), 1.79 x .665 units, framed like the // (object-fit: cover, object-position: 50% 100%, bottom aligned), so the canvas lands on the picture at every size. The shared script measures the // pointer in its own frame (uScale); frame() moves it, and the pixel size, into ours. const float ASPECT=1.79,TALL=.665; float S,nPx;vec2 nMouse; void frame(){S=max(uRes.x/ASPECT,uRes.y/TALL);nPx=uPx*uScale/S;nMouse=vec2((uMouse.x-.5*ASPECT)*uScale/S+.5*ASPECT,uMouse.y*uScale/S);} #define uPx nPx #define uMouse nMouse // The frame's three bands (#CCB596, #1B4D9E, #CEE0ED, Gaussian blur 100 / 75 / 75 px) over its base, in Figma's order. Each band: upper // edge, lower edge and softness as polynomials of x, fitted to its real blur. t = x mapped from [-0.5221, 2.4613] to [-1, 1]. const vec3 C0=vec3(.8,.7098,.5882),C1=vec3(.1059,.302,.6196),C2=vec3(.8078,.8784,.9294),GLOW=vec3(.94,.97,1.); const float REFR=.51,LIQ=1.,RIMW=1.3,RIM=.65,FILL=.10,LDEG=-45.,LIGHT=.80; vec2 gPar; float hash(vec2 p){p=fract(p*vec2(123.34,456.21));p+=dot(p,p+45.32);return fract(p.x*p.y);} float noise(vec2 p){vec2 i=floor(p),f=fract(p);f=f*f*(3.-2.*f);return mix(mix(hash(i),hash(i+vec2(1,0)),f.x),mix(hash(i+vec2(0,1)),hash(i+vec2(1,1)),f.x),f.y);} float fbm(vec2 p){float a=.5,s=0.;for(int i=0;i<3;i++){s+=a*noise(p);p=p*2.03+17.1;a*=.5;}return s;} float blob(vec2 p,vec2 c,vec2 st,float r2){vec2 d=(p-c)*st;return exp(-dot(d,d)/r2);} float cdf(float z){z=clamp(z,-6.,6.);return 1./(1.+exp(-1.5957691*(z+.044715*z*z*z)));} float e0t(float t){return .2144+t*(.5671+t*(1.2312+t*(-2.9302+t*(-4.5443+t*(6.1847+t*(5.3236+t*(-6.5052+t*(-2.0717+t*(2.6222)))))))));} float e0b(float t){return -.2062+t*(-.201+t*(.9017+t*(1.2329+t*(-3.1397+t*(-4.2314+t*(2.8993+t*(4.3325+t*(-.7971+t*(-1.3795)))))))));} float e0w(float t){return .1346+t*(.0032+t*(-.0429+t*(.0105+t*(.1569+t*(-.0288+t*(-.112+t*(.0166)))))));} float e1t(float t){return .1405+t*(.1469+t*(1.0403+t*(.9925+t*(-3.4279+t*(-4.469+t*(4.0494+t*(5.7472+t*(-1.6303+t*(-2.3889)))))))));} float e1b(float t){return -.0381+t*(-.075+t*(-.2316+t*(1.1372+t*(1.5495+t*(-2.8528+t*(-2.9237+t*(2.4093+t*(1.572+t*(-.6326)))))))));} float e1w(float t){return .0984+t*(.0081+t*(-.0074+t*(-.0608+t*(.0187+t*(.1188+t*(-.0113+t*(-.0668)))))));} float e2t(float t){return .365+t*(.3455+t*(-1.0511+t*(-2.3583+t*(3.2081+t*(4.3835+t*(-4.36+t*(-3.8895+t*(2.0185+t*(1.3762)))))))));} float e2b(float t){return -.0462+t*(.046+t*(.4411+t*(-1.4004+t*(-2.071+t*(2.4676+t*(2.3399+t*(-2.1825+t*(-.8336+t*(.8095)))))))));} float e2w(float t){return .097+t*(-.0057+t*(.0177+t*(.0661+t*(-.045+t*(-.123+t*(.0362+t*(.0594)))))));} // The drift (warp, waves) grows in over the first 8 s and the pointer's pull and glow over 2.5 s, so the first frame // is the picture and the fade-in is seamless. vec3 bg(vec2 p){float t=uTime,k=min(t*.125,1.),kp=min(t*.4,1.),s; vec2 w=p+.12*k*(vec2(fbm(p*1.1+vec2(t*.05,-t*.04)),fbm(p*1.1+vec2(-t*.045,t*.05)+9.7))-.44); vec2 dm=w-uMouse;w-=dm*exp(-dot(dm,dm)*5.)*.38*kp; float tt=clamp((2.*w.x-1.9392)/2.9833,-1.,1.); float u=clamp(((TALL-w.y)*804.4693-81.)/453.6,0.,1.);u*=u;vec3 c=1.-u*(vec3(-.0045,.0217,.0595)+u*vec3(.0963,.0342,.0133)); s=e0w(tt);c=mix(c,C0,(cdf((e0t(tt)+.03*k*sin(w.x*2.3+t*.27+0.)-w.y)/s)-cdf((e0b(tt)+.03*k*sin(w.x*1.9-t*.22+.8)-w.y)/s))*cdf((w.x+.1795)/.1243)); s=e1w(tt);c=mix(c,C1,(cdf((e1t(tt)+.024*k*sin(w.x*2.7-t*.31+1.7)-w.y)/s)-cdf((e1b(tt)+.024*k*sin(w.x*2.1+t*.26+2.5)-w.y)/s))*cdf((w.x-.3094)/.0932)); s=e2w(tt);c=mix(c,C2,(cdf((e2t(tt)+.028*k*sin(w.x*1.9+t*.21+3.4)-w.y)/s)-cdf((e2b(tt)+.028*k*sin(w.x*2.5-t*.29+4.2)-w.y)/s))); vec2 d0=p-uMouse;return mix(c,GLOW,.22*kp*exp(-dot(d0,d0)*9.));} float sdPanel(vec2 p,vec4 r,float k){float cx=.5*(r.x+r.y),hw=.5*(r.y-r.x);float y=p.y-(r.z+k*(p.x-r.x))+.5*r.w; vec2 d=vec2(abs(p.x-cx)-hw,(abs(y)-.5*r.w)/sqrt(1.+k*k));return min(max(d.x,d.y),0.)+length(max(d,0.));} void glass(inout vec3 col,vec2 q,vec4 r,float k,float depth,float ph){ vec2 sh=gPar*depth+vec2(0.,.009*sin(uTime*.55+ph));vec2 p=q-sh;float d=sdPanel(p,r,k);float bw=RIMW/1.4; if(d>(1.+4.*max(bw,1.))*uPx)return; float hov=smoothstep(.03,-.03,sdPanel(uMouse-sh,r,k)); vec2 uv=vec2((p.x-r.x)/(r.y-r.x),(r.z+k*(p.x-r.x)-p.y)/r.w); float la=radians(90.-LDEG);vec2 Ld=normalize(vec2(cos(la),sin(la))+.45*gPar); vec2 e=vec2(2.*uPx,0.);vec2 n=normalize(vec2(sdPanel(p+e.xy,r,k)-sdPanel(p-e.xy,r,k),sdPanel(p+e.yx,r,k)-sdPanel(p-e.yx,r,k))+1e-6); float lens=clamp(1.+d/.032,0.,1.);lens*=lens;vec2 off=-n*.044*REFR*(1.+.6*hov)*lens; float inside=smoothstep(0.,-10.*uPx,d);vec2 lp=p/uPx; off+=LIQ*inside*(1.+.5*hov)*uPx*vec2(8.*sin(lp.y*.045-uTime*.9+ph),22.*sin(lp.x*.028+uTime*.7+ph+.5*sin(lp.y*.03-uTime*.5))); vec3 g=bg(q+off);float facing=dot(n,Ld); g=mix(g,vec3(1.),FILL+.06*hov); vec2 c=(uv-.5)*2.;float along=dot(c,normalize(vec2(Ld.x,-Ld.y))); float lw=smoothstep(.05,1.1,abs(along))*(.35+.65*abs(facing)); float s=fract((p.x*.6+p.y)*.9-uTime*.035+ph*.1);float sweep=smoothstep(.14,0.,abs(s-.5)); vec2 dq=q-uMouse;float near=exp(-dot(dq,dq)*12.);float breathe=.90+.10*sin(uTime*.7+ph); float rimLight=clamp(LIGHT*lw*breathe+.40*sweep+.50*near+.20*hov,0.,1.); g=mix(g,vec3(1.),.28*exp(d/.014)*rimLight);g+=.04*sweep; col=mix(col,g,smoothstep(uPx,-uPx,d)); float core=smoothstep(bw*uPx,0.,abs(d)),halo=.22*smoothstep(4.*bw*uPx,0.,abs(d)); col=mix(col,vec3(1.),clamp((core+halo)*(.05+.95*rimLight)*RIM/.95,0.,1.));} void main(){frame();vec2 q=vec2((gl_FragCoord.x-.5*uRes.x)/S+.5*ASPECT,gl_FragCoord.y/S);gPar=uMouse-vec2(.5*ASPECT,.5); vec3 col=bg(q); glass(col,q,vec4(.7068,.8917,.1498,.2097),-.3575,.035,0.);glass(col,q,vec4(1.4011,1.8449,.0412,.2679),.3486,.05,2.1);glass(col,q,vec4(1.3688,1.8126,.5546,.2679),.3486,.05,2.1); glass(col,q,vec4(1.1195,1.4031,.4657,.3223),-.3582,.035,2.1);glass(col,q,vec4(-.1564,.6775,.0426,.2548),-.3499,.07,4.2);glass(col,q,vec4(.3823,.7967,.106,.2511),.3499,.05,4.2); glass(col,q,vec4(.1181,.3838,.503,.3014),-.3575,.035,4.2); col+=(hash(gl_FragCoord.xy+fract(uTime))-.5)*(1.5/255.);gl_FragColor=vec4(col,1.);}