国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 系統 > iOS > 正文

iOS 動畫(1)

2019-11-07 23:46:46
字體:
來源:轉載
供稿:網友

設置UIImageView

_imageAime = [[UIImageView alloc]initWithFrame:CGRectMake(50, 100, 100, 100)];

_imageAime.image =[UIImage imageNamed:@"icon_baiban"];

[self.view addSubview:_imageAime];

//縮放效果

-(void)Zoom{

  [UIView animateWithDuration:3 animations:^{        //動畫的邏輯    _imageAime.frame =CGRectMake(10, 200, 300, 250);    } completion:^(BOOL finished) {        //動畫結束之后要執行的代碼        //重開了一個UIView動畫,還原位置        [UIView animateWithDuration:3 animations:^{            _imageAime.frame =CGRectMake(50, 100, 100, 100);        }];    }];

}

//旋轉效果

-(void)rotation{

    CABasicAnimation *basianimation = [CABasicAnimation animationWithKeyPath:@"transform.rotation"];

     //設置時長

    [basianimation setDuration:10];

    //重復次數

    [basianimation setRepeatCount:2];

   //所改變屬性的起始值

    basianimation.fromValue = [NSNumber numberWithDouble:2];

    //所改變屬性的結束時的值

    basianimation.toValue = [NSNumber numberWithDouble:M_PI * 20];    [_imageAime.layer addAnimation:basianimation forKey:nil];

    //動畫結束時是否執行逆動畫

    basianimation.autoreverses = YES;

}

//虛化效果

-(void)grammaticalization{

  //第三種UIView動畫的另一種寫法(沒有block)    [UIView beginAnimations:@"view動畫的另一種寫法" context:nil];    //設置時長    [UIView setAnimationDuration:1];    //設置重復次數    [UIView setAnimationRepeatCount:NSIntegerMax];    //動畫的邏輯    _imageAime.alpha =0.4;    //結束動畫    [UIView commitAnimations];

}

//

-(void)tremble{

 //2,延時時間(等待)3,顫抖效果,值越小,抖動的越厲害 4,開始時的動畫速度,值越大速度越快    [UIView animateWithDuration:2 delay:1 usingSPRingWithDamping:0.2 initialSpringVelocity:3 options:UIViewAnimationOptionCurveEaseInOut animations:^{        _imageAime.frame =CGRectMake(100, 400, 300, 250);    } completion:^(BOOL finished) {            }];

}

-(void)curve{

    //關鍵幀動畫    CAKeyframeAnimation *keyanimation = [CAKeyframeAnimation animationWithKeyPath:@"position"];    //創建一個路徑, 用來記錄每一幀    CGMutablePathRef path = CGPathCreateMutable();    //指定移動的起點    CGPathMoveToPoint(path, NULL, _imageAime.center.x, _imageAime.center.y);    //畫一條曲線(貝塞爾曲線)    CGPathAddCurveToPoint(path, NULL, 100, 100, 370, 320, 100, 690);        //設置路徑    [keyanimation setPath:path];    //設置時間    [keyanimation setDuration:3];    //設置重復次數    [keyanimation setRepeatCount:1];        [_imageAime.layer addAnimation:keyanimation forKey:@"keyanimation"     ];

}


發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 鄄城县| 贺州市| 巴彦淖尔市| 东海县| 定兴县| 洪江市| 乐亭县| 双辽市| 巴马| 将乐县| 内丘县| 鄄城县| 甘德县| 宜阳县| 清流县| 桃园市| 镇巴县| 锦屏县| 五寨县| 黔西| 曲阜市| 廊坊市| 麻江县| 黄陵县| 镇江市| 行唐县| 寿宁县| 安康市| 津南区| 容城县| 桑日县| 东明县| 通榆县| 喀什市| 且末县| 黑河市| 禄丰县| 九龙县| 手机| 泰宁县| 东阳市|