Created
August 24, 2020 01:09
-
-
Save robksawyer/58d35d7efcbc972f234e2bbfd180dda7 to your computer and use it in GitHub Desktop.
React Three Fiber organic movement snippet
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// main sphere rotates following the mouse position | |
useFrame(({ clock, mouse }) => { | |
main.current.rotation.z = clock.getElapsedTime(); | |
main.current.rotation.y = THREE.MathUtils.lerp( | |
main.current.rotation.y, | |
mouse.x * Math.PI, | |
0.1 | |
); | |
main.current.rotation.x = THREE.MathUtils.lerp( | |
main.current.rotation.x, | |
mouse.y * Math.PI, | |
0.1 | |
); | |
}); |
Author
robksawyer
commented
Sep 13, 2020
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment