//移动
- (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. 设置eclipse中的${user}

    打开eclipse根目录找到eclipse.ini文件增加初始配置: -Duser.name=snzigod@hotmail.com 重启eclipse后${user}变量的值就变成了snzigod@ ...

  2. php-数据库连接类

    <?php class DB{ var $host; var $user; var $pwd; var $dbname; var $conn; function DB($host,$user,$ ...

  3. sqlserver常用知识点备忘录(持续更新)

    背景 一个项目的开发,离不开数据库的相关操作,表/视图设计,存储过程,触发器等等数据库对象的操作是非常频繁的.有时候,我们会查找系统中类似的代码,然后复制/粘贴进行再进行相应的修改.本文的目的在于归纳 ...

  4. 理一理Spring如何对接JUnit

    测试代码 package org.simonme.srcstudy.spring3.demo.stub; import static org.junit.Assert.assertNotNull; i ...

  5. PHP mac xdebug配置

    PHP实现断点调试的条件 1. 需要PHP安装xdebug扩展 2. 修改PHP配置文件,开启xdebug扩展,并且对xdebug进行一些配置 3. 重启服务器如apach或nginx 4. 编译器配 ...

  6. 【Luogu】P2774方格取数问题(最大点权独立集)

    题目链接 不知道为啥坠大点权独立集的做法跟最大权闭合图差不多? qwq 放个链接 #include<cstdio> #include<cstring> #include< ...

  7. BZOJ1189 [HNOI2007]紧急疏散evacuate 【二分 + 网络流】

    题目 发生了火警,所有人员需要紧急疏散!假设每个房间是一个N M的矩形区域.每个格子如果是'.',那么表示这是一 块空地:如果是'X',那么表示这是一面墙,如果是'D',那么表示这是一扇门,人们可以从 ...

  8. 如何查找Windows上安装的DB2的端口号Port

    1.db2com打开控制台 2.db2 get dbm cfg 可以通过db2 get dbm cfg,查询数据库管理器配置参数,就可以查到端口号或端口名. 示例: $ db2 get dbm cfg ...

  9. P4551 最长异或路径 (01字典树,异或前缀和)

    题目描述 给定一棵 n 个点的带权树,结点下标从 1 开始到 N .寻找树中找两个结点,求最长的异或路径. 异或路径指的是指两个结点之间唯一路径上的所有边权的异或. 输入输出格式 输入格式: 第一行一 ...

  10. kali2 install Nessus

    注册: https://www.tenable.com/products/nessus-home 安装: 设置登录用户名,密码,输入注册码: