@bbki.ng/site 1.7.9 → 1.7.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -0
- package/package.json +2 -2
- package/src/components/effect-layer/EffectLayer.tsx +0 -3
- package/src/components/effect-layer/effects/grain.frag +13 -12
- package/src/components/effect-layer/hooks/useRender.ts +6 -8
- package/src/components/effect-layer/hooks/useResolution.ts +5 -12
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bbki.ng/site",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.10",
|
|
4
4
|
"description": "code behind bbki.ng",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"url": "git+https://github.com/bbbottle/bbki.ng.git"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@bbki.ng/components": "workspace:2.5.
|
|
19
|
+
"@bbki.ng/components": "workspace:2.5.8",
|
|
20
20
|
"@supabase/supabase-js": "^1.35.4",
|
|
21
21
|
"classnames": "2.3.1",
|
|
22
22
|
"react": "^18.0.0",
|
|
@@ -3,8 +3,8 @@ float rand(vec2 co){
|
|
|
3
3
|
sin(
|
|
4
4
|
dot(
|
|
5
5
|
co.xy,
|
|
6
|
-
vec2(12.9898, 78.233)
|
|
7
|
-
)
|
|
6
|
+
vec2(12.9898, 78.233) * 2.
|
|
7
|
+
) * uProgress
|
|
8
8
|
) * 43758.5453
|
|
9
9
|
);
|
|
10
10
|
}
|
|
@@ -20,23 +20,24 @@ vec4 grain(vec4 fragColor, vec2 uv){
|
|
|
20
20
|
|
|
21
21
|
vec4 randGrain(vec2 uv) {
|
|
22
22
|
vec4 color = vec4(
|
|
23
|
-
rand(uv
|
|
24
|
-
rand(uv
|
|
25
|
-
rand(uv
|
|
26
|
-
|
|
23
|
+
rand(uv) * 0.1,
|
|
24
|
+
rand(uv) * 0.1,
|
|
25
|
+
rand(uv) * 0.1,
|
|
26
|
+
0.1
|
|
27
27
|
);
|
|
28
28
|
|
|
29
|
-
vec4 result = grain(color, uv);
|
|
30
|
-
|
|
29
|
+
vec4 result = grain(color, uv) * 0.4;
|
|
30
|
+
|
|
31
|
+
result.a *= 0.2;
|
|
31
32
|
|
|
32
33
|
return result;
|
|
33
34
|
}
|
|
34
35
|
|
|
35
36
|
void drawGrainOnNav(vec2 uv) {
|
|
36
|
-
float navHeight = 64. * uDevicePixelRatio / uResolution.y;
|
|
37
|
-
|
|
38
|
-
if (1.
|
|
37
|
+
// float navHeight = 64. * uDevicePixelRatio / uResolution.y;
|
|
38
|
+
//
|
|
39
|
+
// if (1. - uv.y < navHeight) {
|
|
39
40
|
gl_FragColor = randGrain(uv);
|
|
40
|
-
}
|
|
41
|
+
// }
|
|
41
42
|
}
|
|
42
43
|
|
|
@@ -3,25 +3,23 @@ import { useMousePosition } from "@/hooks/use_mouse_position";
|
|
|
3
3
|
import { useResolution } from "@/components/effect-layer/hooks/useResolution";
|
|
4
4
|
|
|
5
5
|
export const useRender = () => {
|
|
6
|
-
const [inst, setInst] = useState<any>(null);
|
|
7
6
|
const pos = useMousePosition();
|
|
8
7
|
const resolution = useResolution();
|
|
9
8
|
|
|
10
9
|
const onRender = useCallback(
|
|
11
|
-
(
|
|
12
|
-
if (inst
|
|
13
|
-
setInst(p);
|
|
10
|
+
(inst: any) => {
|
|
11
|
+
if (inst == null) {
|
|
14
12
|
return;
|
|
15
13
|
}
|
|
16
14
|
|
|
17
|
-
inst.uniforms.uResolution.value[0] =
|
|
18
|
-
inst.uniforms.uResolution.value[1] =
|
|
15
|
+
inst.uniforms.uResolution.value[0] = inst.gl.canvas.width;
|
|
16
|
+
inst.uniforms.uResolution.value[1] = inst.gl.canvas.height;
|
|
19
17
|
|
|
20
18
|
inst.uniforms.uMouse.value[0] = pos.current.x;
|
|
21
19
|
inst.uniforms.uMouse.value[1] = pos.current.y;
|
|
22
20
|
},
|
|
23
|
-
[
|
|
21
|
+
[]
|
|
24
22
|
);
|
|
25
23
|
|
|
26
|
-
return {
|
|
24
|
+
return { onRender };
|
|
27
25
|
};
|
|
@@ -5,23 +5,16 @@ export const useResolution = () => {
|
|
|
5
5
|
window.innerWidth,
|
|
6
6
|
window.innerHeight,
|
|
7
7
|
]);
|
|
8
|
-
useEffect(() => {
|
|
9
|
-
const updateResolution = () => {
|
|
10
|
-
resolution.current = [window.innerWidth, window.innerHeight];
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
window.addEventListener("resize", updateResolution);
|
|
14
8
|
|
|
15
|
-
|
|
16
|
-
window.
|
|
9
|
+
const updateResolution = () => {
|
|
10
|
+
resolution.current = [window.innerWidth, window.innerHeight];
|
|
11
|
+
};
|
|
17
12
|
|
|
18
|
-
|
|
19
|
-
window.addEventListener("
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
window.addEventListener("resize", updateResolution);
|
|
20
15
|
|
|
21
16
|
return () => {
|
|
22
17
|
window.removeEventListener("resize", updateResolution);
|
|
23
|
-
window.removeEventListener("touchmove", updateResolution);
|
|
24
|
-
window.removeEventListener("scroll", updateResolution);
|
|
25
18
|
};
|
|
26
19
|
}, []);
|
|
27
20
|
|