Facebook 開源動(dòng)畫庫 POP

使用時(shí) 在Podfile文件里添加

pod 'pop'

在文件中引入頭文件

#import <POP.h>

在使用時(shí) 創(chuàng)建一個(gè)pop類



  
    /**
     *  POPAnimation 是所有動(dòng)畫的基類  不可以使用;
     *  POPSpringAnimation的彈簧效果類  還有POPBasicAnimation基
     *  本效果類;
     *  POPDecayAnimation 衰減動(dòng)畫效果;
     *  kPOPLayerPositionX是修改動(dòng)畫的X屬性
     *
     */

    POPSpringAnimation* anim = [POPSpringAnimation animationWithPropertyNamed:kPOPLayerSize];
    
    anim.beginTime = CACurrentMediaTime() +2.0;
    anim.springBounciness = 20;
    anim.fromValue = [NSValue valueWithCGSize:self.Img.frame.size];
//    anim.fromValue = @(self.Img.frame.size.width);
    anim.toValue = [NSValue valueWithCGSize:CGSizeMake(50, 50)];
    /**
     *  設(shè)置key是標(biāo)記這個(gè)動(dòng)畫效果,以后可以通過key來找
     */
    [self.Img pop_addAnimation:anim forKey:@"通過這個(gè)key可以拿到這個(gè)動(dòng)畫"];
    POPSpringAnimation * an = [self.Img pop_animationForKey:@"通過這個(gè)key可以拿到這個(gè)動(dòng)畫"];
        NSLog(@"%@",an.toValue);
//動(dòng)畫執(zhí)行完成后調(diào)用block;
    anim.completionBlock=^(POPAnimation * anim ,BOOL finished){
            NSLog(@"完成動(dòng)畫");
    };

學(xué)習(xí)pop的demo
https://github.com/MartinRGB/LearnCube-iOS
https://github.com/schneiderandre/popping

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容