Camera position and device controls using the waves example

Hi r/threejs,

I have a website where i need to use threejs. I used the waves example in a landing page and it is working well on desktop/laptop.

However, I need to be able to move the waves (same behaviour as mouse in desktop) but with the device gyroscope/accelerometer and it is working using the devicecontrols that i found in another example. The problem is that it is my first time using three and working with 3d and i am lost. The dots are really small they only seem to move in a very small line and i dont know how or where the camera should look.

For example,

– Desired behaviour (

– Current on desktop (

– Current on mobile (

On mobile should look the same as on desktop and move the waves but only horizontally…

Is this possible?

Mobile Script

 if (screen && screen.width ` 

Thank you!

Submitted March 23, 2019 at 08:51PM by 0cean88
via reddit