-
Easy question im sure
amp=130; freq=40; decay=3; w=Math.sin(time*freq)*amp/Math.exp(time*decay); s=transform.position.speed*-1/50; if(s==0)w
I have a question that im sure has an easy answer but i dont have much time for trial and error so i figured in the meantime id see if i could get a quick answer on here.;.
Ive just made a real quick text animation, with the text flying into center frame from the left using pos keyframes, and i wrote this script to give the text some elasticity, recoil, “squash and stretch” type animation as it comes in..stops, and leaves again.
So the problem im running into is though i have “w” start when the text lands (speed reaching 0)…since my Math.exp is based on “time” , the further down the timeline i have the text land..the more “finished” the exp. curve is so i have to crank up the Math.sin’s amplitude to compensate for it…though that does technically work id rather not have to do that and would like to know a way to make the “time” of the exp. curve decay start when the variables executed, or when the text lands (which is the same time but dont know the best way to link it.) I was thinking maybe this is a good time to get into using layer markers in scripts as i havent really dove into that yet and thought there may be a solution with using them…or a way to say “time minus valueAtTime that position.speed reaches 0”
So if anyone knows the best way to go about this im all ears (as well as any suggestion on how to improve or streamline my script that is already written, if theres a better way of writting it, im still trying to learn)…as always thanks alot!