coreAnimation核心动画(三)CATansition

 1 //
 2 //  ViewController.m
 3 //  CATransition
 4 //
 5 //  Created by ys on 15/11/22.
 6 //  Copyright (c) 2015年 ys. All rights reserved.
 7 //
 8
 9 #import "ViewController.h"
10
11 @interface ViewController ()
12 @property (weak, nonatomic) IBOutlet UIImageView *imageView;
13 - (IBAction)nextClick;
14 - (IBAction)previousClick;
15 @property(nonatomic,assign)int index;
16 @end
17
18 @implementation ViewController
19
20 - (void)viewDidLoad {
21     [super viewDidLoad];
22 }
23
24
25 - (IBAction)nextClick {
26     self.index++;
27     if (self.index == 9) {
28         self.index = 0;
29     }
30     NSString *imageName = [NSString stringWithFormat:@"%d.jpg",self.index+1];
31     self.imageView.image = [UIImage imageNamed:imageName];
32
33     CATransition *anim = [CATransition animation];
34     anim.type = @"pageCurl";
35     anim.duration = 0.5;
36     [self.imageView.layer addAnimation:anim forKey:nil];
37 }
38
39 - (IBAction)previousClick {
40     self.index++;
41     if (self.index == 0) {
42         self.index = 8;
43     }
44     NSString *imageName = [NSString stringWithFormat:@"%d.jpg",self.index+1];
45     self.imageView.image = [UIImage imageNamed:imageName];
46
47     CATransition *anim = [CATransition animation];
48     anim.type = @"pageUnCurl";
49     anim.duration = 0.5;
50     [self.imageView.layer addAnimation:anim forKey:nil];
51 }
52 @end
时间: 2024-07-29 14:08:40

coreAnimation核心动画(三)CATansition的相关文章

iOS核心动画高级技巧之核心动画(三)

iOS核心动画高级技巧之CALayer(一) iOS核心动画高级技巧之图层变换和专用图层(二)iOS核心动画高级技巧之核心动画(三)iOS核心动画高级技巧之性能(四)iOS核心动画高级技巧之动画总结(五) 隐式动画 隐式动画主要作用于CALayer的可动画属性上面,UIView对应的layer是不可以的,只要你改变属性的值,它不是突兀的直接改变过去,而是一个有一个动画的过程,这个时间等属性你可以通过事务(CATransaction)来控制,如果你不自己提供一个事务,它的默认时间是0.25秒,当然

coreAnimation核心动画(一)CABasicAnimation

2 1 // 2 // ViewController.m 3 // coreAnimation 4 // 5 // Created by ys on 15/11/21. 6 // Copyright (c) 2015年 ys. All rights reserved. 7 // 8 9 #import "ViewController.h" 10 11 @interface ViewController () 12 @property (nonatomic,strong)CALayer

CoreAnimation 核心动画 的一些常用属性 和 方法

1.常用属性: frame   bounds   center   alpha    Transition 过渡    transform 动画效果 2.常用方法: +(void)setAnimationDelegate:(id)delegate; +(void)setAnimationWillStartSelector:(SEL)selector; 当动画结束的时候,执行delegate对象的selector,并且把beginAnimations:context:中传入的参数传进selecto

CoreAnimation 核心动画

- (void)createBaseAnimation{ //基础动画 CABasicAnimation *animation = [CABasicAnimation animation]; animation.keyPath = @"bounds"; //    animation.fromValue = [NSValue valueWithCGRect:CGRectMake(0, 0, 300, 300)];//默认为现在的状态 animation.toValue = [NSVal

iOS CoreAnimation(核心动画二)

CATransition :转场动画  翻转动画 @interface ViewController () - (IBAction)previous:(UIButton *)sender; - (IBAction)next:(UIButton *)sender; @property (strong, nonatomic) IBOutlet UIImageView *iconView; @property(nonatomic,assign)int index;//当前图片的索引 @property

CoreAnimation 核心动画二 锚点

锚点: anchorPoint     以锚点为中心 执行动画 (与 渔夫固定船的点时一致的) anchorPoint 默认是 0.5,0.5  (注意: 锚点 是一个比例) anchorPoint 在左上角的时候 为 0,0 anchorPoint 在右上角的时候 为 1,0 anchorPoint 在左下角的时候 为 0,1 anchorPoint 在右下角的时候 为 1,1 1 #import "ViewController.h" 2 3 @interface ViewContr

ios(CoreAnimation核心动画 一) CABasicAnimation动画与锚点

一.position和anchorPoint position:用来设置CALayer在父层中的位置,以父层的左上角为原点(0, 0) anchorPoint(锚点): 称为"定位点"."锚点" 决定着CALayer身上的哪个点会在position属性所指的位置 以自己的左上角为原点(0, 0) 它的x.y取值范围都是0~1,默认值为(0.5, 0.5) 推荐一个连接:http://www.cnblogs.com/wendingding/p/3800736.html

ios(CoreAnimation核心动画 ) CABasicAnimation动画与锚点

一.position和anchorPoint position:用来设置CALayer在父层中的位置,以父层的左上角为原点(0, 0) anchorPoint(锚点): 称为“定位点”.“锚点” 决定着CALayer身上的哪个点会在position属性所指的位置 以自己的左上角为原点(0, 0) 它的x.y取值范围都是0~1,默认值为(0.5, 0.5) 推荐一个连接:http://www.cnblogs.com/wendingding/p/3800736.html讲的非常详细,而且有图视,默认

coreAnimation核心动画(四)CAAnimationGroup

1 // 2 // ViewController.m 3 // CAAnimationGroup 4 // 5 // Created by ys on 15/11/22. 6 // Copyright (c) 2015年 ys. All rights reserved. 7 // 8 9 #import "ViewController.h" 10 11 @interface ViewController () 12 @property (weak, nonatomic) IBOutle