UIViewAnimation动画与Core Animation的CATransition类动画
来源:互联网 发布:电脑闹钟提醒软件 编辑:程序博客网 时间:2024/06/05 15:26
- - (void)leftClick {
- [UIView beginAnimations:nil context:nil];
- //display mode, slow at beginning and end
- [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
- //动画时间
- [UIView setAnimationDuration:1.0f];
- //使用当前正在运行的状态开始下一段动画
- [UIView setAnimationBeginsFromCurrentState:YES];
- //给视图添加过渡效果
- [UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft forView:imageView cache:YES];
- [UIView commitAnimations];
- }
- - (void)rightClick {
- [UIView beginAnimations:nil context:nil];
- //display mode, slow at beginning and end
- [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
- //动画时间
- [UIView setAnimationDuration:1.0f];
- //使用当前正在运行的状态开始下一段动画
- [UIView setAnimationBeginsFromCurrentState:YES];
- //给视图添加过渡效果
- [UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight forView:imageView cache:YES];
- [UIView commitAnimations];
- }
- - (void)upClick {
- [UIView beginAnimations:nil context:nil];
- //display mode, slow at beginning and end
- [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
- //动画时间
- [UIView setAnimationDuration:1.0f];
- //使用当前正在运行的状态开始下一段动画
- [UIView setAnimationBeginsFromCurrentState:YES];
- //给视图添加过渡效果
- [UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:imageView cache:YES];
- [UIView commitAnimations];
- }
- - (void)downClick {
- [UIView beginAnimations:nil context:nil];
- //display mode, slow at beginning and end
- [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
- //动画时间
- [UIView setAnimationDuration:1.0f];
- //使用当前正在运行的状态开始下一段动画
- [UIView setAnimationBeginsFromCurrentState:YES];
- //给视图添加过渡效果
- [UIView setAnimationTransition:UIViewAnimationTransitionCurlDown forView:imageView cache:YES];
- [UIView commitAnimations];
- }
- /*
- CATransition的type属性
- 1.#define定义的常量
- kCATransitionFade 交叉淡化过渡
- kCATransitionMoveIn 新视图移到旧视图上面
- kCATransitionPush 新视图把旧视图推出去
- kCATransitionReveal 将旧视图移开,显示下面的新视图
- 2.用字符串表示
- pageCurl 向上翻一页
- pageUnCurl 向下翻一页
- rippleEffect 滴水效果
- suckEffect 收缩效果,如一块布被抽走
- cube 立方体效果
- oglFlip 上下翻转效果
- */
- - (void)MyCAnimation1 {
- CATransition *animation = [CATransition animation];
- //动画时间
- animation.duration = 1.0f;
- //display mode, slow at beginning and end
- animation.timingFunction = UIViewAnimationCurveEaseInOut;
- //过渡效果
- animation.type = kCATransitionMoveIn;
- //过渡方向
- animation.subtype = kCATransitionFromTop;
- //添加动画
- [imageView.layer addAnimation:animation forKey:nil];
- }
- - (void)MyCAnimation2 {
- CATransition *animation = [CATransition animation];
- //动画时间
- animation.duration = 1.0f;
- //display mode, slow at beginning and end
- animation.timingFunction = UIViewAnimationCurveEaseInOut;
- //在动画执行完时是否被移除
- animation.removedOnCompletion = NO;
- //过渡效果
- animation.type = @"pageCurl";
- //过渡方向
- animation.subtype = kCATransitionFromRight;
- //暂时不知,感觉与Progress一起用的,如果不加,Progress好像没有效果
- animation.fillMode = kCAFillModeForwards;
- //动画停止(在整体动画的百分比).
- animation.endProgress = 0.7;
- [imageView.layer addAnimation:animation forKey:nil];
- }
- - (void)MyCAnimation3 {
- CATransition *animation = [CATransition animation];
- //动画时间
- animation.duration = 1.0f;
- //display mode, slow at beginning and end
- animation.timingFunction = UIViewAnimationCurveEaseInOut;
- //过渡效果
- animation.type = @"pageUnCurl";
- //过渡方向
- animation.subtype = kCATransitionFromRight;
- //暂时不知,感觉与Progress一起用的,如果不加,Progress好像没有效果
- animation.fillMode = kCAFillModeBackwards;
- //动画开始(在整体动画的百分比).
- animation.startProgress = 0.3;
- [imageView.layer addAnimation:animation forKey:nil];
- }
- - (void)MyCAnimation4 {
- [NSTimer scheduledTimerWithTimeInterval:3.0f target:self selector:@selector(updateButterfly) userInfo:nil repeats:YES];
- }
- - (void)updateButterfly {
- butterflyView.animationDuration = 0.75f;
- [self.view addSubview:butterflyView];
- [butterflyView startAnimating];
- butterflyView.center = [butterflyView randomCenterInView:self.view withInset:10.0f];
- }
- UIViewAnimation动画与Core Animation的CATransition类动画
- UIViewAnimation动画与Core Animation的CATransition类动画
- UIViewAnimation动画与Core Animation的CATransition类动画
- UIViewAnimation动画与Core Animation的CATransition类动画
- UIViewAnimation动画与Core Animation的CATransition类动画
- UIViewAnimation动画与Core Animation的CATransition类动画
- UIViewAnimation动画与Core Animation的CATransition类动画
- UIViewAnimation动画与Core Animation的CATransition类动画
- UIViewAnimation动画与Core Animation的CATransition类动画
- UIViewAnimation动画与Core Animation的CATransition类动画
- UIViewAnimation与Core Animation的CATransition类
- UIViewAnimation动画与CATransition类动画
- UIViewAnimation动画与CATransition类动画
- UIViewAnimation动画与CATransition类动画
- UIViewAnimation动画与CATransition类动画
- UIViewAnimation动画与CATransition类动画
- UIViewAnimation动画与CATransition类动画
- UIViewAnimation动画与CATransition类动画
- dll中多线程使用回调函数
- ArcGIS资料
- html中后台动态绑定数据表格存在空白单元格问题
- 实现Profile购物车的匿名用户迁移
- UIPageControl背景
- UIViewAnimation动画与Core Animation的CATransition类动画
- Could not load file or assembly "xxx" or one of its dependencies. The system cannot find the file sp
- 树-AVL树
- 守护线程、非守护线程简介和addShutdownHook方法使用
- Siebel Error: Unable to find definition for component CommOutboundMgr. (SBL-SRQ-0013)
- 截屏 发送邮件
- 点击出星
- Tomcat 支持远程调试
- c# winform richTextBox 自动显示最后一行