【技术】左右晃动

左右摇摆   //self 就是摇摆的view

    CGFloat rotation = 0.03;

    CABasicAnimation *shake = [CABasicAnimation animationWithKeyPath:@"transform"];

    shake.duration = 0.13;

    shake.autoreverses = YES;

    shake.repeatCount = MAXFLOAT;

    shake.removedOnCompletion = NO;

    shake.fromValue = [NSValue valueWithCATransform3D:CATransform3DRotate(self.layer.transform,-rotation,0.0 ,0.0 ,1.0)];

    shake.toValue   = [NSValue valueWithCATransform3D:CATransform3DRotate(self.layer.transform, rotation,0.0 ,0.0 ,1.0)];

    [self.layer addAnimation:shake forKey:@"shakeAnimation"];


停止

    [self.layer removeAnimationForKey:@"shakeAnimation"];

展开阅读全文

没有更多推荐了,返回首页

©️2019 CSDN 皮肤主题: 撸撸猫 设计师: 设计师小姐姐
应支付0元
点击重新获取
扫码支付

支付成功即可阅读