SVGAPlayer.m 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480
  1. //
  2. // SVGAPlayer.m
  3. // SVGAPlayer
  4. //
  5. // Created by 崔明辉 on 16/6/17.
  6. // Copyright © 2016年 UED Center. All rights reserved.
  7. //
  8. #import "SVGAPlayer.h"
  9. #import "SVGAVideoEntity.h"
  10. #import "SVGAVideoSpriteEntity.h"
  11. #import "SVGAVideoSpriteFrameEntity.h"
  12. #import "SVGAContentLayer.h"
  13. #import "SVGABitmapLayer.h"
  14. #import "SVGAVectorLayer.h"
  15. #import "SVGAAudioLayer.h"
  16. #import "SVGAAudioEntity.h"
  17. @interface SVGAPlayer ()
  18. @property (nonatomic, strong) CALayer *drawLayer;
  19. @property (nonatomic, strong) NSArray<SVGAAudioLayer *> *audioLayers;
  20. @property (nonatomic, strong) CADisplayLink *displayLink;
  21. @property (nonatomic, assign) NSInteger currentFrame;
  22. @property (nonatomic, copy) NSArray *contentLayers;
  23. @property (nonatomic, copy) NSDictionary<NSString *, UIImage *> *dynamicObjects;
  24. @property (nonatomic, copy) NSDictionary<NSString *, NSAttributedString *> *dynamicTexts;
  25. @property (nonatomic, copy) NSDictionary<NSString *, SVGAPlayerDynamicDrawingBlock> *dynamicDrawings;
  26. @property (nonatomic, copy) NSDictionary<NSString *, NSNumber *> *dynamicHiddens;
  27. @property (nonatomic, assign) int loopCount;
  28. @property (nonatomic, assign) NSRange currentRange;
  29. @property (nonatomic, assign) BOOL forwardAnimating;
  30. @property (nonatomic, assign) BOOL reversing;
  31. @end
  32. @implementation SVGAPlayer
  33. - (instancetype)initWithFrame:(CGRect)frame
  34. {
  35. self = [super initWithFrame:frame];
  36. if (self) {
  37. self.contentMode = UIViewContentModeTop;
  38. self.clearsAfterStop = YES;
  39. }
  40. return self;
  41. }
  42. - (void)willMoveToSuperview:(UIView *)newSuperview {
  43. [super willMoveToSuperview:newSuperview];
  44. if (newSuperview == nil) {
  45. [self stopAnimation:YES];
  46. }
  47. }
  48. - (void)startAnimation {
  49. if (self.videoItem == nil) {
  50. NSLog(@"videoItem could not be nil!");
  51. return;
  52. }
  53. [self stopAnimation:NO];
  54. self.loopCount = 0;
  55. self.displayLink = [CADisplayLink displayLinkWithTarget:self selector:@selector(next)];
  56. self.displayLink.frameInterval = 60 / self.videoItem.FPS;
  57. [self.displayLink addToRunLoop:[NSRunLoop mainRunLoop] forMode:NSRunLoopCommonModes];
  58. self.forwardAnimating = !self.reversing;
  59. }
  60. - (void)startAnimationWithRange:(NSRange)range reverse:(BOOL)reverse {
  61. self.currentRange = range;
  62. self.reversing = reverse;
  63. if (reverse) {
  64. self.currentFrame = MIN(self.videoItem.frames - 1, range.location + range.length - 1);
  65. }
  66. else {
  67. self.currentFrame = MAX(0, range.location);
  68. }
  69. [self startAnimation];
  70. }
  71. - (void)pauseAnimation {
  72. [self stopAnimation:NO];
  73. }
  74. - (void)stopAnimation {
  75. [self stopAnimation:self.clearsAfterStop];
  76. }
  77. - (void)stopAnimation:(BOOL)clear {
  78. self.forwardAnimating = NO;
  79. if (self.displayLink != nil) {
  80. [self.displayLink invalidate];
  81. }
  82. if (clear) {
  83. [self clear];
  84. }
  85. [self clearAudios];
  86. self.displayLink = nil;
  87. }
  88. - (void)clear {
  89. _contentLayers = nil;
  90. [self.drawLayer removeFromSuperlayer];
  91. }
  92. - (void)clearAudios {
  93. for (SVGAAudioLayer *layer in self.audioLayers) {
  94. [layer.audioPlayer stop];
  95. }
  96. }
  97. - (void)stepToFrame:(NSInteger)frame andPlay:(BOOL)andPlay {
  98. if (frame >= self.videoItem.frames || frame < 0) {
  99. return;
  100. }
  101. [self pauseAnimation];
  102. self.currentFrame = frame;
  103. [self update];
  104. if (andPlay) {
  105. self.displayLink = [CADisplayLink displayLinkWithTarget:self selector:@selector(next)];
  106. self.displayLink.frameInterval = 60 / self.videoItem.FPS;
  107. [self.displayLink addToRunLoop:[NSRunLoop mainRunLoop] forMode:NSRunLoopCommonModes];
  108. }
  109. }
  110. - (void)stepToPercentage:(CGFloat)percentage andPlay:(BOOL)andPlay {
  111. NSInteger frame = (NSInteger)(self.videoItem.frames * percentage);
  112. if (frame >= self.videoItem.frames && frame > 0) {
  113. frame = self.videoItem.frames - 1;
  114. }
  115. [self stepToFrame:frame andPlay:andPlay];
  116. }
  117. - (void)draw {
  118. self.drawLayer = [[CALayer alloc] init];
  119. self.drawLayer.frame = CGRectMake(0, 0, self.videoItem.videoSize.width, self.videoItem.videoSize.height);
  120. self.drawLayer.masksToBounds = true;
  121. NSMutableDictionary *tempHostLayers = [NSMutableDictionary dictionary];
  122. NSMutableArray *tempContentLayers = [NSMutableArray array];
  123. [self.videoItem.sprites enumerateObjectsUsingBlock:^(SVGAVideoSpriteEntity * _Nonnull sprite, NSUInteger idx, BOOL * _Nonnull stop) {
  124. UIImage *bitmap;
  125. if (sprite.imageKey != nil) {
  126. NSString *bitmapKey = [sprite.imageKey stringByDeletingPathExtension];
  127. if (self.dynamicObjects[bitmapKey] != nil) {
  128. bitmap = self.dynamicObjects[bitmapKey];
  129. }
  130. else {
  131. bitmap = self.videoItem.images[bitmapKey];
  132. }
  133. }
  134. SVGAContentLayer *contentLayer = [sprite requestLayerWithBitmap:bitmap];
  135. contentLayer.imageKey = sprite.imageKey;
  136. [tempContentLayers addObject:contentLayer];
  137. if ([sprite.imageKey hasSuffix:@".matte"]) {
  138. CALayer *hostLayer = [[CALayer alloc] init];
  139. hostLayer.mask = contentLayer;
  140. tempHostLayers[sprite.imageKey] = hostLayer;
  141. } else {
  142. if (sprite.matteKey && sprite.matteKey.length > 0) {
  143. CALayer *hostLayer = tempHostLayers[sprite.matteKey];
  144. [hostLayer addSublayer:contentLayer];
  145. if (![sprite.matteKey isEqualToString:self.videoItem.sprites[idx - 1].matteKey]) {
  146. [self.drawLayer addSublayer:hostLayer];
  147. }
  148. } else {
  149. [self.drawLayer addSublayer:contentLayer];
  150. }
  151. }
  152. if (sprite.imageKey != nil) {
  153. if (self.dynamicTexts[sprite.imageKey] != nil) {
  154. NSAttributedString *text = self.dynamicTexts[sprite.imageKey];
  155. CGSize size = [text boundingRectWithSize:CGSizeMake(CGFLOAT_MAX, CGFLOAT_MAX) options:NSStringDrawingUsesLineFragmentOrigin context:NULL].size;
  156. CATextLayer *textLayer = [CATextLayer layer];
  157. textLayer.contentsScale = [[UIScreen mainScreen] scale];
  158. [textLayer setString:self.dynamicTexts[sprite.imageKey]];
  159. textLayer.frame = CGRectMake(0, 0, size.width, size.height);
  160. [contentLayer addSublayer:textLayer];
  161. contentLayer.textLayer = textLayer;
  162. }
  163. if (self.dynamicHiddens[sprite.imageKey] != nil &&
  164. [self.dynamicHiddens[sprite.imageKey] boolValue] == YES) {
  165. contentLayer.dynamicHidden = YES;
  166. }
  167. if (self.dynamicDrawings[sprite.imageKey] != nil) {
  168. contentLayer.dynamicDrawingBlock = self.dynamicDrawings[sprite.imageKey];
  169. }
  170. }
  171. }];
  172. _contentLayers = tempContentLayers;
  173. [self.layer addSublayer:self.drawLayer];
  174. NSMutableArray *audioLayers = [NSMutableArray array];
  175. [self.videoItem.audios enumerateObjectsUsingBlock:^(SVGAAudioEntity * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
  176. SVGAAudioLayer *audioLayer = [[SVGAAudioLayer alloc] initWithAudioItem:obj videoItem:self.videoItem];
  177. [audioLayers addObject:audioLayer];
  178. }];
  179. self.audioLayers = audioLayers;
  180. [self update];
  181. [self resize];
  182. }
  183. - (void)resize {
  184. if (self.contentMode == UIViewContentModeScaleAspectFit) {
  185. CGFloat videoRatio = self.videoItem.videoSize.width / self.videoItem.videoSize.height;
  186. CGFloat layerRatio = self.bounds.size.width / self.bounds.size.height;
  187. if (videoRatio > layerRatio) {
  188. CGFloat ratio = self.bounds.size.width / self.videoItem.videoSize.width;
  189. CGPoint offset = CGPointMake(
  190. (1.0 - ratio) / 2.0 * self.videoItem.videoSize.width,
  191. (1.0 - ratio) / 2.0 * self.videoItem.videoSize.height
  192. - (self.bounds.size.height - self.videoItem.videoSize.height * ratio) / 2.0
  193. );
  194. self.drawLayer.transform = CATransform3DMakeAffineTransform(CGAffineTransformMake(ratio, 0, 0, ratio, -offset.x, -offset.y));
  195. }
  196. else {
  197. CGFloat ratio = self.bounds.size.height / self.videoItem.videoSize.height;
  198. CGPoint offset = CGPointMake(
  199. (1.0 - ratio) / 2.0 * self.videoItem.videoSize.width - (self.bounds.size.width - self.videoItem.videoSize.width * ratio) / 2.0,
  200. (1.0 - ratio) / 2.0 * self.videoItem.videoSize.height);
  201. self.drawLayer.transform = CATransform3DMakeAffineTransform(CGAffineTransformMake(ratio, 0, 0, ratio, -offset.x, -offset.y));
  202. }
  203. }
  204. else if (self.contentMode == UIViewContentModeScaleAspectFill) {
  205. CGFloat videoRatio = self.videoItem.videoSize.width / self.videoItem.videoSize.height;
  206. CGFloat layerRatio = self.bounds.size.width / self.bounds.size.height;
  207. if (videoRatio < layerRatio) {
  208. CGFloat ratio = self.bounds.size.width / self.videoItem.videoSize.width;
  209. CGPoint offset = CGPointMake(
  210. (1.0 - ratio) / 2.0 * self.videoItem.videoSize.width,
  211. (1.0 - ratio) / 2.0 * self.videoItem.videoSize.height
  212. - (self.bounds.size.height - self.videoItem.videoSize.height * ratio) / 2.0
  213. );
  214. self.drawLayer.transform = CATransform3DMakeAffineTransform(CGAffineTransformMake(ratio, 0, 0, ratio, -offset.x, -offset.y));
  215. }
  216. else {
  217. CGFloat ratio = self.bounds.size.height / self.videoItem.videoSize.height;
  218. CGPoint offset = CGPointMake(
  219. (1.0 - ratio) / 2.0 * self.videoItem.videoSize.width - (self.bounds.size.width - self.videoItem.videoSize.width * ratio) / 2.0,
  220. (1.0 - ratio) / 2.0 * self.videoItem.videoSize.height);
  221. self.drawLayer.transform = CATransform3DMakeAffineTransform(CGAffineTransformMake(ratio, 0, 0, ratio, -offset.x, -offset.y));
  222. }
  223. }
  224. else if (self.contentMode == UIViewContentModeTop) {
  225. CGFloat scaleX = self.frame.size.width / self.videoItem.videoSize.width;
  226. CGPoint offset = CGPointMake((1.0 - scaleX) / 2.0 * self.videoItem.videoSize.width, (1 - scaleX) / 2.0 * self.videoItem.videoSize.height);
  227. self.drawLayer.transform = CATransform3DMakeAffineTransform(CGAffineTransformMake(scaleX, 0, 0, scaleX, -offset.x, -offset.y));
  228. }
  229. else if (self.contentMode == UIViewContentModeBottom) {
  230. CGFloat scaleX = self.frame.size.width / self.videoItem.videoSize.width;
  231. CGPoint offset = CGPointMake(
  232. (1.0 - scaleX) / 2.0 * self.videoItem.videoSize.width,
  233. (1.0 - scaleX) / 2.0 * self.videoItem.videoSize.height);
  234. self.drawLayer.transform = CATransform3DMakeAffineTransform(CGAffineTransformMake(scaleX, 0, 0, scaleX, -offset.x, -offset.y + self.frame.size.height - self.videoItem.videoSize.height * scaleX));
  235. }
  236. else if (self.contentMode == UIViewContentModeLeft) {
  237. CGFloat scaleY = self.frame.size.height / self.videoItem.videoSize.height;
  238. CGPoint offset = CGPointMake((1.0 - scaleY) / 2.0 * self.videoItem.videoSize.width, (1 - scaleY) / 2.0 * self.videoItem.videoSize.height);
  239. self.drawLayer.transform = CATransform3DMakeAffineTransform(CGAffineTransformMake(scaleY, 0, 0, scaleY, -offset.x, -offset.y));
  240. }
  241. else if (self.contentMode == UIViewContentModeRight) {
  242. CGFloat scaleY = self.frame.size.height / self.videoItem.videoSize.height;
  243. CGPoint offset = CGPointMake(
  244. (1.0 - scaleY) / 2.0 * self.videoItem.videoSize.width,
  245. (1.0 - scaleY) / 2.0 * self.videoItem.videoSize.height);
  246. self.drawLayer.transform = CATransform3DMakeAffineTransform(CGAffineTransformMake(scaleY, 0, 0, scaleY, -offset.x + self.frame.size.width - self.videoItem.videoSize.width * scaleY, -offset.y));
  247. }
  248. else {
  249. CGFloat scaleX = self.frame.size.width / self.videoItem.videoSize.width;
  250. CGFloat scaleY = self.frame.size.height / self.videoItem.videoSize.height;
  251. CGPoint offset = CGPointMake((1.0 - scaleX) / 2.0 * self.videoItem.videoSize.width, (1 - scaleY) / 2.0 * self.videoItem.videoSize.height);
  252. self.drawLayer.transform = CATransform3DMakeAffineTransform(CGAffineTransformMake(scaleX, 0, 0, scaleY, -offset.x, -offset.y));
  253. }
  254. }
  255. - (void)layoutSubviews {
  256. [super layoutSubviews];
  257. [self resize];
  258. }
  259. - (void)update {
  260. [CATransaction setDisableActions:YES];
  261. for (SVGAContentLayer *layer in _contentLayers) {
  262. if ([layer isKindOfClass:[SVGAContentLayer class]]) {
  263. [layer stepToFrame:self.currentFrame];
  264. }
  265. }
  266. [CATransaction setDisableActions:NO];
  267. if (self.forwardAnimating && self.audioLayers.count > 0) {
  268. for (SVGAAudioLayer *layer in self.audioLayers) {
  269. if (layer.audioItem.startFrame == self.currentFrame) {
  270. [layer.audioPlayer setCurrentTime:(NSTimeInterval)(layer.audioItem.startTime / 1000)];
  271. [layer.audioPlayer play];
  272. }
  273. else if (layer.audioItem.endFrame <= self.currentFrame) {
  274. [layer.audioPlayer stop];
  275. }
  276. }
  277. }
  278. }
  279. - (void)next {
  280. if (self.reversing) {
  281. self.currentFrame--;
  282. if (self.currentFrame < (NSInteger)MAX(0, self.currentRange.location)) {
  283. self.currentFrame = MIN(self.videoItem.frames - 1, self.currentRange.location + self.currentRange.length - 1);
  284. self.loopCount++;
  285. }
  286. }
  287. else {
  288. self.currentFrame++;
  289. if (self.currentFrame >= MIN(self.videoItem.frames, self.currentRange.location + self.currentRange.length)) {
  290. self.currentFrame = MAX(0, self.currentRange.location);
  291. [self clearAudios];
  292. self.loopCount++;
  293. }
  294. }
  295. if (self.loops > 0 && self.loopCount >= self.loops) {
  296. [self stopAnimation];
  297. if (!self.clearsAfterStop && [self.fillMode isEqualToString:@"Backward"]) {
  298. [self stepToFrame:MAX(0, self.currentRange.location) andPlay:NO];
  299. }
  300. else if (!self.clearsAfterStop && [self.fillMode isEqualToString:@"Forward"]) {
  301. [self stepToFrame:MIN(self.videoItem.frames - 1, self.currentRange.location + self.currentRange.length - 1) andPlay:NO];
  302. }
  303. id delegate = self.delegate;
  304. if (delegate != nil && [delegate respondsToSelector:@selector(svgaPlayerDidFinishedAnimation:)]) {
  305. [delegate svgaPlayerDidFinishedAnimation:self];
  306. }
  307. return;
  308. }
  309. [self update];
  310. id delegate = self.delegate;
  311. if (delegate != nil && [delegate respondsToSelector:@selector(svgaPlayerDidAnimatedToFrame:)]) {
  312. [delegate svgaPlayerDidAnimatedToFrame:self.currentFrame];
  313. }
  314. if (delegate != nil && [delegate respondsToSelector:@selector(svgaPlayerDidAnimatedToPercentage:)] && self.videoItem.frames > 0) {
  315. [delegate svgaPlayerDidAnimatedToPercentage:(CGFloat)(self.currentFrame + 1) / (CGFloat)self.videoItem.frames];
  316. }
  317. }
  318. - (void)setVideoItem:(SVGAVideoEntity *)videoItem {
  319. _videoItem = videoItem;
  320. _currentRange = NSMakeRange(0, videoItem.frames);
  321. _reversing = NO;
  322. _currentFrame = 0;
  323. [[NSOperationQueue mainQueue] addOperationWithBlock:^{
  324. [self clear];
  325. [self draw];
  326. }];
  327. }
  328. #pragma mark - Dynamic Object
  329. - (void)setImage:(UIImage *)image forKey:(NSString *)aKey {
  330. if (image == nil) {
  331. return;
  332. }
  333. NSMutableDictionary *mutableDynamicObjects = [self.dynamicObjects mutableCopy];
  334. [mutableDynamicObjects setObject:image forKey:aKey];
  335. self.dynamicObjects = mutableDynamicObjects;
  336. if (_contentLayers.count > 0) {
  337. for (SVGAContentLayer *layer in _contentLayers) {
  338. if ([layer isKindOfClass:[SVGAContentLayer class]] && [layer.imageKey isEqualToString:aKey]) {
  339. layer.bitmapLayer.contents = (__bridge id _Nullable)([image CGImage]);
  340. }
  341. }
  342. }
  343. }
  344. - (void)setImageWithURL:(NSURL *)URL forKey:(NSString *)aKey {
  345. [[[NSURLSession sharedSession] dataTaskWithURL:URL completionHandler:^(NSData * _Nullable data, NSURLResponse * _Nullable response, NSError * _Nullable error) {
  346. if (error == nil && data != nil) {
  347. UIImage *image = [UIImage imageWithData:data];
  348. if (image != nil) {
  349. [[NSOperationQueue mainQueue] addOperationWithBlock:^{
  350. [self setImage:image forKey:aKey];
  351. }];
  352. }
  353. }
  354. }] resume];
  355. }
  356. - (void)setImage:(UIImage *)image forKey:(NSString *)aKey referenceLayer:(CALayer *)referenceLayer {
  357. [self setImage:image forKey:aKey];
  358. }
  359. - (void)setAttributedText:(NSAttributedString *)attributedText forKey:(NSString *)aKey {
  360. if (attributedText == nil) {
  361. return;
  362. }
  363. NSMutableDictionary *mutableDynamicTexts = [self.dynamicTexts mutableCopy];
  364. [mutableDynamicTexts setObject:attributedText forKey:aKey];
  365. self.dynamicTexts = mutableDynamicTexts;
  366. if (_contentLayers.count > 0) {
  367. CGSize size = [attributedText boundingRectWithSize:CGSizeMake(CGFLOAT_MAX, CGFLOAT_MAX) options:NSStringDrawingUsesLineFragmentOrigin context:NULL].size;
  368. CATextLayer *textLayer;
  369. for (SVGAContentLayer *layer in _contentLayers) {
  370. if ([layer isKindOfClass:[SVGAContentLayer class]] && [layer.imageKey isEqualToString:aKey]) {
  371. textLayer = layer.textLayer;
  372. if (textLayer == nil) {
  373. textLayer = [CATextLayer layer];
  374. [layer addSublayer:textLayer];
  375. layer.textLayer = textLayer;
  376. }
  377. }
  378. }
  379. if (textLayer != nil) {
  380. textLayer.contentsScale = [[UIScreen mainScreen] scale];
  381. [textLayer setString:attributedText];
  382. textLayer.frame = CGRectMake(0, 0, size.width, size.height);
  383. }
  384. }
  385. }
  386. - (void)setDrawingBlock:(SVGAPlayerDynamicDrawingBlock)drawingBlock forKey:(NSString *)aKey {
  387. NSMutableDictionary *mutableDynamicDrawings = [self.dynamicDrawings mutableCopy];
  388. [mutableDynamicDrawings setObject:drawingBlock forKey:aKey];
  389. self.dynamicDrawings = mutableDynamicDrawings;
  390. if (_contentLayers.count > 0) {
  391. for (SVGAContentLayer *layer in _contentLayers) {
  392. if ([layer isKindOfClass:[SVGAContentLayer class]] &&
  393. [layer.imageKey isEqualToString:aKey]) {
  394. layer.dynamicDrawingBlock = drawingBlock;
  395. }
  396. }
  397. }
  398. }
  399. - (void)setHidden:(BOOL)hidden forKey:(NSString *)aKey {
  400. NSMutableDictionary *mutableDynamicHiddens = [self.dynamicHiddens mutableCopy];
  401. [mutableDynamicHiddens setObject:@(hidden) forKey:aKey];
  402. self.dynamicHiddens = mutableDynamicHiddens;
  403. if (_contentLayers.count > 0) {
  404. for (SVGAContentLayer *layer in _contentLayers) {
  405. if ([layer isKindOfClass:[SVGAContentLayer class]] &&
  406. [layer.imageKey isEqualToString:aKey]) {
  407. layer.dynamicHidden = hidden;
  408. }
  409. }
  410. }
  411. }
  412. - (void)clearDynamicObjects {
  413. self.dynamicObjects = nil;
  414. self.dynamicTexts = nil;
  415. self.dynamicHiddens = nil;
  416. self.dynamicDrawings = nil;
  417. }
  418. - (NSDictionary *)dynamicObjects {
  419. if (_dynamicObjects == nil) {
  420. _dynamicObjects = @{};
  421. }
  422. return _dynamicObjects;
  423. }
  424. - (NSDictionary *)dynamicTexts {
  425. if (_dynamicTexts == nil) {
  426. _dynamicTexts = @{};
  427. }
  428. return _dynamicTexts;
  429. }
  430. - (NSDictionary *)dynamicHiddens {
  431. if (_dynamicHiddens == nil) {
  432. _dynamicHiddens = @{};
  433. }
  434. return _dynamicHiddens;
  435. }
  436. - (NSDictionary<NSString *,SVGAPlayerDynamicDrawingBlock> *)dynamicDrawings {
  437. if (_dynamicDrawings == nil) {
  438. _dynamicDrawings = @{};
  439. }
  440. return _dynamicDrawings;
  441. }
  442. @end