Closed JiveDig closed 4 years ago
It's not possible to update the values of an instance. You could try to create two instances: One starting at the original location and one at the scroll location. Then activate or deactivate them using .start()
or .stop()
.
You could also try to track another element using direct: document.querySelector('.someElem')
. Then modify the position of this element and call .calculate()
and .update()
to recalculate and update the instance.
I have an animation that starts near the top of the window and works great. However, if a user loads the page already scrolled down (via an anchor link or page refresh or something) I want the animation to start lower the first time, but after some other interaction I want to change the to/from values to the original location.
Pardon my terrible scenario explanation.
Here's some code that shows a little clearer what I hope to do: