Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the default animation easing function in iOS?

Tags:

ios

animation

In iOS animations is the default easing function (UIViewAnimationOptionCurveEaseInOut) a quadratic or a cubic? Or what else?

like image 859
Guglie Avatar asked Sep 08 '14 14:09

Guglie


People also ask

What is animation in iOS and why is it important?

Animation is a critical part of your iOS user interfaces, giving apps the ability to draw user attention to particular areas. Using the right animation will not only improve user experience, but can also add a ton of fun and polish to your app.

What is the meaning of easing in animation?

Easing is a term in animation to explain different type of moving animations. In animation easing means apply different type of motions on a object like start moving a object fast than stop slowly. Slowing process is called as decelerates the object.

What is easing in React Native animation?

In animation easing means apply different type of motions on a object like start moving a object fast than stop slowly. Slowing process is called as decelerates the object. There are mainly 4 types of easing available in react native animation.

How do I speed up or slow down animations?

.NET Multi-platform App UI (.NET MAUI) includes an Easing class that enables you to specify a transfer function that controls how animations speed up or slow down as they're running. The Easing class defines a number of easing functions that can be consumed by animations: The BounceIn easing function bounces the animation at the beginning.


1 Answers

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:

Curve

like image 90
omz Avatar answered Oct 04 '22 09:10

omz