3drotationgsapcube

Trying to make a smooth dragging 3d box rotation


I need help with something. I'm new to JS and trying to make a 3D cube rotate. I found a cool example on Code Pen

https://codepen.io/willbrowning/pen/WQojME

and want to do something similar with plain JS.

But my version isn't smooth, and I'm having trouble making the cube rotate while holding the mouse down. It currently waits for me to finish moving the mouse before turning. Any simple tips or advice would be great. Thanks!

here is a link to my code pen:

type here
https://codepen.io/razorchoice/pen/LYaBqeQ

Solution

  • Some thoughts:

    Considering all of those things, I made another pen based on yours.