Github: https://github.com/ShawnFoo/FXAnimationEngine
这一款用于播放序列帧动画却不会导致占用大量内存的动画引擎.
特征播放动画时, 只有正在播放的那张图片会占用内存
支持异步线程图片解码
基于CADisplayLink实现
可以设置某段动画块重复次数
使用方式import "CALayer+FXAnimationEngine.h" in your file first.
// load all image frames NSArray<UIImage *> *frames = ...;FXKeyframeAnimationFXKeyframeAnimation *animation = [FXKeyframeAnimation animationWithIdentifier:@'xxx']; animation.delegate = self; animation.frameImages = frames; animation.duration = 5.5; animation.repeats = 3; // decode image asynchronously [xxxView.layer fx_playAnimationAsyncDecodeImage:animation];FXAnimationGroupFXKeyframeAnimation *animation = [FXKeyframeAnimation animation]; animation.count = 50; // [0, 49] animation.duration = 4.2; FXKeyframeAnimation *animation2 = [FXKeyframeAnimation animation]; animation2.count = 30; // [50, 79] animation2.duration = 1.5; animation2.repeats = 6; // repeat image between index 50 to index 79 six times FXKeyframeAnimation *animation3 = [FXKeyframeAnimation animation]; animation.count = 20; // [80, 99] animation.duration = 2; FXAnimationGroup *animationGroup = [FXAnimationGroup animationWithIdentifier:@'xxxAnimation']; animationGroup.animations = @[animation, animation2, animation3]; animationGroup.frames = frames; animationGroup.delegate = self; [xxxView.layer fx_playAnimation:animation];FXAnimationDelegate- (void)fxAnimationDidStart:(FXAnimation *)anim { // identify your animation by its 'identifier' property } - (void)fxAnimationDidStop:(FXAnimation *)anim finished:(BOOL)finished { // ... },开题报告,开题报告