IOS UI 动画用到的一些 效果

来源:互联网 发布:usb001端口是哪个 编辑:程序博客网 时间:2024/05/16 20:29

1:围绕中心旋转

#pragma mark - **************** 动画设置    NSString * viewRotationKey = @"rotationAnimation";    // 外围的旋转一圈    CABasicAnimation * transformRoate = [CABasicAnimation animationWithKeyPath:@"transform.rotation"];    transformRoate.byValue = [NSNumber numberWithDouble:(2 * M_PI)];    transformRoate.duration = 2;    transformRoate.repeatCount = self.isEndless == YES ? MAXFLOAT : 2;    [self.rotateImg.layer addAnimation:transformRoate forKey:viewRotationKey];

2:水波效果的,X轴移动动画

CGFloat avgScore = self.precent;        [UIView animateWithDuration:4.0 animations:^{            self.bigImg.top = 115 - ((avgScore/100.0) * 115);            if (avgScore == 100) {                self.bigImg.top = -20;            }            self.bigImg.left = 0;        } completion:^(BOOL finished) {            if (self.endless == YES) {                acallBack(self.bigImg.layer.position.x);            }        }];NSString * cellMoveKey = @"waveMoveAnimation"; __weak __typeof(&*self)weakSelf = self;    void(^acallBack)(CGFloat start) = ^(CGFloat start) {        CAKeyframeAnimation * moveAction = [CAKeyframeAnimation animationWithKeyPath:@"position.x"];        moveAction.values = [NSArray arrayWithObjects:[NSNumber numberWithFloat:-60],[NSNumber numberWithFloat:start],nil];        moveAction.duration = 4;        // moveAction.autoreverses = YES;        moveAction.repeatCount = MAXFLOAT;        [weakSelf.bigImg.layer addAnimation:moveAction forKey:cellMoveKey];    };


1 0
原创粉丝点击