PageSourceSearch

https://noteworthy.app/assets/built/chunks/side-rays-Dd15WhJ8.js

js noteworthy.app collected 2026-10-04 08:05:01 UTC 3,026 bytes, 65 lines download raw bytes

1import{c as y,u as t,s as l,a as e}from"./helpers-CxDxNF8W.js";var p=`
2precision highp float;
3
4uniform vec2 u_resolution;
5uniform float u_time;
6uniform float u_speed;
7uniform vec3 u_accent;
8uniform vec3 u_rayColor2;
9uniform float u_intensity;
10uniform float u_spread;
11uniform float u_flipX;
12uniform float u_flipY;
13uniform float u_tilt;
14uniform float u_saturation;
15uniform float u_blend;
16uniform float u_falloff;
17uniform float u_opacity;
18uniform vec3 u_baseColor;
19
20float rayStrength(vec2 src, vec2 refDir, vec2 coord, float sA, float sB, float spd) {
21	float t = u_time * u_speed;
22	vec2 delta = coord - src;
23	float ca = dot(normalize(delta), refDir);
24	return clamp(
25		(0.45 + 0.15 * sin(ca * sA + t * spd)) +
26		(0.3 + 0.2 * cos(-ca * sB + t * spd)),
27		0.0, 1.0) *
28		clamp((u_resolution.x - length(delta)) / u_resolution.x, 0.5, 1.0);
29}
30
31void main() {
32	vec2 fc = gl_FragCoord.xy;
33	if (u_flipX > 0.5) fc.x = u_resolution.x - fc.x;
34	if (u_flipY > 0.5) fc.y = u_resolution.y - fc.y;
35
36	vec2 coord = vec2(fc.x, u_resolution.y - fc.y);
37	vec2 rayPos = vec2(u_resolution.x * 1.1, -0.5 * u_resolution.y);
38
39	float tiltRad = u_tilt * 3.14159265 / 180.0;
40	float cs = cos(tiltRad);
41	float sn = sin(tiltRad);
42	vec2 rel = coord - rayPos;
43	vec2 tc = vec2(rel.x * cs - rel.y * sn, rel.x * sn + rel.y * cs) + rayPos;
44
45	float hs = u_spread * 0.275;
46	vec2 rDir1 = normalize(vec2(cos(0.785398 + hs), sin(0.785398 + hs)));
47	vec2 rDir2 = normalize(vec2(cos(0.785398 - hs), sin(0.785398 - hs)));
48
49	vec3 rays1 = u_accent * rayStrength(rayPos, rDir1, tc, 36.2214, 21.11349, 1.0);
50	vec3 rays2 = u_rayColor2 * rayStrength(rayPos, rDir2, tc, 22.3991, 18.0234, 0.2);
51
52	vec3 color = rays1 * (1.0 - u_blend) * 0.9 + rays2 * u_blend * 0.9;
53
54	float distToLight = length(gl_FragCoord.xy - vec2(rayPos.x, u_resolution.y - rayPos.y)) / u_resolution.y;
55	float brightness = u_intensity * 0.4 / pow(max(distToLight, 0.001), u_falloff);
56	color *= brightness;
57
58	float gray = dot(color, vec3(0.299, 0.587, 0.114));
59	color = mix(vec3(gray), color, u_saturation);
60
61	float alpha = clamp(max(color.r, max(color.g, color.b)) * u_opacity, 0.0, 1.0);
62	vec3 outCol = clamp(u_baseColor + color * alpha, 0.0, 1.0);
63	gl_FragColor = vec4(outCol, 1.0);
64}
65`;function d(o,r,m,s,v,{config:u}={}){const{primary:c,secondary:f,background:n}=s,a=y(o,r),{animation:_,rays:i}=u;return a.speed=t(o,r,"u_speed"),a.accent=t(o,r,"u_accent"),a.baseColor=t(o,r,"u_baseColor"),a.rayColor2=t(o,r,"u_rayColor2"),a.intensity=t(o,r,"u_intensity"),a.spread=t(o,r,"u_spread"),a.flipX=t(o,r,"u_flipX"),a.flipY=t(o,r,"u_flipY"),a.tilt=t(o,r,"u_tilt"),a.saturation=t(o,r,"u_saturation"),a.blend=t(o,r,"u_blend"),a.falloff=t(o,r,"u_falloff"),a.opacity=t(o,r,"u_opacity"),l(o,a.speed,_.speed),e(o,a.accent,c),e(o,a.baseColor,n),e(o,a.rayColor2,f),l(o,a.intensity,i.intensity),l(o,a.spread,i.spread),l(o,a.flipX,i.flipX),l(o,a.flipY,i.flipY),l(o,a.tilt,i.tilt),l(o,a.saturation,i.saturation),l(o,a.blend,i.blend),l(o,a.falloff,i.falloff),l(o,a.opacity,i.opacity),a}export{p as default,d as setupSideRaysUniforms};

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.