#### Dubbsta

##### New member

- Joined
- Jul 13, 2017

- Messages
- 186

here is source if you want to take a look at original

https://ridiculoid.itch.io/ezpz click "dont say i never did nothin for ya"

Code:

```
Function ease:Float(_type:String,_curr_time:Float,_start_pos:Float,_end_pos:Float ,_end_time:Float)
Local type:String = _type
Local curr_time:Float = _curr_time
Local start_pos :Float = _start_pos
Local end_pos:Float = _end_pos
Local end_time:Float = _end_time
Local output:Float = 0
Local reversed:Bool = False
Local range_shIft:Float = 0
Local end_og:Float
Local start_og:Float
' If start position is higher than end position,
' reverse them and remember that we did so.
'
' for example:
' start_pos = 30
' end_pos = 5
' becomes:
' start_pos = 5
' end_pos = 30
' reversed = True
'
If end_pos < start_pos
end_og = end_pos
start_og = start_pos
start_pos = end_og
end_pos = start_og
reversed = True
End
' If range doesn't begin at zero, slide it over to do so.
' save this shIft in range_shIft.
'
' for example:
' start_pos = 10
' end_pos = 25
' becomes:
' start_pos = 0
' end_pos = 15
' range_shIft = -10
'
If Not start_pos = 0
range_shIft = start_pos
end_pos -= start_pos
start_pos = 0
End
' If, for some reason, you've coded things in such a way
' that the current time has exceed the end time, fear not.
'
If curr_time > end_time
curr_time = end_time
End
Select type
Case "linear"
output = end_pos * curr_time / end_time + start_pos
'break
Case "in-quad"
curr_time /= end_time
output = end_pos * curr_time * curr_time + start_pos
'break
Case "out-quad"
curr_time /= end_time
output = -end_pos * curr_time * (curr_time - 2) + start_pos
'break
Case "in-out-quad"
curr_time /= end_time * 0.5
If (curr_time < 1)
output = end_pos * 0.5 * curr_time * curr_time + start_pos
Else
output = end_pos * -0.5 * (--curr_time * (curr_time - 2) - 1) + start_pos
End
'break
Case "in-cubic"
output = end_pos * Pow(curr_time/end_time, 3) + start_pos
'break
Case "out-cubic"
output = end_pos * (Pow(curr_time/end_time - 1, 3) + 1) + start_pos
'break
Case "in-out-cubic"
curr_time /= end_time * 0.5
If (curr_time < 1)
output = end_pos * 0.5 * Pow(curr_time, 3) + start_pos
Else
output = end_pos * 0.5 * (Pow(curr_time - 2, 3) + 2) + start_pos
End
'break
Case "in-quart"
output = end_pos * Pow(curr_time / end_time, 4) + start_pos
'break
Case "out-quart"
output = -end_pos * (Pow(curr_time / end_time - 1, 4) - 1) + start_pos
'break
Case "in-out-quart"
curr_time /= end_time * 0.5
If (curr_time < 1)
output = end_pos * 0.5 * Pow(curr_time, 4) + start_pos
Else
output = end_pos * -0.5 * (Pow(curr_time - 2, 4) - 2) + start_pos
End
''break
Case "in-quint"
output = end_pos * Pow(curr_time / end_time, 5) + start_pos
''break
Case "out-quint"
output = end_pos * (Pow(curr_time / end_time - 1, 5) + 1) + start_pos
''break
Case "in-out-quint"
curr_time /= end_time * 0.5
If (curr_time < 1)
output = end_pos * 0.5 * Pow(curr_time, 5) + start_pos
Else
output = end_pos * 0.5 * (Pow(curr_time - 2, 5) + 2) + start_pos
End
'break
Case "in-Sine"
output = end_pos * (1 - Cos(curr_time / end_time * (PI / 2))) + start_pos
'break
Case "out-Sine"
output = end_pos * Sin(curr_time / end_time * (PI / 2)) + start_pos
'break
Case "in-out-Sine"
output = end_pos * 0.5 * (1 - Cos(PI * curr_time / end_time)) + start_pos
'break
Case "in-circ"
curr_time /= end_time;
output = end_pos * (1 - Sqrt(1 - curr_time * curr_time)) + start_pos
'break
Case "out-circ"
curr_time = curr_time / end_time - 1
output = end_pos * Sqrt(1 - curr_time * curr_time) + start_pos
'break
Case "in-out-circ"
curr_time /= end_time * 0.5
If (curr_time < 1)
output = end_pos * 0.5 * (1 - Sqrt(1 - curr_time * curr_time)) + start_pos
Else
curr_time -= 2
output = end_pos * 0.5 * (Sqrt(1 - curr_time * curr_time) + 1) + start_pos
End
'break
Case "in-expo"
output = end_pos * Pow(2, 10 * (curr_time / end_time - 1)) + start_pos
'break
Case "out-expo"
output = end_pos * (-Pow(2, -10 * curr_time / end_time) + 1) + start_pos
'break
Case "in-out-expo"
curr_time /= end_time * 0.5
If (curr_time < 1)
curr_time -= 1
output = end_pos * 0.5 * Pow(2, 10 * curr_time) + start_pos
Else
curr_time -= 1
output = end_pos * 0.5 * (-Pow(2, -10 * curr_time ) + 2) + start_pos
End
'break
Case "in-elastic"
Local _s:Float = 1.70158
Local _p:Float = 0
Local _a:Float = end_pos
If (curr_time = 0 Or _a = 0)
output = start_pos
End
curr_time /= end_time
If (curr_time = 1)
output = start_pos+end_pos
End
If (_p = 0)
_p = end_time*0.3
End
If (_a < Abs(end_pos))
_a = end_pos
_s = _p*0.25
Else
_s = _p / (2 * PI) * ASin (end_pos / _a)
End
curr_time -= 1
output = -(_a * Pow(2,10 * (curr_time )) * Sin((curr_time * end_time - _s) * (2 * PI) / _p)) + start_pos
'break
Case "out-elastic"
Local _s:Float = 1.70158
Local _p:Float = 0
Local _a:Float = end_pos
If (curr_time = 0 Or _a = 0)
output = start_pos
End
curr_time /= end_time
If (curr_time = 1)
output = start_pos + end_pos
End
If (_p = 0)
_p = end_time * 0.3
End
If (_a < Abs(end_pos))
_a = end_pos
_s = _p * 0.25
Else
_s = _p / (2 * PI) * ASin (end_pos / _a)
End
output = _a * Pow(2, -10 * curr_time) * Sin((curr_time * end_time - _s) * (2 * PI) / _p ) + end_pos + start_pos
'break
Case "in-out-elastic"
Local _s:Float = 1.70158
Local _p:Float = 0
Local _a:Float = end_pos
If (curr_time = 0 Or _a = 0)
output = start_pos
End
curr_time /= end_time*0.5
If (curr_time = 2)
output = start_pos+end_pos
End
If (_p = 0)
_p = end_time * (0.3 * 1.5)
End
If (_a < Abs(end_pos))
_a = end_pos
_s = _p * 0.25
Else
_s = _p / (2 * PI) * ASin (end_pos / _a)
End
If (curr_time < 1)
curr_time -=1
output = -0.5 * (_a * Pow(2, 10 * (curr_time)) * Sin((curr_time * end_time - _s) * (2 * PI) / _p)) + start_pos
End
curr_time -=1
output = _a * Pow(2, -10 * (curr_time)) * Sin((curr_time * end_time - _s) * (2 * PI) / _p) * 0.5 + end_pos + start_pos
'break
Case "in-back"
Local _s:Float = 1.70158
curr_time /= end_time
output = end_pos * curr_time * curr_time * ((_s + 1) * curr_time - _s) + start_pos
'break
Case "out-back"
Local _s:Float = 1.70158
curr_time = curr_time/end_time - 1
output = end_pos * (curr_time * curr_time * ((_s + 1) * curr_time + _s) + 1) + start_pos
'break
Case "in-out-back"
Local _s:Float = 1.70158;
curr_time = curr_time/end_time*2
If (curr_time < 1)
_s *= 1.525
output = end_pos * 0.5 * (curr_time * curr_time * ((_s + 1) * curr_time - _s)) + start_pos
Else
curr_time -= 2
_s *= 1.525
output = end_pos * 0.5 * (curr_time * curr_time * ((_s + 1) * curr_time + _s) + 2) + start_pos
End
'break
Case "in-bounce"
output = end_pos - ease("out-bounce", end_time - curr_time, 0, end_pos, end_time) + start_pos
'break
Case "out-bounce"
curr_time /= end_time
If (curr_time < 1/2.75)
output = end_pos * 7.5625 * curr_time * curr_time + start_pos
Else If (curr_time < 2/2.75)
curr_time -= 1.5/2.75
output = end_pos * (7.5625 * curr_time * curr_time + 0.75) + start_pos
Else If (curr_time < 2.5/2.75)
curr_time -= 2.25/2.75
output = end_pos * (7.5625 * curr_time * curr_time + 0.9375) + start_pos
Else
curr_time -= 2.625/2.75
output = end_pos * (7.5625 * curr_time * curr_time + 0.984375) + start_pos
End
'break
Case "in-out-bounce"
If (curr_time < end_time*0.5)
output = (ease("in-bounce", curr_time*2, 0, end_pos, end_time)*0.5 + start_pos)
Else
output = (ease("out-bounce", curr_time*2 - end_time, 0, end_pos, end_time)*0.5 + end_pos*0.5 + start_pos)
End
'break
End
' un-reverse
If reversed
Local range_output_to_end := end_pos - output
output = end_og + range_output_to_end - range_shIft
End
' un-shIft
output += range_shIft
' ezpz
Return output
End
```