In iOS animations is the default easing function (UIViewAnimationOptionCurveEaseInOut
) a quadratic or a cubic? Or what else?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
It's a cubic bézier curve. The precise control points aren't documented, so they could change between releases, but you can get them via 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);
}
The values I get with this are (0.0, 0.0)
, (0.42, 0.0)
, (0.58, 1.0)
, (1.0, 1.0)
, which corresponds roughly to this curve: