|
1 | 1 | import * as THREE from "three"; |
2 | | -import gsap from "gsap"; |
3 | 2 | import GUI from "lil-gui"; |
4 | 3 |
|
5 | | -import { TRANSITIONBG_PARAMS } from "@/packages/use-shader-fx/src/hooks/useTransitionBg"; |
6 | 4 | import { FRUID_PARAMS } from "@/packages/use-shader-fx/src/hooks/useFruid"; |
7 | 5 | import { FOGPROJECTION_PARAMS } from "@/packages/use-shader-fx/src/hooks/useFogProjection"; |
8 | 6 |
|
9 | 7 | export const CONFIG = { |
10 | | - transitionBg: { |
11 | | - ...structuredClone(TRANSITIONBG_PARAMS), |
12 | | - dir: new THREE.Vector2(0.3, 0.4), |
13 | | - imageResolution: new THREE.Vector2(1440, 1029), |
14 | | - active: true, |
15 | | - transformDir: 1, |
16 | | - transform: () => { |
17 | | - CONFIG.transitionBg.transformDir *= -1; |
18 | | - const tl = gsap.timeline({ |
19 | | - defaults: { duration: 2 }, |
20 | | - }); |
21 | | - tl.to(CONFIG.transitionBg, { |
22 | | - noiseStrength: 0.2, |
23 | | - progress: 0.5, |
24 | | - ease: "power2.in", |
25 | | - }); |
26 | | - tl.to(CONFIG.transitionBg, { |
27 | | - noiseStrength: 0.0, |
28 | | - progress: CONFIG.transitionBg.transformDir > 0 ? 0.0 : 1.0, |
29 | | - ease: "power2.out", |
30 | | - }); |
31 | | - }, |
32 | | - }, |
33 | 8 | fogProjection: { |
34 | 9 | ...structuredClone(FOGPROJECTION_PARAMS), |
35 | | - fogColor: new THREE.Color(0xd5cea3), |
36 | | - active: true, |
| 10 | + fogColor: new THREE.Color(0xffffff), |
| 11 | + fogEdge0: 0.5, |
| 12 | + fogEdge1: 1.0, |
| 13 | + distortionStrength: 0.2, |
37 | 14 | }, |
38 | 15 | fruid: { |
39 | 16 | ...structuredClone(FRUID_PARAMS), |
40 | 17 | fruidVec: new THREE.Vector3(), |
41 | 18 | fruid_color: (velocity: THREE.Vector2) => { |
42 | | - const rCol = Math.max(0.0, velocity.x * 100); |
43 | | - const gCol = Math.max(0.0, velocity.y * 100); |
44 | | - const bCol = (rCol + gCol) / 2; |
| 19 | + const rCol = Math.max(0.2, velocity.x * 100); |
| 20 | + const gCol = Math.max(0.2, velocity.y * 100); |
| 21 | + const bCol = Math.max(0.4, (rCol + gCol) / 2); |
45 | 22 | return CONFIG.fruid.fruidVec.set(rCol, gCol, bCol); |
46 | 23 | }, |
47 | 24 | }, |
48 | 25 | }; |
49 | 26 |
|
50 | 27 | export const setGUI = (gui: GUI) => { |
51 | | - const transitionBg = gui.addFolder("transitionBg"); |
52 | | - transitionBg.add(CONFIG.transitionBg, "noiseStrength", 0, 1, 0.01); |
53 | | - transitionBg.add(CONFIG.transitionBg, "progress", 0, 1, 0.01); |
54 | | - if (CONFIG.transitionBg.dir) { |
55 | | - transitionBg.add(CONFIG.transitionBg.dir, "x", 0, 1, 0.01); |
56 | | - transitionBg.add(CONFIG.transitionBg.dir, "y", 0, 1, 0.01); |
57 | | - } |
58 | | - transitionBg.add(CONFIG.transitionBg, "transform"); |
59 | | - transitionBg.add(CONFIG.transitionBg, "active"); |
60 | | - |
61 | 28 | const fogProjection = gui.addFolder("fogProjection"); |
62 | 29 | fogProjection.add(CONFIG.fogProjection, "distortionStrength", 0, 10, 0.01); |
63 | 30 | fogProjection.add(CONFIG.fogProjection, "fogEdge0", 0, 1, 0.01); |
64 | 31 | fogProjection.add(CONFIG.fogProjection, "fogEdge1", 0, 1, 0.01); |
65 | 32 | fogProjection.addColor(CONFIG.fogProjection, "fogColor"); |
66 | | - fogProjection.add(CONFIG.fogProjection, "active"); |
67 | 33 |
|
68 | 34 | const fruid = gui.addFolder("fruid"); |
69 | 35 | fruid.add(CONFIG.fruid, "density_dissipation", 0, 1, 0.01); |
|
0 commit comments