What is the default animation easing function in iOS?
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:
+8
source to share