美文网首页
点击图片旋转动画和放大动画

点击图片旋转动画和放大动画

作者: timeQuick | 来源:发表于2019-07-26 10:52 被阅读0次

在工程中比较常写的2种
点击按钮图片旋转来表示刷新

 -(void)animateRotation
{
    dispatch_async(dispatch_get_main_queue(), ^{
        CABasicAnimation *layer = [CABasicAnimation animationWithKeyPath:@"transform.rotation"];
        layer.toValue = @(2*M_PI);
        layer.duration = 1;
        layer.removedOnCompletion = false;
        layer.repeatCount = MAXFLOAT;
        [self.refreshImageView.layer addAnimation:layer forKey:@"xuanzhuangXX"];
    });
}
-(void)removeAnimate
{
    [self.refreshImageView.layer removeAllAnimations];
}

放大动画

 CAKeyframeAnimation *animation = [CAKeyframeAnimation animationWithKeyPath:@"transform.scale"];
    animation.repeatCount = 1;
    animation.duration = 0.2;
    animation.fillMode = kCAFillModeForwards;
    animation.removedOnCompletion = YES;
    animation.values = @[@(1), @(1.5), @(1)];
    [view.layer addAnimation:animation forKey:@"beginaniamtion"];

相关文章

网友评论

      本文标题:点击图片旋转动画和放大动画

      本文链接:https://www.haomeiwen.com/subject/grhrrctx.html