1. <ul id="0c1fb"></ul>

      <noscript id="0c1fb"><video id="0c1fb"></video></noscript>
      <noscript id="0c1fb"><listing id="0c1fb"><thead id="0c1fb"></thead></listing></noscript>

      99热在线精品一区二区三区_国产伦精品一区二区三区女破破_亚洲一区二区三区无码_精品国产欧美日韩另类一区

      RELATEED CONSULTING
      相關(guān)咨詢
      選擇下列產(chǎn)品馬上在線溝通
      服務(wù)時間:8:30-17:00
      你可能遇到了下面的問題
      關(guān)閉右側(cè)工具欄

      新聞中心

      這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
      如何使用iOS仿抖音視頻加載動畫效果-創(chuàng)新互聯(lián)

      小編給大家分享一下如何使用iOS仿抖音視頻加載動畫效果,相信大部分人都還不怎么了解,因此分享這篇文章給大家參考一下,希望大家閱讀完這篇文章后大有收獲,下面讓我們一起去了解一下吧!

      創(chuàng)新互聯(lián)-專業(yè)網(wǎng)站定制、快速模板網(wǎng)站建設(shè)、高性價比本溪網(wǎng)站開發(fā)、企業(yè)建站全套包干低至880元,成熟完善的模板庫,直接使用。一站式本溪網(wǎng)站制作公司更省心,省錢,快速模板網(wǎng)站建設(shè)找我們,業(yè)務(wù)覆蓋本溪地區(qū)。費用合理售后完善,10多年實體公司更值得信賴。

      實現(xiàn)原理

      首先我創(chuàng)建一個視圖

      @interface ViewController ()@property (nonatomic, strong) UIView *playLoadingView;@end@implementation ViewController- (void)viewDidLoad { [super viewDidLoad]; //init player status bar self.playLoadingView = [[UIView alloc]init]; self.playLoadingView.backgroundColor = [UIColor whiteColor]; [self.playLoadingView setHidden:YES]; [self.view addSubview:self.playLoadingView]; //make constraintes [self.playLoadingView mas_makeConstraints:^(MASConstraintMaker *make) { make.center.equalTo(self.view); make.width.mas_equalTo(1.0f); //寬 1 dp make.height.mas_equalTo(0.5f); //高 0.5 dp }]; [self startLoadingPlayAnimation:YES]; //調(diào)用動畫代碼}

      這里我們可以看到 我們實際上創(chuàng)建的是一個 1pt寬度 0.5 pt的寬度 的視圖

      緊接著動畫實現(xiàn)的代碼

      - (void)startLoadingPlayAnimation:(BOOL)isStart { if (isStart) { self.playLoadingView.backgroundColor = [UIColor whiteColor]; self.playLoadingView.hidden = NO; [self.playLoadingView.layer removeAllAnimations]; CAAnimationGroup *animationGroup = [[CAAnimationGroup alloc] init]; animationGroup.duration = 0.5; animationGroup.beginTime = CACurrentMediaTime() + 0.5; animationGroup.repeatCount = MAXFLOAT; animationGroup.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]; CABasicAnimation *scaleAnimation = [CABasicAnimation animation]; scaleAnimation.keyPath = @"transform.scale.x"; scaleAnimation.fromValue = @(1.0f); scaleAnimation.toValue = @(1.0f * ScreenWidth); CABasicAnimation *alphaAnimation = [CABasicAnimation animation]; alphaAnimation.keyPath = @"opacity"; alphaAnimation.fromValue = @(1.0f); alphaAnimation.toValue = @(0.5f); [animationGroup setAnimations:@[scaleAnimation, alphaAnimation]]; [self.playLoadingView.layer addAnimation:animationGroup forKey:nil]; } else { [self.playLoadingView.layer removeAllAnimations]; self.playLoadingView.hidden = YES; }}

      完事 就這幾行代碼 搞定

      其實核心的只有4行代碼

      CABasicAnimation *scaleAnimation = [CABasicAnimation animation];scaleAnimation.keyPath = @"transform.scale.x";scaleAnimation.fromValue = @(1.0f);scaleAnimation.toValue = @(1.0f * ScreenWidth);

      關(guān)鍵在scaleAnimation.keyPath = @"transform.scale.x";這里我們要沿著x做縮放

      縮放的得值從 1~屏幕寬度, 當(dāng)然值多大自己可以控制.

      如果@"transform.scale.y"則是沿著Y軸縮放

      當(dāng)然 如果寫成@"transform.scale"那就X,Y 一起縮放 大家可以試試.

      以上是“如何使用iOS仿抖音視頻加載動畫效果”這篇文章的所有內(nèi)容,感謝各位的閱讀!相信大家都有了一定的了解,希望分享的內(nèi)容對大家有所幫助,如果還想學(xué)習(xí)更多知識,歡迎關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道!


      分享名稱:如何使用iOS仿抖音視頻加載動畫效果-創(chuàng)新互聯(lián)
      網(wǎng)站地址:http://www.ef60e0e.cn/article/coiscc.html
      99热在线精品一区二区三区_国产伦精品一区二区三区女破破_亚洲一区二区三区无码_精品国产欧美日韩另类一区
      1. <ul id="0c1fb"></ul>

        <noscript id="0c1fb"><video id="0c1fb"></video></noscript>
        <noscript id="0c1fb"><listing id="0c1fb"><thead id="0c1fb"></thead></listing></noscript>

        沂源县| 商水县| 呼玛县| 襄樊市| 新郑市| 安龙县| 武胜县| 岐山县| 宜昌市| 棋牌| 绥阳县| 大宁县| 惠州市| 吉木萨尔县| 云龙县| 沭阳县| 龙江县| 呼伦贝尔市| 大新县| 湘潭市| 深泽县| 房产| 婺源县| 梅河口市| 岗巴县| 全南县| 黎平县| 左云县| 西乌珠穆沁旗| 巴南区| 铜川市| 江都市| 乌拉特前旗| 河间市| 岳普湖县| 合江县| 常德市| 洪雅县| 香河县| 高青县| 山东省|