ios layer 动画-(transform.rotation篇)
CABasicAnimation *theAnimation;
theAnimation=[CABasicAnimation animationWithKeyPath:@"transform.rotation.x"];
theAnimation.duration=;
theAnimation.removedOnCompletion = YES;
theAnimation.fromValue = [NSNumber numberWithFloat:];
theAnimation.toValue = [NSNumber numberWithFloat:3.1415926];
[yourView.layer addAnimation:theAnimation forKey:@"animateTransform"];
CABasicAnimation *theAnimation;
theAnimation=[CABasicAnimation animationWithKeyPath:@"transform.rotation.y"];
theAnimation.duration=;
theAnimation.removedOnCompletion = YES;
theAnimation.fromValue = [NSNumber numberWithFloat:];
theAnimation.toValue = [NSNumber numberWithFloat:3.1415926];
[yourView.layer addAnimation:theAnimation forKey:@"animateTransform"];
z轴旋转:
CABasicAnimation *theAnimation;
theAnimation=[CABasicAnimation animationWithKeyPath:@"transform.rotation.z"];
theAnimation.duration=;
theAnimation.removedOnCompletion = YES;
theAnimation.fromValue = [NSNumber numberWithFloat:];
theAnimation.toValue = [NSNumber numberWithFloat:3.1415926];
[yourView.layer addAnimation:theAnimation forKey:@"animateTransform"];
以上缩放是以view的中心点为中心缩放的,如果需要自定义缩放点,可以设置卯点:
//中心点
[yourView.layer setAnchorPoint:CGPointMake(0.5, 0.5)];
//左上角
[yourView.layer setAnchorPoint:CGPointMake(, )];
//右下角
[yourView.layer setAnchorPoint:CGPointMake(, )];
可设参数:
theAnimation.repeatCount = 0;
theAnimation.autoreverses = NO;
旋转的另一种实现:(以下代码绕z轴旋转180度)
[self.topViewController.view.layer setAnchorPoint:CGPointMake(0.5, 0.5)];
[self.topViewController.view.layer setTransform:CATransform3DMakeRotation(, , , )];
[UIView animateWithDuration: delay:0.0f options:UIViewAnimationOptionAllowUserInteraction | UIViewAnimationCurveEaseIn animations:^{
[self.topViewController.view.layer setTransform:CATransform3DMakeRotation(3.1415926, , , )];
} completion:^(BOOL finished) {
}];
ios layer 动画-(transform.rotation篇)的更多相关文章
- iOS开发——动画编程Swift篇&(三)CATransition动画
CATransition动画 // MARK: - CATransition动画 // /* 动画样式 */ // let kCATransitionFade: NSString! //翻页 // l ...
- iOS开发——动画编程Swift篇&(五)CAKeyframeAnimation
CAKeyframeAnimation //CAKeyframeAnimation-关键针动画 @IBAction func cakFly() { let animation = CAKeyframe ...
- iOS开发——动画编程Swift篇&(四)CABasicAnimation动画
CABasicAnimation动画 //CABasicAnimation-不透明度 @IBAction func cabOpacity() { let animation = CABasicAnim ...
- ios layer 动画
#import "ViewController.h" @interface ViewController (){ CALayer *_l1;//定义能够全局使用 CAL ...
- iOS开发——动画总结OC篇&所有常用动画总结
所有常用动画总结 先来装下B,看不懂没关系,其实我也看不懂-
- iOS开发——动画编程Swift篇&(二)UIView转场动画
UIView转场动画 // MARK: - UIView动画-过度动画 var redView:UIView? var blueView:UIView? // enum UIViewAnimation ...
- iOS开发——动画编程Swift篇&(一)UIView基本动画
UIView基本动画 // MARK: - UIView动画 ------------------------------------- // MARK: - UIView动画-淡入 @IBActio ...
- iOS 动画基础总结篇
iOS 动画基础总结篇 动画的大体分类(个人总结可能有误) 分类.png UIView 动画 属性动画 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 1 ...
- iOS开发——图形编程OC篇&粘性动画以及果冻效果
粘性动画以及果冻效果 在最近做个一个自定义PageControl——KYAnimatedPageControl中,我实现了CALayer的形变动画以及CALayer的弹性动画,效果先过目: 先做个提纲 ...
随机推荐
- Java Io 对象序列化和反序列化
Java 支持将任何对象进行序列化操作,序列化后的对象文件便可通过流进行网络传输. 1. 对象序列化就是将对象转换成字节序列,反之叫对象的反序列化 2. 序列化流ObjectOut ...
- HDU 1086You can Solve a Geometry Problem too(判断两条选段是否有交点)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1086 判断两条线段是否有交点,我用的是跨立实验法: 两条线段分别是A1到B1,A2到B2,很显然,如果 ...
- BZOJ4525——[Usaco2016 Jan]Angry Cows
1.题意:给一堆可以的限制长度的区间...区间的长度是你控制的...但是只有一个长度...求最短长度覆盖所有的点 2.分析:发现可以二分...那二分吧.....然后我们从头向后扫一遍直接判断能否直接覆 ...
- android studio 的配置
因为GFW,android studio不是下载了就可以用的,最常见的是gradle的问题,现在把自己遇到的问题记录一下,以后再配置就直接看文章就可以了 1.gradle问题,下载最新gradle,然 ...
- 剑指Offer 整数中1出现的次数(从1到n整数中1出现的次数)
题目描述 求出1~13的整数中1出现的次数,并算出100~1300的整数中1出现的次数?为此他特别数了一下1~13中包含1的数字有1.10.11.12.13因此共出现6次,但是对于后面问题他就没辙了. ...
- UDS帧传输
说明 在UDS协议中,其中有一点我视作为基础,即帧传输.也即是数据传输这一块,在UDS的帧传输中,分为4种: SF单帧 FF第一帧 CF连续帧 FC流控制帧 首先,我们抛开以上的东西,假设一个销售商( ...
- WebStorm设置左侧菜单栏背景色和样式
WebStrom一直以来都是默认的白色主题,今天想修改了下主题皮肤,结果导致左侧项目资源栏和顶部菜单栏也变成了黑色,结果无法改变回来,网上查了各种帖子,居然也没找到解决方法,自己研究了半天,终于搞定了 ...
- (七)理解angular中的module和injector,即依赖注入
(七)理解angular中的module和injector,即依赖注入 时间:2014-10-10 01:16:54 阅读:63060 评论:1 收藏:0 [点 ...
- excle导入
public function import_upload(){ set_time_limit(900); if(!empty($_FILES ['xls_path']['name'])){ $tmp ...
- struts2配置文件的加载顺序以及 struts.xml package 的配置说明
查看StrutsPrepareAndExecuteFilter:(核心过滤器)两个功能 :预处理 和 执行 在预处理功能中 init 方法中会有加载配置文件的代码: dispatcher.init() ...