PageSourceSearch

https://sell.app/build/assets/dashboard-share-shaders-__MP3DtJ.js

js sell.app collected 2026-10-02 03:58:05 UTC 3,891 bytes, 82 lines download raw bytes

1import{R as p,T as d,P as m,M as g}from"./Triangle-CvCRX4L3.js";const h=`
2attribute vec2 position;
3varying vec2 vUv;
4
5void main() {
6    vUv = position * 0.5 + 0.5;
7    gl_Position = vec4(position, 0.0, 1.0);
8}
9`,w=`
10precision highp float;
11
12uniform vec2 uResolution;
13uniform vec3 uColorA;
14uniform vec3 uColorB;
15uniform vec3 uColorC;
16uniform vec3 uColorD;
17uniform float uSeed;
18uniform float uScale;
19uniform float uWarp;
20uniform float uGrain;
21
22varying vec2 vUv;
23
24float hash(vec2 point) {
25    return fract(sin(dot(point, vec2(127.1, 311.7))) * 43758.5453123);
26}
27
28float noise(vec2 point) {
29    vec2 cell = floor(point);
30    vec2 local = fract(point);
31    vec2 curve = local * local * (3.0 - 2.0 * local);
32
33    return mix(
34        mix(hash(cell), hash(cell + vec2(1.0, 0.0)), curve.x),
35        mix(hash(cell + vec2(0.0, 1.0)), hash(cell + vec2(1.0, 1.0)), curve.x),
36        curve.y
37    );
38}
39
40float fbm(vec2 point) {
41    float value = 0.0;
42    float amplitude = 0.5;
43
44    for (int octave = 0; octave < 5; octave++) {
45        value += amplitude * noise(point);
46        point = point * 2.03 + vec2(17.13, 9.71);
47        amplitude *= 0.5;
48    }
49
50    return value;
51}
52
53void main() {
54    vec2 uv = vUv;
55    vec2 point = uv - 0.5;
56    point.x *= uResolution.x / uResolution.y;
57    point *= uScale;
58
59    float broadNoise = fbm(point * 0.72 + vec2(uSeed, uSeed * 0.37));
60    vec2 warpedPoint = point + uWarp * vec2(
61        sin(point.y * 2.4 + broadNoise * 5.2 + uSeed),
62        cos(point.x * 2.1 - broadNoise * 4.8 + uSeed * 0.7)
63    );
64
65    float fieldA = fbm(warpedPoint + vec2(uSeed * 0.17, 1.7));
66    float fieldB = fbm(warpedPoint * 1.42 + vec2(4.3, uSeed * 0.23));
67    float diagonal = smoothstep(-0.35, 0.75, point.x * 0.48 - point.y * 0.3 + fieldA);
68    float bloom = smoothstep(0.2, 0.95, fieldB + (1.0 - length(point * vec2(0.7, 1.0))) * 0.35);
69
70    vec3 color = mix(uColorA, uColorB, smoothstep(0.05, 0.95, uv.y + fieldA * 0.42));
71    color = mix(color, uColorC, diagonal * 0.82);
72    color = mix(color, uColorD, bloom * 0.52);
73
74    float vignette = 1.0 - smoothstep(0.18, 1.15, length((uv - 0.5) * vec2(1.0, 1.18)));
75    color *= mix(0.72, 1.08, vignette);
76
77    float grain = hash(gl_FragCoord.xy + vec2(uSeed * 91.7, uSeed * 37.2)) - 0.5;
78    color += grain * uGrain;
79
80    gl_FragColor = vec4(clamp(color, 0.0, 1.0), 1.0);
81}
82`,x={aurora:{colors:["#041f1d","#0f766e","#22d3ee","#a7f3d0"],seed:1.8,scale:1.08,warp:.34,grain:.045},"violet-bloom":{colors:["#160b33","#6d28d9","#ec4899","#f9a8d4"],seed:7.4,scale:1.3,warp:.48,grain:.05},"solar-flare":{colors:["#431407","#c2410c","#f59e0b","#fb7185"],seed:12.1,scale:1.2,warp:.4,grain:.042}};function b(a,o,n){var i;const e=x[n];if(!e)throw new Error(`Unknown dashboard share shader preset: ${n}`);const c=new p({width:a,height:o,dpr:1,alpha:!1,antialias:!1,depth:!1,preserveDrawingBuffer:!0,powerPreference:"high-performance",webgl:1}),r=c.gl;try{const v=new d(r),s=new m(r,{vertex:h,fragment:w,uniforms:{uResolution:{value:new Float32Array([a,o])},uColorA:{value:new Float32Array(t(e.colors[0]))},uColorB:{value:new Float32Array(t(e.colors[1]))},uColorC:{value:new Float32Array(t(e.colors[2]))},uColorD:{value:new Float32Array(t(e.colors[3]))},uSeed:{value:e.seed},uScale:{value:e.scale},uWarp:{value:e.warp},uGrain:{value:e.grain}}});if(!r.getProgramParameter(s.program,r.LINK_STATUS))throw new Error("Could not compile the shader background.");const f=new g(r,{geometry:v,program:s});c.render({scene:f});const l=document.createElement("canvas"),u=l.getContext("2d");if(!u)throw new Error("Could not prepare the shader background.");return l.width=a,l.height=o,u.drawImage(r.canvas,0,0,a,o),l}finally{(i=r.getExtension("WEBGL_lose_context"))==null||i.loseContext()}}function t(a){const o=a.replace("#","");return[parseInt(o.slice(0,2),16)/255,parseInt(o.slice(2,4),16)/255,parseInt(o.slice(4,6),16)/255]}export{b as renderDashboardShareShader};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.