How to create image slider with webgl textures in react three fiber #2168
-
I am currently trying to transition through an array of images using webgl shaders and react three fiber and I am stuck. Trying to use buttons to navigate through rather than just clicking on the canvas. Unsure how to pass / change imageOne and imageTwo with left and right arrow. Is this possible? I'm aware how to do an image slider in react alone but confused with the two image properties for the glsl mix property. All help is appreciated. Inspiration: https://yuta-takahashi.dev/ Sandbox: https://codesandbox.io/s/snowy-cdn-os34di?file=/pages/index.js |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 5 replies
-
Instead of using the images directly through destructuring, keep them in the image array and track the current image and the last image.
Use the 'uProgress' value to do the transition effect.
Then, each time you update the
Then have the component reference the two index values.
To complete the transition, set
Full demo |
Beta Was this translation helpful? Give feedback.
Instead of using the images directly through destructuring, keep them in the image array and track the current image and the last image.
Use the 'uProgress' value to do the transition effect.
Then, eac…