ios之动画效果

1 波纹效果

- (void)makeRipple

{

    CATransition *animation = [CATransition animation];

    animation.duration = 1.0;

    animation.timingFunction = UIViewAnimationCurveEaseInOut;

    animation.type = @"rippleEffect";

    animation.subtype = kCATransitionFromLeft;

    [self.view.window.layer addAnimation:animation forKey:nil];

    

}

 

2 加载tableview上图片显示效果

// cell 出现动画

- (void)tableView:(UITableView *)tableView

    tabelViewCell:(UITableViewCell *)cell

{

    cell.alpha = 0.5;

    CGAffineTransform transformScale = CGAffineTransformMakeScale(0.3,0.8);

    CGAffineTransform transformTranslate = CGAffineTransformMakeTranslation(0.5, 0.6);

    

    cell.transform = CGAffineTransformConcat(transformScale, transformTranslate);

    

    [tableView bringSubviewToFront:cell];

    [UIView animateWithDuration:.4f

                          delay:0

                        options:UIViewAnimationOptionAllowUserInteraction

                     animations:^{

                         

                         cell.alpha = 1;

                         //清空 transform

                         cell.transform = CGAffineTransformIdentity;

                         

                     } completion:nil];

}

 

3 Cell动画效果

-(void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath{

    

    CATransform3D rotation;

    rotation = CATransform3DMakeRotation( (90.0*M_PI)/180, 0.0, 0.7, 0.4);

    rotation.m34 = 1.0/ -600;

    

    cell.layer.shadowColor = [[UIColor blackColor]CGColor];

    cell.layer.shadowOffset = CGSizeMake(10, 10);

    cell.alpha = 0;

    cell.layer.transform = rotation;

    cell.layer.anchorPoint = CGPointMake(0, 0.5);

    

    

    [UIView beginAnimations:@"rotation" context:NULL];

    [UIView setAnimationDuration:0.8];

    cell.layer.transform = CATransform3DIdentity;

    cell.alpha = 1;

    cell.layer.shadowOffset = CGSizeMake(0, 0);

    [UIView commitAnimations];

}

 

posted @ 2015-11-14 16:16  塔里木小虫  阅读(129)  评论(0)    收藏  举报