esd
esd

Reputation: 115

Three.js scene rendered controlled by mouse scroll?

I'm trying to control the movement of animated objects in a scene by mapping them directly to the mouse scroll.

The desired effect would be a scene which has a some objects moving but the scenes progress/movement is correlated directly to the .scrollTop() distance.

The desired interaction would be something similar to this example: http://prinzhorn.github.io/skrollr-path/, but with a three.js scene.


Is this possible to control a three.js scene timing with the .scrollTop() distance?

Upvotes: 0

Views: 1045

Answers (1)

ArUn
ArUn

Reputation: 1337

You can you Event Listener to achieve it , Render the scene when the mouse is scrolled.

document.getElementById("myDIV").addEventListener("wheel", myFunction);

function myFunction() {
   renderer.render(scene,camera);
}

Upvotes: 1

Related Questions