Skip to content

Instantly share code, notes, and snippets.

@nbriz
Last active December 18, 2015 04:29
Embed
What would you like to do?
swinging camera motion for threejs_playGnd
/* ------------------- INSTRUCTIONS -----
to swing the camera back and fourth
add the code below to your draw() function
to change the axis the camera swings on
change the 'x' after 'position' to 'y' or 'z'
-------------------------------------- */
camera.position.x = Math.sin( Date.now() * 0.002 ) * 50;
/* --------------------------------------
you can also swing a mesh this way
-------------------------------------- */
mesh.position.y = Math.sin( Date.now() * 0.002 ) * 300;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment