I'm trying to implement time line objects, the purpose of those would be to issue events at specific times. When and what is specified through objects called units, which is what you attach in the time line.
Got two types of time units, Action and Transit. Action counts to the end of the time unit, then issue whatever event with provided values intact.
My problem is Transit, which, frame by frame, modifies provided value(s) by multiplying time ratio before issuing the event.
I calculate ratio as: (in pseudo code)
ratio = (counter += delta time) / unit end time
My issue is that I keep getting either different results, or unbalanced progress, like adding 90% of the value quick then the last 10% of value at a much slower phase.
I've tried something like (in pseudo code) so far:
delta value = (end value - earlier delta values) * ratio
for each new frame.
Not sure how to put this together, so could really use a few pointers on this. Hope I made myself clear.
PS. I'm doing this in JavaScript, I know JS isn't the most accurate language when it comes to precision numbers, but it should be able to handle something like this.
Thank you in advance.