使用時(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