iosuikitcore-animationcakeyframeanimationeasing

CAKeyframeAnimation - move along path and use easing


Is it possible to use CAKeyframeAnimation to move something along a path and at the same time use some sort of easing so there is acceleration or deceleration? I know there is timingFunctions and keyTimes, but I don't see how they would work if you are simply moving along a path.


Solution

  • Something like

    anim.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseOut]
    

    ?

    Or swift 5:

    anim.timingFunction = CAMediaTimingFunction(name: CAMediaTimingFunctionName.easeInEaseOut)