Screen Shake tool

Hi !

I’ve made this tool today to make the camera shake. And here is a fiddle
Enjoy it if you need it. :blush:

First you instantiate :

var screenShake = ScreenShake();

Then you update in your loop :

function loop() {


 renderer.render(scene, camera);

Then you shake shake shake :

screenShake.shake( camera, new THREE.Vector3(0.1, 0, 0), 300 );

The second argument is the offset at the climax of the screen shake : If you want it to move of 0.5 on X, 0.5 on Y, and 0.2 on Z, then give it THREE.Vector3(0.5, 0.5, 0.2).
The third argument is the duration of the shake in milliseconds.

I also drop here the excellent talk ‘Juice it or Loose it’ of Martin Jonasson & Petri Purho about ‘juiciness’ in video games, you should really watch it if it’s not already done !


Would be cool to have an example of using :wink:

You’re right, I just made one and updated my message.