Jump to content
Search Community

Tween Parameters

Tanuki test
Moderator Tag

Go to solution Solved by akapowl,

Recommended Posts

Can anyone tell me what the 2nd tween parameter is used for? I'm sure it's staring me in the face, but I can't seem to find any description of the numerical param that immediately follows the target - thx in advance!

 

image.thumb.png.77212a903ea715e7fb2469143bd603d8.png

Link to comment
Share on other sites

  • Solution

 

Hey @IMTanuki

 

It's the duration of the tween.

 

Quote

I'm sure it's staring me in the face, but I can't seem to find any description of the numerical param that immediately follows the target

 

Have you checked the docs?

 

https://greensock.com/docs/v2/TweenLite

 

var photo = document.getElementById("photo");
TweenLite.to(photo, 2, {width:"200px", height:"150px"});

The above code will tween the width and height properties of the <img> DOM element with an id of "photo" from whatever the current values are to 200 and 150 respectively over the course of 2 seconds.

 

 

TweenLite is part of a rather old version by now though.

You might want to consider updating to GSAP3 - it's pretty easy.

The syntax of the duration parameter has changed a bit since then.

 

  • Like 3
Link to comment
Share on other sites

Hmmm...so, my question was prompted by what I saw in the docum - I just started using GSAP, so I've never even used v2.

 

I started on the MorphSVG product page, then

- navigated to the MorphSVG plugin docum, which defaults to v2 and that spawned my question.

 

Based on your input, I toggled to v3, which navigates to the docum home page, at which point I was able to find the v3 MorphSVG plugin docum.

 

So I'm glad I asked and thank you for the quick reply. But it seems like the docum navigation is a bit circuitous...

Link to comment
Share on other sites

Sorry about the confusion there. It looks like you found the one link on the entire MorphSVG page that did indeed go to the v2 docs. Glad you pointed that out! Should be fixed now. Also, for the record, our docs remember which version you were browsing and defaults to that thereafter as a convenience. So if you landed in the v2 docs, you'll stay there unless you toggle to v3 (or go directly to one of the v3 links of course). 

 

Hopefully that clears everything up now. Enjoy the tools! 👍

  • Like 3
Link to comment
Share on other sites

  • 2 weeks later...

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