What is the default animation easing function in iOS?

In iOS, animation is the default easing function ( UIViewAnimationOptionCurveEaseInOut

) quadratic or cubic? Or what else?

+3


source to share


1 answer


This is a cubic Bezier curve . The exact breakpoints are not documented, so they may change between releases, but you can get them through CAMediaTimingFunction

:

CAMediaTimingFunction *func = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
for (int i = 0; i < 4; i++) {
    float *values = malloc(sizeof(float) * 2);
    [func getControlPointAtIndex:i values:values];
    NSLog(@"Control point %i: (%f, %f)", i+1, values[0], values[1]);
    free(values);
}

      



Values that I get this: (0.0, 0.0)

, (0.42, 0.0)

, (0.58, 1.0)

, (1.0, 1.0)

, which roughly corresponds to the curve:

Curve

+8


source







All Articles