@@ -5,34 +5,34 @@ import { FxMaterial, FxMaterialProps } from "../../utils/fxMaterial";
55import { CONSTANT } from "../constant" ;
66import GUI from "lil-gui" ;
77import { useGUI } from "../../utils/useGUI" ;
8- import { useTransitionBg , useNoise } from "../../packages/use-shader-fx/src" ;
8+ import { useFxTexture , useNoise } from "../../packages/use-shader-fx/src" ;
99import {
10- TransitionBgParams ,
11- TRANSITIONBG_PARAMS ,
12- } from "../../packages/use-shader-fx/src/hooks/useTransitionBg " ;
10+ FxTextureParams ,
11+ FXTEXTURE_PARAMS ,
12+ } from "../../packages/use-shader-fx/src/hooks/useFxTexture " ;
1313
1414extend ( { FxMaterial } ) ;
1515
16- const CONFIG : TransitionBgParams = structuredClone ( TRANSITIONBG_PARAMS ) ;
16+ const CONFIG : FxTextureParams = structuredClone ( FXTEXTURE_PARAMS ) ;
1717const DIR = new THREE . Vector2 ( 0 , 0 ) ;
1818const setGUI = ( gui : GUI ) => {
19- gui . add ( CONFIG , "noiseStrength " , 0 , 1 , 0.01 ) ;
19+ gui . add ( CONFIG , "mapIntensity " , 0 , 1 , 0.01 ) ;
2020 gui . add ( CONFIG , "progress" , 0 , 1 , 0.01 ) ;
2121 gui . add ( DIR , "x" , - 1 , 1 , 0.01 ) ;
2222 gui . add ( DIR , "y" , - 1 , 1 , 0.01 ) ;
2323} ;
2424const setConfig = ( ) => {
2525 return {
26- noiseStrength : CONFIG . noiseStrength ,
26+ mapIntensity : CONFIG . mapIntensity ,
2727 progress : CONFIG . progress ,
2828 dir : DIR ,
29- } as TransitionBgParams ;
29+ } as FxTextureParams ;
3030} ;
3131
3232/**
33- * Transition the two background textures using the progress value. Noise can also be added
33+ * Textures can be affected by a map; it is also possible to transition between two textures.
3434 */
35- export const UseTransitionBg = ( args : TransitionBgParams ) => {
35+ export const UseFxTexture = ( args : FxTextureParams ) => {
3636 const updateGUI = useGUI ( setGUI ) ;
3737 const [ bg , momo ] = useLoader ( THREE . TextureLoader , [
3838 "thumbnail.jpg" ,
@@ -41,13 +41,13 @@ export const UseTransitionBg = (args: TransitionBgParams) => {
4141 const fxRef = React . useRef < FxMaterialProps > ( ) ;
4242 const size = useThree ( ( state ) => state . size ) ;
4343 const dpr = useThree ( ( state ) => state . viewport . dpr ) ;
44- const [ updateTransitionBg ] = useTransitionBg ( { size, dpr } ) ;
44+ const [ updateFxTexture ] = useFxTexture ( { size, dpr } ) ;
4545 const [ updateNoise ] = useNoise ( { size, dpr } ) ;
4646
4747 useFrame ( ( props ) => {
4848 const noise = updateNoise ( props ) ;
49- const fx = updateTransitionBg ( props , {
50- noiseMap : noise ,
49+ const fx = updateFxTexture ( props , {
50+ map : noise ,
5151 textureResolution : CONSTANT . textureResolution ,
5252 texture0 : bg ,
5353 texture1 : momo ,
0 commit comments