Jump to content
Search Community

Calculate Duration from Element width

robs test
Moderator Tag

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