Animate the rotation in slow motion
Opened this issue · 2 comments
GoogleCodeExporter commented
Hello,
I am new in this, and want to know whether it is possible to have a motion in
rotating the model.
I used the following code to rotate the model to the specific coordinates and
working proper.
Here is the link : http://eworkdemo.com/development/ruchir/hotel-3d-model/
function changeRotationLeft()
{
viewer.rotMatrix.identity();
viewer.rotMatrix.rotateAboutXAxis(-90);
viewer.rotMatrix.rotateAboutYAxis(180);
viewer.update();
}
Now I want this with slow motion animation.
Please help me with some demo.
Original issue reported on code.google.com by ruchir.k...@gmail.com
on 19 Feb 2015 at 9:08
GoogleCodeExporter commented
Hi, Ruchir:
If what you need is just a simple rotation animation, maybe the demo
http://jsc3d.googlecode.com/svn/trunk/jsc3d/demos/earth.html provides a good
example for how to achieve this. The key is to utilize a timer
(setTimeout()/setinterval()) to produce continuous frames along the timeline.
Original comment by Humu2...@gmail.com
on 20 Feb 2015 at 3:13
GoogleCodeExporter commented
function foo(){
viewer.init();
viewer.update();
setInterval(rotateThatShit, 50);//function rotateThatShit() is called every 50 miliseconds
}
function rotateThatShit(){
viewer.rotate(10, 2, 0);//rotates 10 degrees on X axis, 2 on Y axis and not on Z axis, everytime this function is called.
viewer.update();
}
You can also set a specific rotation to start with in the first frame, as soon
as the model is loaded.
viewer.setParameter('InitRotationX', 130);
viewer.setParameter('InitRotationY', 0);
viewer.setParameter('InitRotationZ', 60);
These are of course put next to the rest of the parameters.
Original comment by Tjardo.K...@gmail.com
on 26 Feb 2015 at 6:47