iOS中的默认动画缓动功能是什么? [英] What is the default animation easing function in iOS?
本文介绍了iOS中的默认动画缓动功能是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在iOS动画中,默认的缓动函数( UIViewAnimationOptionCurveEaseInOut
)是二次方还是立方?或者还有什么?
In iOS animations is the default easing function (UIViewAnimationOptionCurveEaseInOut
) a quadratic or a cubic? Or what else?
推荐答案
这是立方贝塞尔曲线。精确的控制点没有记录,因此它们可以在不同版本之间进行更改,但您可以通过 CAMediaTimingFunction
获取它们:
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);
}
我得到的值是(0.0, 0.0)
,(0.42,0.0)
,(0.58,1.0)
,(1.0,1.0)
,大致对应于此曲线:
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:
这篇关于iOS中的默认动画缓动功能是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文