@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 CHANGED
@@ -1,5 +1,7 @@
1
1
  # @bbki.ng/site
2
2
 
3
+ ## 1.7.10
4
+
3
5
  ## 1.7.9
4
6
 
5
7
  ## 1.7.8
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bbki.ng/site",
3
- "version": "1.7.9",
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.7",
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",
@@ -21,9 +21,6 @@ export const EffectLayer = () => {
21
21
 
22
22
  return (
23
23
  <Canvas
24
- style={{
25
- opacity: 0.1,
26
- }}
27
24
  className={canvasDefaultCls}
28
25
  uniforms={uniforms}
29
26
  fragment={frag}
@@ -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 * abs(sin(uProgress))) * 0.09,
24
- rand(uv * abs(sin(uProgress))) * 0.09,
25
- rand(uv * abs(sin(uProgress))) * 0.09,
26
- rand(uv * abs(sin(uProgress)))
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
- result.a *= 0.8;
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. * uDevicePixelRatio - uv.y < navHeight) {
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
- (p: any) => {
12
- if (inst === null) {
13
- setInst(p);
10
+ (inst: any) => {
11
+ if (inst == null) {
14
12
  return;
15
13
  }
16
14
 
17
- inst.uniforms.uResolution.value[0] = resolution.current[0];
18
- inst.uniforms.uResolution.value[1] = resolution.current[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
- [inst]
21
+ []
24
22
  );
25
23
 
26
- return { inst, onRender };
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
- // touch move
16
- window.addEventListener("touchmove", updateResolution);
9
+ const updateResolution = () => {
10
+ resolution.current = [window.innerWidth, window.innerHeight];
11
+ };
17
12
 
18
- // scroll
19
- window.addEventListener("scroll", updateResolution);
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