//移动
- (IBAction)translation:(id)sender {
CABasicAnimation *traslation = [CABasicAnimation animationWithKeyPath:@"position"];
traslation.toValue = [NSValue valueWithCGPoint:CGPointMake(,)];
traslation.duration = 2.0;
//traslation.autoreverses = YES;
traslation.repeatCount = ; [self.m_image.layer addAnimation:traslation forKey:@"traslation"];
} //透明
- (IBAction)opacity:(id)sender {
CABasicAnimation *opacity = [CABasicAnimation animationWithKeyPath:@"opacity"];
opacity.fromValue = [NSNumber numberWithFloat:1.0];
opacity.toValue = [NSNumber numberWithFloat:0.4];
opacity.duration = 0.2; //动画时间
opacity.repeatCount = FLT_MAX; //永久
opacity.autoreverses = YES; //每次动画后倒回回放
opacity.removedOnCompletion=NO; //动画后不还原,为no时不回到最初状态
opacity.fillMode=kCAFillModeForwards; [self.m_image.layer addAnimation:opacity forKey:@"opacity"];
} // 旋转
- (IBAction)rotate:(id)sender {
CATransform3D ca3d = CATransform3DMakeRotation( * 3.14159265/180.0, -, , ); CABasicAnimation *rotate = [CABasicAnimation animationWithKeyPath:@"transform.rotation"];
rotate.toValue = [NSValue valueWithCATransform3D:ca3d];
rotate.duration=1.0;
rotate.autoreverses=NO;
rotate.repeatCount=;
rotate.removedOnCompletion=NO;
rotate.fillMode=kCAFillModeForwards;
[self.m_image.layer addAnimation:rotate forKey:@"rotate"];
} - (IBAction)alpha:(id)sender {
} //缩放
- (IBAction)scale:(id)sender {
CABasicAnimation *scale = [CABasicAnimation animationWithKeyPath:@"transform.scale"];
scale.fromValue=[NSNumber numberWithFloat:0.5];
scale.toValue = [NSNumber numberWithFloat:2.0];
scale.duration=1.0;
scale.autoreverses=YES;
scale.repeatCount=;
scale.removedOnCompletion=YES;
scale.fillMode=kCAFillModeForwards;
[self.m_image.layer addAnimation:scale forKey:@"scale"];
} //不按原始边长度缩放
-(IBAction)bounds:(id)sender{
CABasicAnimation *bounds = [CABasicAnimation animationWithKeyPath:@"bounds"];
bounds.duration = .f;
bounds.fromValue = [NSValue valueWithCGRect:CGRectMake(,,,)];
bounds.toValue = [NSValue valueWithCGRect:CGRectMake(,,,)];
bounds.byValue = [NSValue valueWithCGRect:self. m_image.bounds]; bounds.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
bounds.repeatCount = ;
bounds.autoreverses = YES; [self.m_image.layer addAnimation:bounds forKey:@"bounds"];
} - (IBAction)path:(id)sender {
CAKeyframeAnimation *animation = [CAKeyframeAnimation animationWithKeyPath:@"position"];
CGMutablePathRef path = CGPathCreateMutable();
CGPathMoveToPoint(path, nil, , );
//添加直线路径
CGPathAddLineToPoint(path, NULL, , );
CGPathAddLineToPoint(path, NULL, , );
CGPathAddLineToPoint(path, NULL, , );
CGPathAddLineToPoint(path, NULL, , );
CGPathAddLineToPoint(path, NULL, , );
//添加曲线路径
CGPathAddCurveToPoint(path,NULL,50.0,275.0,150.0,275.0,70.0,120.0);
CGPathAddCurveToPoint(path,NULL,150.0,275.0,250.0,275.0,90.0,120.0);
CGPathAddCurveToPoint(path,NULL,250.0,275.0,350.0,275.0,110.0,120.0);
CGPathAddCurveToPoint(path,NULL,350.0,275.0,450.0,275.0,130.0,120.0); animation.path = path;
animation.duration = ;
animation.autoreverses = YES;
[self.m_image.layer addAnimation:animation forKey:@"path"];
CFRelease(path);
}
//组合动画
- (IBAction)goup:(id)sender {
CAAnimationGroup *group = [CAAnimationGroup animation]; CABasicAnimation *scale = [CABasicAnimation animationWithKeyPath:@"transform.scale"];
scale.fromValue=[NSNumber numberWithFloat:0.5];
scale.toValue = [NSNumber numberWithFloat:2.0]; CABasicAnimation *traslation = [CABasicAnimation animationWithKeyPath:@"position"];
traslation.toValue = [NSValue valueWithCGPoint:CGPointMake(,)]; group.animations=[NSArray arrayWithObjects:scale, traslation, nil];
group.duration = 2.0; [self.m_image.layer addAnimation:group forKey:@"group"];
}

[IOS笔记] - 动画animation的更多相关文章

  1. 《The Cg Tutorial》阅读笔记——动画 Animation

    这段时间阅读了英文版的NVidia官方的<The Cg Tutorial>,借此来学习基本的图形学知识和着色器编程. 在此做一个阅读笔记. 本文为大便一箩筐的原创内容,转载请注明出处,谢谢 ...

  2. iOS开发--动画(Animation)总结

    UIView的,翻转.旋转,偏移,翻页,缩放,取反的动画效果   翻转的动画 //开始动画 [UIView beginAnimations:@"doflip" context:ni ...

  3. iOS开发动画(Animation)总结

    UIView的,翻转.旋转,偏移,翻页,缩放,取反的动画效果   翻转的动画 //开始动画 [UIView beginAnimations:@"doflip" context:ni ...

  4. 荼菜的iOS笔记--UIView的几个Block动画

    前言:我的第一篇文章荼菜的iOS笔记–Core Animation 核心动画算是比较详细讲了核心动画的用法,但是如你上篇看到的,有时我们只是想实现一些很小的动画,这时再用coreAnimation就会 ...

  5. Android动画学习笔记-Android Animation

    Android动画学习笔记-Android Animation   3.0以前,android支持两种动画模式,tween animation,frame animation,在android3.0中 ...

  6. iOS 核心动画 Core Animation浅谈

    代码地址如下:http://www.demodashi.com/demo/11603.html 前记 关于实现一个iOS动画,如果简单的,我们可以直接调用UIView的代码块来实现,虽然使用UIVie ...

  7. amazeui学习笔记--css(常用组件15)--CSS动画Animation

    amazeui学习笔记--css(常用组件15)--CSS动画Animation 一.总结 1.css3动画封装:CSS3 动画封装,浏览器需支持 CSS3 动画. Class 描述 .am-anim ...

  8. iOS核心动画学习整理

    最近利用业余时间终于把iOS核心动画高级技巧(https://zsisme.gitbooks.io/ios-/content/chapter1/the-layer-tree.html)看完,对应其中一 ...

  9. IOS 核心动画之CAKeyframeAnimation - iBaby

    - IOS 核心动画之CAKeyframeAnimation - 简单介绍 是CApropertyAnimation的子类,跟CABasicAnimation的区别是:CABasicAnimation ...

随机推荐

  1. V4L2使用V4L2_MEMORY_USERPTR和V4L2_MEMORY_MMAP的区别

    视频应用可以通过两种方式从V4L2驱动申请buffer 1. USERPTR, 顾名思义是用户空间指针的意思,应用层负责分配需要的内存空间,然后以指针的形式传递给V4L2驱动层,V4L2驱动会把cap ...

  2. Leetcode24--->Swap Nodes in Pairs(交换单链表中相邻的两个节点)

    题目:给定一个单链表,交换两个相邻的节点,且返回交换之后的头节点 举例: Given 1->2->3->4, you should return the list as 2-> ...

  3. 大数据学习——akka学习

    架构图 重要类介绍 ActorSystem 在Akka中,ActorSystem是一个重量级的结构,他需要分配多个线程,所以在实际应用中,ActorSystem通常是一个单例对象,我们可以使用这个Ac ...

  4. [adb 学习篇] python将adb命令集合到一个工具上

    https://testerhome.com/topics/6938 qzhi的更全面,不过意思是一样的,另外补充一个开源的https://github.com/264768502/adb_wrapp ...

  5. 面向对象编程(二)封装--构造方法,this关键字,static关键字,方法重载

    面向对象三大特点:封装.继承.多态 封装概念 ①   将东西包装在一起,然后以新的完整形式呈现出来: 将方法和字段一起包装到一个单元中,单元以类的形式实现; ②   信息隐藏,隐藏对象的实现细节,不让 ...

  6. Spring事务支持:利用继承简化配置

    因为事务代理的实现类是 TransactionProxyFactoryBean . 事务代理Bean必须注入事务管理器. 大部分情况下,每个事务代理的事务属性大同小异,对于这种情况,Spring提供了 ...

  7. Hibernate的简单封装Session(方便调用)

    因为每次用增删改查时都需要用到hibernate的配置来生成session工厂进而生成session,比较麻烦,所以我们直接封装一个可以调用的类,需要的时候只需要调用即可. 新建一个Hibernate ...

  8. 《学习笔记》Maven

    Maven优点之一:jar包统一管理+升级容易+项目清爽 试想一下,我们会在工作中同时创建很多项目,每个项目可能都会引用一些公用的jar包(.NET中是dll文件),一种作法是每个项目里,都复制一份这 ...

  9. Eclipse + Apache Axis2 发布RESTful WebService(二)配置开发环境

    1. 下载axis2相关软件地址:http://axis.apache.org/axis2/java/core/download.html 2. 安装插件:将axis2-eclipse-codegen ...

  10. 小程序语音红包开发中 汉字转拼音的问题 微信小程序红包开发遇到的坑

    公司最近在开发微信小程序的红包功能,语音红包需要用到文字转拼音的功能. 之前介绍过怎么将中文的汉字转为拼音的,具体看下面这篇文章. 微信语音红包小程序开发如何提高精准度 红包小程序语音识别精准度 微信 ...