Ok, this is one for math people, I guess. I have some basic knowledge of ease functions but need some helping hand with this.
I have an element that is translated with CSS transition (translateX) using ‘easeOutSine’ function.
It covers distance A in 1500 ms. I need to find out how much time it needs to cover a distance B (somewhere in between)
The function for ‘easeOutSine’ is:
function easeOutSine(t, b, c, d) {
return c * Math.sin(t/d * (Math.PI/2)) + b;
}
Obviously A and B are known values for me. But I need to know where to put them in the arguments or how to handle this at all. Thanks very much in advance!
EDIT:
Example: Let’s say the element moves 1000px in those 1500ms. How much time has exactly passed when it is at 360px? It is simple to find out when it moves linear but I can’t get ahead of this with the easeOutSine function. (When it reaches this position I’d like to attach a class to another element)