Skip to content

Commit c5c9427

Browse files
committed
fix canvas transparency - bg color
1 parent e86f9fc commit c5c9427

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

src/components/hero-404/index.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,11 +94,14 @@ void main() {
9494
// char size
9595
float charSize = 4.0;
9696
vec2 p = mod(pix / charSize, 2.0) - vec2(1.0);
97-
col = vec3(character(n, p));
97+
float char = character(n, p);
98+
99+
vec3 charColor = vec3(1.0);
98100
if (gray < 0.2) {
99-
col *= 0.4;
101+
charColor *= 0.4;
100102
}
101-
fragColor = vec4(col, 1.0);
103+
104+
fragColor = vec4(charColor, char);
102105
}`;
103106

104107
const isMobile = () => window.innerWidth < 768;

src/components/hero/index.tsx

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,16 +92,19 @@ void main() {
9292
// char size
9393
float charSize = 4.0;
9494
vec2 p = mod(pix / charSize, 2.0) - vec2(1.0);
95-
col = vec3(character(n, p));
95+
float char = character(n, p);
96+
97+
vec3 charColor = vec3(1.0);
9698
if (gray < 0.2) {
97-
col *= 0.4;
99+
charColor *= 0.4;
98100
}
99-
fragColor = vec4(col, 1.0);
101+
102+
fragColor = vec4(charColor, char);
100103
}`;
101104

102105
const isMobile = () => window.innerWidth < 768;
103106

104-
const renderer = new Renderer({ antialias: true });
107+
const renderer = new Renderer({ antialias: true, alpha: true });
105108
const gl = renderer.gl;
106109
gl.clearColor(0.0627, 0.0627, 0.0627, 1.0);
107110
containerRef.current?.appendChild(gl.canvas);

0 commit comments

Comments
 (0)