Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Animate the rotation in slow motion #146

Open
GoogleCodeExporter opened this issue Apr 9, 2015 · 2 comments
Open

Animate the rotation in slow motion #146

GoogleCodeExporter opened this issue Apr 9, 2015 · 2 comments

Comments

@GoogleCodeExporter
Copy link

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 [email protected] on 19 Feb 2015 at 9:08

@GoogleCodeExporter
Copy link
Author

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 [email protected] on 20 Feb 2015 at 3:13

@GoogleCodeExporter
Copy link
Author

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 [email protected] on 26 Feb 2015 at 6:47

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant