iOS开发CRAnimation图像、动画

YoYoBall加载动画

2017-05-19  本文已影响385人  熊熊xr

欢迎同样喜爱动效的你加入

iOS动效特攻队–>QQ群:547897182

iOS动效特攻队–>熊熊:648070256

CRAnimation开源项目:https://github.com/CRAnimation/CRAnimation

gitHub:https://github.com/CRAnimation/CRYoYoBallAnimation

本来是群里一个小伙伴的原型

原型地址:https://dribbble.com/shots/3504395-App-icon-football

footBall.gif

看着觉得还不错,难度也不大,就决定还原一下了。

下面是最终实现效果,背景的网格线就没有加了

CRYoYoBallAnimation.gif

这个还是很简单的,在CAShapeLayer上使用CABasicanimation就能实现这个效果。核心代码直有一小段

- (void)startAnimation
{
    CAMediaTimingFunction *timingFunction = [CAMediaTimingFunction functionWithControlPoints:0.79 :0.14 :0.13 :0.83];
    
    CABasicAnimation *animation = [CABasicAnimation animation];
    animation.keyPath = @"transform.rotation";
    animation.duration = 2.5
    ;
    animation.repeatCount = INFINITY;
    animation.byValue = @(M_PI * 2);
    animation.timingFunction = timingFunction;
    [_ballContentLayer addAnimation:animation forKey:animation.keyPath];
}

要点也只有两个,


封面配图请忽略~

CRYoYoBall.png
上一篇下一篇

猜你喜欢

热点阅读