robs Posted December 2, 2020 Posted December 2, 2020 Hi, 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, Robert
mikel Posted December 2, 2020 Posted December 2, 2020 Hey @robs, How about this See the Pen wvzKJLe by mikeK (@mikeK) on CodePen. Happy tweening ... Mikel 4
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now