So I have used the solution posted here to make a little rocket follow the specific svg path I created on scroll. This so far works great. My svg path has a looping in it and other sections in which the rocket moves sideways or even up. This obviously leads to the rocket at one point moving out of view because it follows the path on scroll speed even when moving up.
Now I want to move the rocket faster when the rocket moves upwards (or possibly even a bit when it moves sideways). I can’t seem to figure it out. Under this link you will find my code (only this file is important). The code is in svelte but that shouldn’t matter.
My idea includes checking if the angle variable is negative, which means rocket moving upwards, and then changing the dist variable by a certain amount. This just leads to the rocket flickering around. I guess I should change something when angle is negative, but I cannot figure out what.