Jump to content
GreenSock

gcooke

use variable in tween

Warning: Please note

This thread was started before GSAP 3 was released. Some information, especially the syntax, may be out of date for GSAP 3. Please see the GSAP 3 migration guide and release notes for more information about how to update the code to GSAP 3's syntax. 

Recommended Posts

Hi,

 

So I would like to know how I pass a variable into the following bezier code.

 

 

 
 
TweenMax.to(dot, 5, {bezier:{curviness:2.2, autoRotate:false, values:[{x:0, y:0}, {x:0, y:400}, {x:335, y:400}, {x:335, y:45}]}, ease:Bounce.easeIn});
 

Ideally I would like to set a variable to pass into the first values {x:0, y:0}:

 

Thanks,

 

Link to comment
Share on other sites

Hi and welcome to the GreenSock forums.

 

Not exactly sure which you are asking for, but here are 2 options:

var endX1 = 20,
      endY1 = 40;

TweenMax.to(dot, 5, {bezier:{curviness:2.2, autoRotate:false, values:[{x:endX1, y:endY1}, {x:0, y:400}, {x:335, y:400}, {x:335, y:45}]}, ease:Bounce.easeIn});
var point1 = {x:20, y:40});

TweenMax.to(dot, 5, {bezier:{curviness:2.2, autoRotate:false, values:[point1, {x:0, y:400}, {x:335, y:400}, {x:335, y:45}]}, ease:Bounce.easeIn});

Let us know if you needed something else.

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.
×