使用時 在Podfile文件里添加
pod 'pop'
在文件中引入頭文件
#import <POP.h>
在使用時 創(chuàng)建一個pop類
/**
* POPAnimation 是所有動畫的基類 不可以使用;
* POPSpringAnimation的彈簧效果類 還有POPBasicAnimation基
* 本效果類;
* POPDecayAnimation 衰減動畫效果;
* kPOPLayerPositionX是修改動畫的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)];
/**
* 設置key是標記這個動畫效果,以后可以通過key來找
*/
[self.Img pop_addAnimation:anim forKey:@"通過這個key可以拿到這個動畫"];
POPSpringAnimation * an = [self.Img pop_animationForKey:@"通過這個key可以拿到這個動畫"];
NSLog(@"%@",an.toValue);
//動畫執(zhí)行完成后調(diào)用block;
anim.completionBlock=^(POPAnimation * anim ,BOOL finished){
NSLog(@"完成動畫");
};
學習pop的demo
https://github.com/MartinRGB/LearnCube-iOS
https://github.com/schneiderandre/popping