Skip to content

Commit 002f8ec

Browse files
author
takuma-hmng8
committed
update demo site
1 parent 259c5a5 commit 002f8ec

File tree

7 files changed

+43
-4
lines changed

7 files changed

+43
-4
lines changed

Diff for: .gitignore

+4-1
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,7 @@ next-env.d.ts
3838
storybook-static/
3939

4040
# exclude CreateShaderFx
41-
CreateShaderFx/
41+
CreateShaderFx/
42+
43+
# exclude private demo
44+
app/private/

Diff for: .storybook/stories/UseColorStrata.tsx

+4-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { useFrame, extend, useThree } from "@react-three/fiber";
44
import { FxMaterial, FxMaterialProps } from "../../utils/fxMaterial";
55
import GUI from "lil-gui";
66
import { useGUI } from "../../utils/useGUI";
7-
import { useColorStrata } from "../../packages/use-shader-fx/src";
7+
import { useColorStrata, useNoise } from "../../packages/use-shader-fx/src";
88
import {
99
COLORSTRATA_PARAMS,
1010
ColorStrataParams,
@@ -72,10 +72,13 @@ export const UseColorStrataWithNoise = (args: ColorStrataParams) => {
7272
return { size: state.size, dpr: state.viewport.dpr };
7373
});
7474
const [updateColorStrata] = useColorStrata({ size, dpr });
75+
const [updateNoise] = useNoise({ size, dpr });
7576

7677
useFrame((props) => {
78+
const noise = updateNoise(props);
7779
const fx = updateColorStrata(props, {
7880
...setConfig(),
81+
texture: noise,
7982
});
8083

8184
fxRef.current!.u_fx = fx;

Diff for: app/ShaderFx.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export const ShaderFx = ({ children }: { children: React.ReactNode }) => {
1616
setDpr(Math.round((0.5 + 1.0 * factor) * 10) / 10);
1717
}}>
1818
<Suspense fallback={null}>{children}</Suspense>
19-
<Perf position={"bottom-left"} minimal={false} />
19+
{/* <Perf position={"bottom-left"} minimal={false} /> */}
2020
</PerformanceMonitor>
2121
</Canvas>
2222
);

Diff for: app/_home/index.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ export const Home = () => {
8787
precision highp float;
8888
varying vec2 vUv;
8989
uniform sampler2D u_fx;
90-
90+
9191
void main() {
9292
vec2 uv = vUv;
9393
gl_FragColor = texture2D(u_fx, uv);

Diff for: app/page.tsx

+29
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
"use client";
22

3+
import Image from "next/image";
34
import { ShaderFx } from "./ShaderFx";
45
import { Home } from "./_home";
56

@@ -26,6 +27,34 @@ export default function Page() {
2627
}}>
2728
use-shader-fx
2829
</h1>
30+
<ul
31+
style={{
32+
position: "fixed",
33+
bottom: "16px",
34+
right: "16px",
35+
zIndex: 100,
36+
display: "flex",
37+
alignItems: "center",
38+
gap: "16px",
39+
}}>
40+
<li>
41+
<a
42+
href="https://github.com/takuma-hmng8/use-shader-fx"
43+
target={"_blank"}>
44+
<Image
45+
src="github-logo.svg"
46+
alt="GitHub"
47+
width={28}
48+
height={28}
49+
/>
50+
</a>
51+
</li>
52+
<li>
53+
<a href="https://twitter.com/tkm_hmng8" target={"_blank"}>
54+
<Image src="x-logo.svg" alt="X" width={24} height={24} />
55+
</a>
56+
</li>
57+
</ul>
2958
</div>
3059
);
3160
}

Diff for: public/github-logo.svg

+1
Loading

Diff for: public/x-logo.svg

+3
Loading

0 commit comments

Comments
 (0)