日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 >

CoreAnimation--CALayer的动画

發布時間:2025/7/25 19 豆豆
生活随笔 收集整理的這篇文章主要介紹了 CoreAnimation--CALayer的动画 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

CoreAnimation--CALayer的動畫

?

核心動畫中所有類都遵守CAMediaTiming

CAAnaimation和CAPropertyAnimation都是抽象類,本身不具備動畫效果,必須用它的子類才有動畫效果。

CAAnimationGroup是個動畫組,可以同時進行縮放,旋轉。

CABasicAnimation基本動畫,做一些簡單效果。

CAKeyframeAnimation幀動畫,做一些連續的流暢的動畫。

CATransition是轉場動畫,界面之間跳轉都可以用轉場動畫。

?

ios layer 動畫-(transform.scale篇)??

?

x軸縮放:
CABasicAnimation *theAnimation;
theAnimation=[CABasicAnimation animationWithKeyPath:@"transform.scale.x"];
theAnimation.duration=8;
theAnimation.removedOnCompletion = YES;
theAnimation.fromValue = [NSNumber numberWithFloat:1];
theAnimation.toValue = [NSNumber numberWithFloat:0.5];
?[yourView.layer addAnimation:theAnimation forKey:@"animateTransform"];

y軸縮放:
CABasicAnimation *theAnimation;
theAnimation=[CABasicAnimation animationWithKeyPath:@"transform.scale.y"];
theAnimation.duration=8;
theAnimation.removedOnCompletion = YES;
theAnimation.fromValue = [NSNumber numberWithFloat:1];
theAnimation.toValue = [NSNumber numberWithFloat:0.5];
?[yourView.layer addAnimation:theAnimation forKey:@"animateTransform"];

x軸,y軸同時按比例縮放:
CABasicAnimation *theAnimation;
theAnimation=[CABasicAnimation animationWithKeyPath:@"transform.scale"];
theAnimation.duration=8;
theAnimation.removedOnCompletion = YES;
theAnimation.fromValue = [NSNumber numberWithFloat:1];
theAnimation.toValue = [NSNumber numberWithFloat:0.5];
?[yourView.layer addAnimation:theAnimation forKey:@"animateTransform"];

以上縮放是以view的中心點為中心縮放的,如果需要自定義縮放點,可以設置卯點:
//中心點
[yourView.layer setAnchorPoint:CGPointMake(0.5, 0.5)];

//左上角
[yourView.layer setAnchorPoint:CGPointMake(0, 0)];

//右下角
[yourView.layer setAnchorPoint:CGPointMake(1, 1)];

ios layer 動畫-(transform.rotation篇) ?

x軸旋轉:
CABasicAnimation *theAnimation;
theAnimation=[CABasicAnimation animationWithKeyPath:@"transform.rotation.x"];
theAnimation.duration=8;
theAnimation.removedOnCompletion = YES;
theAnimation.fromValue = [NSNumber numberWithFloat:0];
theAnimation.toValue = [NSNumber numberWithFloat:3.1415926];
?[yourView.layer addAnimation:theAnimation forKey:@"animateTransform"];

y軸旋轉:
CABasicAnimation *theAnimation;
theAnimation=[CABasicAnimation animationWithKeyPath:@"transform.rotation.y"];
theAnimation.duration=8;
theAnimation.removedOnCompletion = YES;
theAnimation.fromValue = [NSNumber numberWithFloat:0];
theAnimation.toValue = [NSNumber numberWithFloat:3.1415926];
?[yourView.layer addAnimation:theAnimation forKey:@"animateTransform"];

z軸旋轉:
CABasicAnimation *theAnimation;
theAnimation=[CABasicAnimation animationWithKeyPath:@"transform.rotation.z"];
theAnimation.duration=8;
theAnimation.removedOnCompletion = YES;
theAnimation.fromValue = [NSNumber numberWithFloat:0];
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(0, 0)];

//右下角
[yourView.layer setAnchorPoint:CGPointMake(1, 1)];

可設參數:

theAnimation.repeatCount = 0;
theAnimation.autoreverses = NO;


旋轉的另一種實現:(以下代碼繞z軸旋轉180度)
??? [self.topViewController.view.layer setAnchorPoint:CGPointMake(0.5, 0.5)];
??? [self.topViewController.view.layer setTransform:CATransform3DMakeRotation(0, 0, 0, 1)];
??? [UIView animateWithDuration:8 delay:0.0f options:UIViewAnimationOptionAllowUserInteraction | UIViewAnimationCurveEaseIn animations:^{
??????? [self.topViewController.view.layer setTransform:CATransform3DMakeRotation(3.1415926, 0, 0, 1)];
??? } completion:^(BOOL finished) {
??? }];

?

?

CATransition 過渡動畫 ?

?

??? CATransition *animation = [CATransition animation];

??? animation.duration = 0.3;

??? animation.type = @"cube"; ?//轉場動畫type見后文

??? animation.subtype = kCATransitionFromLeft;

??? [[self.tableView layer] addAnimation:animation forKey:@"myAnimation"];

?

  animation.fillMode = kCAFillModeBackwards;
  animation.startProgress = 0.01;
  animation.endProgress = 0.99;
使用過渡動畫,實現在同一個view上,左推,右推等各種動畫,節省一個view;

?

參數說明:

setType:可以返回四種類型:

  kCATransitionFade淡出

  kCATransitionMoveIn覆蓋原圖

  kCATransitionPush推出

  kCATransitionReveal底部顯出來

setSubtype:也可以有四種類型:

  kCATransitionFromRight;

  kCATransitionFromLeft(默認值)

  kCATransitionFromTop;

  kCATransitionFromBottom

?

[animation setType:@"type類型"];?可用的type類型主要有:

  pageCurl 向上翻一頁

  pageUnCurl 向下翻一頁

  rippleEffect 滴水效果

  suckEffect 收縮效果,如一塊布被抽走

  cube 立方體效果

  oglFlip 上下翻轉效果

?

/** 轉場動畫type一覽表 **/

fade?交叉淡化過渡

push?新視圖把舊視圖推出去

moveIn?新視圖移到舊視圖上面

reveal?將舊視圖移開,顯示下面的新視圖

cube?立方體翻滾效果?

oglFlip?上下左右翻轉效果

suckEffect?收縮效果,如一塊布被抽走

rippleEffect?水滴效果

pageCurl ?向上翻頁效果

pageUnCurl ?向下翻頁效果?

cameraIrisHollowOpen?相機鏡頭打開效果

cameraIrisHollowClose?相機鏡頭關閉效果

?

?

轉自:http://blog.163.com/it__man/blog/static/137199904201301722556447/

?

?

?

轉載于:https://www.cnblogs.com/stevenwuzheng/p/5543106.html

總結

以上是生活随笔為你收集整理的CoreAnimation--CALayer的动画的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。

主站蜘蛛池模板: 免费国产在线视频 | 午夜视频免费在线观看 | 亚洲国产剧情在线观看 | 麻豆私人影院 | 在线免费成人 | 国模私拍一区二区 | 豆豆色成人网 | 色呦呦在线免费观看 | jizz日本大全 | 国产a网| 欧美日韩你懂的 | 影音先锋美女 | 久久麻豆精品 | 欧美中文字幕一区二区三区 | 色就是色av | 黄色生活毛片 | 亚洲一区电影在线观看 | 黄色录象片 | 自拍天堂 | 日韩免费毛片 | 日本十八禁视频无遮挡 | 黄色资源在线播放 | 免费无码毛片一区二三区 | 国内精品久久久久久久久久久 | 国产视频一区二区三区四区五区 | 韩国黄色视屏 | 99热这里只有精品99 | 在线观看av的网站 | av成人免费观看 | 爱爱视频网站 | 国精产品一区一区三区免费视频 | 午夜影院操 | 一区二区精品久久 | 中文字幕国产专区 | 狠狠干婷婷 | 超碰碰碰| 精品国偷自产国产一区 | 特级黄色片 | 国产一区二区视频免费 | www精品一区二区三区 | 色撸撸在线视频 | 毛片大全 | 绿帽在线 | 国产一区二区三区免费在线观看 | av成人精品 | 黄色靠逼视频 | 手机免费看av片 | 在线免费播放av | 青青青在线免费 | 三点尽露的大尺度国产 | 免费国产羞羞网站视频 | 福利一区二区在线观看 | 国产三级日本三级在线播放 | 日韩在线一区视频 | 国产盗摄av | 全黄一级裸体片 | 亚洲国产一二三 | 国产成人精品一区二区三区免费 | 免费观看91视频 | 超碰男人的天堂 | 中文字幕黄色 | 久成人| 欧美xxxx69 | 国产丝袜网站 | 五月天六月婷婷 | 国产精品视频在线观看免费 | 亚洲经典视频 | 操丰满女人 | 饥渴少妇勾引水电工av | 亚洲专区在线视频 | 日本黄色视屏 | 日本伦理中文字幕 | 激情六月色 | 樱桃成人精品视频在线播放 | 青娱乐福利视频 | 午夜视频在线播放 | 亚洲色图第三页 | 精品人妻伦一二三区久 | 午夜av成人 | 欧美卡一卡二 | 狠狠干性视频 | 99视频在线观看视频 | www.96av| 久久久久激情 | 亚洲成人网在线播放 | 色狠狠久久av大岛优香 | 中文幕无线码中文字夫妻 | 91麻豆产精品久久久久久 | 精品国产一区三区 | 日日摸夜夜添狠狠添久久精品成人 | 男女午夜视频在线观看 | 4444亚洲人成无码网在线观看 | 国产又粗又长又黄的视频 | 亚洲欧美日韩色 | 啪啪影音| 九九热精品免费视频 | 国产a视频免费观看 | 少妇精品无码一区二区免费视频 | 雪白的扔子视频大全在线观看 |