Jump to content
Search Community

constant tween

slanton test
Moderator Tag

Recommended Posts

I am using papervision3d and want to be able to rotate the camera at a constant speed for an indefinite time with the ability to stop and start. I am thinking that I will need to tween to something like camera.rotationY+20 and then constantly repeat the tween. Would this be the best way ?

Link to comment
Share on other sites

Are you using the most recent tween classes, because it works for me?

package
{
import org.papervision3d.view.BasicView;
import org.papervision3d.objects.primitives.Plane;
import org.papervision3d.materials.ColorMaterial;
import com.greensock.easing.Linear;
import com.greensock.TweenMax;

public class Main extends BasicView
{
	public function Main()
	{
		super(0, 0, true, false, "FreeCamera");
		scene.addChild(new Plane(new ColorMaterial(0x990000)));
		startRendering();

		TweenMax.to(camera, 10, { rotationY:360, repeat:-1, ease:Linear.easeNone} );
	}
}
}

Link to comment
Share on other sites

Because I want to be able to rotate forwards and backwards at a constant speed I did this

 public function rotateForward():void
   {
    var timeint:int=Math.abs(360-camera.rotationY)/8;
  TweenMax.to(camera, timeint, { rotationY:360, repeat:-1, ease:Linear.easeNone});
   }
    public function rotateBack():void
   {
   var timeint:int=Math.abs(-360-camera.rotationY)/8;  
     TweenMax.to(camera, timeint, { rotationY:-360, repeat:-1, ease:Linear.easeNone});
   }

   public function stop():void
   {
   TweenMax.to(camera, 0, {rotationY:camera.rotationY});	
   }

 

but I see that tweenMax has reverse() restart() built in so may try and use those methods

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...