您好,登錄后才能下訂單哦!
CABasicAnimation * basic = [CABasicAnimation animationWithKeyPath:@"bounds"];
basic.duration = 5;
basic.fromValue = [NSValue valueWithCGRect:CGRectMake(0, 0, 200, 200)];
basic.toValue = [NSValue valueWithCGRect:CGRectMake(0, 0, 300, 300)];
CAKeyframeAnimation * keyFrame = [CAKeyframeAnimation animationWithKeyPath:@"backgroundColor"];
keyFrame.duration = 5;
keyFrame.values = @[(id)[UIColor greenColor].CGColor , (id)[UIColor blueColor].CGColor , (id)[UIColor purpleColor].CGColor , (id)[UIColor whiteColor].CGColor];
keyFrame.keyTimes = @[@(0.1),@(0.4),@(0.6),@(0.7)];
創(chuàng)建動(dòng)畫
CAAnimationGroup * gorup = [CAAnimationGroup animation];
設(shè)置組動(dòng)畫
gorup.animations = @[keyFrame,basic];
gorup.duration = 5;
組動(dòng)畫的時(shí)長(zhǎng) > 組中所有動(dòng)畫的最長(zhǎng)時(shí)間的時(shí)候, 動(dòng)畫的時(shí)間以組中最長(zhǎng)的時(shí)間為準(zhǔn) ,
組動(dòng)畫的時(shí)間 < 組中所有動(dòng)畫的最長(zhǎng)時(shí)間, 動(dòng)畫的時(shí)間以group的時(shí)長(zhǎng)為準(zhǔn)
最完美: group的時(shí)長(zhǎng) = 組中所有動(dòng)畫的最長(zhǎng)時(shí)間
添加動(dòng)畫
[self.changeView.layer addAnimation:gorup forKey:nil];
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。