Jump to content

Search In
  • More options...
Find results that contain...
Find results in...

How to control speed of gsap.to() function

Recommended Posts

I am using gsap to change the position of camera in threejs .  I need to control the speed of gsap.to() . Below is my code for changing the position


gsap.to( camera.position, {
					duration: 1,
					y: 5,
					} );

Now I need to control the movement speed of it. How to do that. Thanks in advance.

Link to post
Share on other sites

Hey @jayakannan,


Welcome to the GreenSock Forum.


I am not sure what exactly you want to achieve.

You could use timeScale to control the timing.

Please note ease: 'none'  (default is 'power1.out') to ensure a steady speed.


See the Pen MWyVELQ by mikeK (@mikeK) on CodePen


Happy speeding ...


  • Like 3
Link to post
Share on other sites

Hi @mikel , 

Thank you for your kind reply, I need to change the position of camera in threejs. For that I am using gsap.to() function.  It is working, but I felt that the speed is little much faster. So, to control that, I need help. From above answer I tested the timeScale within the gsap.to() function. But it shows an warning like, Invalid property timeScale set to 0.5 Missing plugin? gsap.registerPlugin().  How to achieve this.

Link to post
Share on other sites

Hey @jayakannan,


Please provide a minimal demo in CodePen or JSFiddle or something

so that we can see things in context. We'd be happy to help, but it's tough without any demo.

  • Like 2
Link to post
Share on other sites


Hey @jayakannan


I really don't know, if I understand correctly, but if you simply just wanted to de- or increase the 'speed' of that single tween, it would help changing the duration on it.


A duration of 0.5 seconds would make your camera go to that 'y:5' in a shorter time period, thus faster - a duration of 2.0 would make it go there in a longer time period, thus slower.



  • Like 3
Link to post
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.