File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -40,7 +40,7 @@ vec3 Unity_Blackbody_float(float Temperature) {
4040}
4141
4242void main() {
43- const float stars_threshold = 8 .0 ; // modifies the number of stars that are visible
43+ const float stars_threshold = 10 .0 ; // modifies the number of stars that are visible
4444 const float stars_exposure = 500.0 ; // modifies the overall strength of the stars
4545
4646 // Normalized pixel coordinates (from 0 to 1)
Original file line number Diff line number Diff line change 11<script lang =" ts" >
22/** biome-ignore-all lint/style/noNonNullAssertion: ignore */
33
4+ import { onMount } from " svelte" ;
5+
46interface Props {
57 fragmentShader: string ;
68 followReducedAnimation? : boolean ;
1517
1618let canvas: HTMLCanvasElement ;
1719
18- $effect (() => {
20+ onMount (() => {
21+ let cancel = false ;
1922 let gl: WebGLRenderingContext ;
2023 let u_resolution: WebGLUniformLocation ;
2124 let u_time: WebGLUniformLocation ;
@@ -91,13 +94,18 @@ $effect(() => {
9194 init ();
9295 canvas .setAttribute (" style" , " opacity: unset" );
9396 frame = requestAnimationFrame (function loop(time ) {
97+ if (cancel ) return ;
9498 frame = requestAnimationFrame (loop );
9599
96100 gl .uniform2f (u_resolution , canvas .width , canvas .height );
97101 gl .uniform1f (u_time , time / 1000.0 );
98102 gl .drawArrays (gl .TRIANGLE_STRIP , 0 , 4 );
99103 });
100104 });
105+
106+ return () => {
107+ cancel = true ;
108+ };
101109});
102110 </script >
103111
Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ const { Content } = await render(aboutPost);
2121 <div class =" flex w-full rounded-[var(--radius-large)] overflow-hidden relative min-h-32" >
2222 <div class =" card-base relative w-full z-10" >
2323 <DarkThemeContainer client:load >
24- <ShaderContainer client:only fragmentShader ={ starsShader } class =" w-full h-full absolute -z-[50] " />
24+ <ShaderContainer client:only fragmentShader ={ starsShader } class =" w-full h-full absolute" />
2525 </DarkThemeContainer >
2626 <Markdown class =" mt-2 px-9 py-6" >
2727 <Content />
You can’t perform that action at this time.
0 commit comments