Jump to content

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

Calculate Duration from Element width

Recommended Posts



is it possible to calculate the duration of a tween based on the width of some DOM-Element?

I have something like this:

someTimeline.to(element, {
 width: 0,
 duration: function () { return anotherElement.clientWidth / 290 })
The tween works fine if I put a number to duration. However with the code above the element disappears without animating.


Do you have an idea where my mistake is?


Thanks so much,


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.