The progress of your animation is described by the dt
variable, which is a value between 0 and 1. Applying an ease out timing to your animation is as simple as funnelling this value into an appropriate timing function before applying it further. The responsibility of a timing function is to turn the original value into another value between 0 and 1, following a specific timing curve. For more information about timing functions, simply refer to Apple documentation.
In your case, you therefore need to apply an ease out timing function to dt
, something like:
dt = [[TimingFunction easeOutTimingFunction] solveForInput:dt];
Core Animation provides the CAMediaTimingFunction
class, but sadly its _solveForInput:
solving method is private. There exists several open-source implementations of timing functions that you can use instead, e.g. https://github.com/warrenm/AHEasing.
If you are curious, I also recently implemented a method equivalent to _solveForInput:
within a category of CAMediaTimingFunction
.