0

How exactly we could auto rotate the 3D model embedded within a canvas.

Please find the implemented code below:

HTML:

        <canvas id="cv1" width=264 height=264>
                It seems you are using an outdated browser that does not support canvas :-(
        </canvas>

JavaScript:

        <script type="text/javascript" src="jsc3d.js"></script>
        <script type="text/javascript" src="jsc3d.touch.js"></script>
        <script type="text/javascript">
            var viewer = new JSC3D.Viewer(document.getElementById('cv1'));
            viewer.setParameter('SceneUrl',         'Cupid Heart.obj');
            viewer.setParameter('ModelColor',       '#6F4E37');
            viewer.setParameter('BackgroundColor1', '#D2B48C');
            viewer.setParameter('BackgroundColor2', '#964B00');
            viewer.setParameter('RenderMode',       'flat');
            viewer.init();
            viewer.update();
        </script>

I have checked many other posts but its not working. Your help is highly appreciated.

Updated:

Can it be fixed by CSS?

  • do youchecked this [post](http://stackoverflow.com/questions/30978659/rotate-scene-about-up-vector-in-jsc3d/31610564#31610564)? – deblocker Oct 04 '15 at 23:34

1 Answers1

0

there is a new version of JSC3D which has all the feature you asking for. Rotation of the loaded model is directly integrated in JSC3D prototype.

You just only need to set parameters "SceneRotation" and "AutorotateSpeed" at viewer initialization.

Repo: https://github.com/deblocker/jsc3d.v2/tree/master/jsc3dv2

deblocker
  • 7,629
  • 2
  • 24
  • 59