devindavid
Content Type
Profiles
Forums
Store
Blog
Product
Showcase
FAQ
Downloads
Posts posted by devindavid
-
-
So, I made this motorcycle where the spinning wheels speed up and slow down using basic easing and specifying the number of rotations for each duration-
See the Pen rxKJLK by devindavid (@devindavid) on CodePen
I'm trying to put it on a road that moves at a speed corresponding to the speed of the wheels. So basically, dynamically changing the tween duration for an infinitely repeating tween.
The road-
I've figured out the math for each 10 second duration (i'd change the acceleration and deceleration of the wheels to 10s), but I'm pretty new to Javascript, and can't seem to get it to work if i try to use a variable as the tween duration value. But, the math does seem to work in a JS console...
The value for the road's tween duration comes out between apx. 0.1s to 2s, and it works if I just use a number. Is there a way to write the code differently in order to pass the function into a TimelineMax where it runs the function for the specified duration? Ultimately the function will be added to the motorcycle's existing timeline.
Thanks!
See the Pen YwjNeV by devindavid (@devindavid) on CodePen
dynamic duration value for infinitely repeating tween
in GSAP
Posted
Eh, I think I'm going to abandon this approach, I finally got it to work (kind of), but my math formula isn't producing the desired effect-
See the Pen rxKJLK by devindavid (@devindavid) on CodePen
But, Here's what I did to dynamically update the repeating tween duration using an onRepeat callback and the .duration() method. Everything in the getDuration() function can be replaced with any variables and functions to calculate the value.