@octane-xplat/lottie 0.9.0 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (313) hide show
  1. package/README.md +36 -16
  2. package/dist/native/index.js +10 -9
  3. package/dist/native/octane-client-build.json +1 -1
  4. package/dist/web/index.js +39 -25
  5. package/dist/web/octane-client-build.json +1 -1
  6. package/package.json +25 -3
  7. package/platforms/macos/LICENSE-EpoxyCore-Apache-2.0.txt +201 -0
  8. package/platforms/macos/LICENSE-LRUCache-MIT.txt +22 -0
  9. package/platforms/macos/LICENSE-Lottie-Apache-2.0.txt +201 -0
  10. package/platforms/macos/LICENSE-ZIPFoundation-MIT.txt +21 -0
  11. package/platforms/macos/UPSTREAM.md +13 -0
  12. package/platforms/macos/resources/PrivacyInfo.xcprivacy +23 -0
  13. package/platforms/macos/resources/THIRD-PARTY-NOTICES.txt +10 -0
  14. package/platforms/macos/src/XplatAppKitLottie.swift +246 -0
  15. package/platforms/macos/src/vendor/Lottie/PrivacyInfo.xcprivacy +23 -0
  16. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/CAAnimation+TimingConfiguration.swift +81 -0
  17. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/CALayer+addAnimation.swift +476 -0
  18. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/CombinedShapeAnimation.swift +92 -0
  19. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/CustomPathAnimation.swift +89 -0
  20. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/DropShadowAnimation.swift +179 -0
  21. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/EllipseAnimation.swift +53 -0
  22. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/GradientAnimations.swift +287 -0
  23. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/LayerProperty.swift +440 -0
  24. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/OpacityAnimation.swift +53 -0
  25. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/RectangleAnimation.swift +59 -0
  26. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/ShapeAnimation.swift +246 -0
  27. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/StarAnimation.swift +119 -0
  28. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/StrokeAnimation.swift +96 -0
  29. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/TransformAnimations.swift +380 -0
  30. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/VisibilityAnimation.swift +63 -0
  31. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/CompatibilityTracker.swift +129 -0
  32. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/CoreAnimationLayer.swift +645 -0
  33. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Extensions/CALayer+fillBounds.swift +35 -0
  34. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Extensions/KeyframeGroup+exactlyOneKeyframe.swift +28 -0
  35. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Extensions/Keyframes+combined.swift +345 -0
  36. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Extensions/Keyframes+timeRemapping.swift +46 -0
  37. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/AnimationLayer.swift +169 -0
  38. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/BaseAnimationLayer.swift +46 -0
  39. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/BaseCompositionLayer.swift +120 -0
  40. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/CALayer+setupLayerHierarchy.swift +169 -0
  41. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/GradientRenderLayer.swift +101 -0
  42. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/ImageLayer.swift +81 -0
  43. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/InfiniteOpaqueAnimationLayer.swift +57 -0
  44. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/LayerModel+makeAnimationLayer.swift +59 -0
  45. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/MaskCompositionLayer.swift +139 -0
  46. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/PreCompLayer.swift +107 -0
  47. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/RepeaterLayer.swift +113 -0
  48. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/ShapeItemLayer.swift +346 -0
  49. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/ShapeLayer.swift +569 -0
  50. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/SolidLayer.swift +66 -0
  51. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/TextLayer.swift +157 -0
  52. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/TransformLayer.swift +13 -0
  53. package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/ValueProviderStore.swift +157 -0
  54. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Diffing/Collection+Diff.swift +267 -0
  55. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Diffing/Diffable.swift +19 -0
  56. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Diffing/DiffableSection.swift +16 -0
  57. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Diffing/IndexChangeset.swift +187 -0
  58. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Diffing/SectionedChangeset.swift +22 -0
  59. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Logging/EpoxyLogger.swift +102 -0
  60. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/CallbackContextEpoxyModeled.swift +8 -0
  61. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/EpoxyModelArrayBuilder.swift +48 -0
  62. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/EpoxyModelProperty.swift +158 -0
  63. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/EpoxyModelStorage.swift +88 -0
  64. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/EpoxyModeled.swift +54 -0
  65. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Internal/AnyEpoxyModelProperty.swift +31 -0
  66. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Internal/ClassReference.swift +39 -0
  67. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/AnimatedProviding.swift +10 -0
  68. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/DataIDProviding.swift +58 -0
  69. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/DidDisplayProviding.swift +41 -0
  70. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/DidEndDisplayingProviding.swift +42 -0
  71. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/DidSelectProviding.swift +36 -0
  72. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/ErasedContentProviding.swift +49 -0
  73. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/MakeViewProviding.swift +61 -0
  74. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/SetBehaviorsProviding.swift +38 -0
  75. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/SetContentProviding.swift +38 -0
  76. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/StyleIDProviding.swift +38 -0
  77. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/TraitCollectionProviding.swift +14 -0
  78. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/ViewDifferentiatorProviding.swift +34 -0
  79. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/ViewProviding.swift +13 -0
  80. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/WillDisplayProviding.swift +41 -0
  81. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/ViewEpoxyModeled.swift +10 -0
  82. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/README.md +30 -0
  83. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/EpoxySwiftUIIntrinsicContentSizeInvalidator.swift +34 -0
  84. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/EpoxySwiftUILayoutMargins.swift +38 -0
  85. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/EpoxyableView+SwiftUIView.swift +165 -0
  86. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/LayoutUtilities/MeasuringViewRepresentable.swift +127 -0
  87. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/LayoutUtilities/SwiftUIMeasurementContainer.swift +468 -0
  88. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/SwiftUIView.swift +146 -0
  89. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/UIView+SwiftUIView.swift +39 -0
  90. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/UIViewConfiguringSwiftUIView.swift +41 -0
  91. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Views/BehaviorsConfigurableView.swift +45 -0
  92. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Views/ContentConfigurableView.swift +36 -0
  93. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Views/EpoxyableView.swift +5 -0
  94. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Views/StyledView.swift +43 -0
  95. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Views/ViewType.swift +47 -0
  96. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/LRUCache/LRUCache.swift +257 -0
  97. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/LRUCache/README.md +24 -0
  98. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/README.md +43 -0
  99. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Archive+BackingConfiguration.swift +149 -0
  100. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Archive+Deprecated.swift +23 -0
  101. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Archive+Helpers.swift +361 -0
  102. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Archive+MemoryFile.swift +205 -0
  103. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Archive+Progress.swift +66 -0
  104. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Archive+Reading.swift +160 -0
  105. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Archive+ReadingDeprecated.swift +50 -0
  106. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Archive+Writing.swift +403 -0
  107. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Archive+WritingDeprecated.swift +95 -0
  108. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Archive+ZIP64.swift +191 -0
  109. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Archive.swift +404 -0
  110. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Data+Compression.swift +632 -0
  111. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Data+CompressionDeprecated.swift +43 -0
  112. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Data+Serialization.swift +146 -0
  113. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Date+ZIP.swift +101 -0
  114. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Entry+Serialization.swift +191 -0
  115. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Entry+ZIP64.swift +170 -0
  116. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Entry.swift +669 -0
  117. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/FileManager+ZIP.swift +405 -0
  118. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/FileManager+ZIPDeprecated.swift +28 -0
  119. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/README.md +24 -0
  120. package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/URL+ZIP.swift +34 -0
  121. package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/CompLayers/CompositionLayer.swift +177 -0
  122. package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/CompLayers/ImageCompositionLayer.swift +54 -0
  123. package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/CompLayers/MaskContainerLayer.swift +191 -0
  124. package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/CompLayers/NullCompositionLayer.swift +28 -0
  125. package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/CompLayers/PreCompositionLayer.swift +137 -0
  126. package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/CompLayers/ShapeCompositionLayer.swift +60 -0
  127. package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/CompLayers/SolidCompositionLayer.swift +57 -0
  128. package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/CompLayers/TextCompositionLayer.swift +247 -0
  129. package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/MainThreadAnimationLayer.swift +321 -0
  130. package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/Utility/CachedImageProvider.swift +56 -0
  131. package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/Utility/CompositionLayersInitializer.swift +103 -0
  132. package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/Utility/CoreTextRenderLayer.swift +424 -0
  133. package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/Utility/InvertedMatteLayer.swift +55 -0
  134. package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/Utility/LayerFontProvider.swift +39 -0
  135. package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/Utility/LayerImageProvider.swift +52 -0
  136. package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/Utility/LayerTextProvider.swift +38 -0
  137. package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/Utility/LayerTransformNode.swift +149 -0
  138. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Extensions/ItemsExtension.swift +146 -0
  139. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/NodeProperties/NodeProperty.swift +62 -0
  140. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/NodeProperties/Protocols/AnyNodeProperty.swift +53 -0
  141. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/NodeProperties/Protocols/AnyValueContainer.swift +26 -0
  142. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/NodeProperties/Protocols/KeypathSearchable.swift +23 -0
  143. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/NodeProperties/Protocols/NodePropertyMap.swift +43 -0
  144. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/NodeProperties/ValueContainer.swift +47 -0
  145. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/NodeProperties/ValueProviders/GroupInterpolator.swift +39 -0
  146. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/NodeProperties/ValueProviders/SingleValueProvider.swift +43 -0
  147. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/LayerEffectNodes/DropShadowNode.swift +102 -0
  148. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/LayerEffectNodes/LayerEffectNode.swift +25 -0
  149. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/ModifierNodes/RoundedCornersNode.swift +85 -0
  150. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/ModifierNodes/TrimPathNode.swift +281 -0
  151. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/OutputNodes/GroupOutputNode.swift +74 -0
  152. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/OutputNodes/PassThroughOutputNode.swift +47 -0
  153. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/OutputNodes/PathOutputNode.swift +89 -0
  154. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/OutputNodes/Renderables/FillRenderer.swift +69 -0
  155. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/OutputNodes/Renderables/GradientFillRenderer.swift +253 -0
  156. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/OutputNodes/Renderables/GradientStrokeRenderer.swift +64 -0
  157. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/OutputNodes/Renderables/LegacyGradientFillRenderer.swift +158 -0
  158. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/OutputNodes/Renderables/StrokeRenderer.swift +165 -0
  159. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/PathNodes/EllipseNode.swift +143 -0
  160. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/PathNodes/PolygonNode.swift +173 -0
  161. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/PathNodes/RectNode.swift +238 -0
  162. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/PathNodes/ShapeNode.swift +73 -0
  163. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/PathNodes/StarNode.swift +224 -0
  164. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/RenderContainers/GroupNode.swift +162 -0
  165. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/RenderNodes/FillNode.swift +88 -0
  166. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/RenderNodes/GradientFillNode.swift +103 -0
  167. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/RenderNodes/GradientStrokeNode.swift +149 -0
  168. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/RenderNodes/StrokeNode.swift +179 -0
  169. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/Text/TextAnimatorNode.swift +345 -0
  170. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Protocols/AnimatorNode.swift +197 -0
  171. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Protocols/PathNode.swift +20 -0
  172. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Protocols/RenderNode.swift +60 -0
  173. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/RenderLayers/ShapeContainerLayer.swift +78 -0
  174. package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/RenderLayers/ShapeRenderLayer.swift +98 -0
  175. package/platforms/macos/src/vendor/Lottie/Private/Model/Assets/Asset.swift +51 -0
  176. package/platforms/macos/src/vendor/Lottie/Private/Model/Assets/AssetLibrary.swift +75 -0
  177. package/platforms/macos/src/vendor/Lottie/Private/Model/Assets/ImageAsset.swift +141 -0
  178. package/platforms/macos/src/vendor/Lottie/Private/Model/Assets/PrecompAsset.swift +47 -0
  179. package/platforms/macos/src/vendor/Lottie/Private/Model/DictionaryInitializable.swift +73 -0
  180. package/platforms/macos/src/vendor/Lottie/Private/Model/DotLottie/DotLottieAnimation.swift +57 -0
  181. package/platforms/macos/src/vendor/Lottie/Private/Model/DotLottie/DotLottieImageProvider.swift +89 -0
  182. package/platforms/macos/src/vendor/Lottie/Private/Model/DotLottie/DotLottieManifest.swift +42 -0
  183. package/platforms/macos/src/vendor/Lottie/Private/Model/DotLottie/DotLottieUtils.swift +71 -0
  184. package/platforms/macos/src/vendor/Lottie/Private/Model/Extensions/Bundle.swift +58 -0
  185. package/platforms/macos/src/vendor/Lottie/Private/Model/Extensions/KeyedDecodingContainerExtensions.swift +71 -0
  186. package/platforms/macos/src/vendor/Lottie/Private/Model/Keyframes/KeyframeData.swift +111 -0
  187. package/platforms/macos/src/vendor/Lottie/Private/Model/Keyframes/KeyframeGroup.swift +265 -0
  188. package/platforms/macos/src/vendor/Lottie/Private/Model/LayerEffects/DropShadowEffect.swift +52 -0
  189. package/platforms/macos/src/vendor/Lottie/Private/Model/LayerEffects/EffectValues/ColorEffectValue.swift +45 -0
  190. package/platforms/macos/src/vendor/Lottie/Private/Model/LayerEffects/EffectValues/EffectValue.swift +98 -0
  191. package/platforms/macos/src/vendor/Lottie/Private/Model/LayerEffects/EffectValues/Vector1DEffectValue.swift +45 -0
  192. package/platforms/macos/src/vendor/Lottie/Private/Model/LayerEffects/LayerEffect.swift +103 -0
  193. package/platforms/macos/src/vendor/Lottie/Private/Model/LayerStyles/DropShadowStyle.swift +79 -0
  194. package/platforms/macos/src/vendor/Lottie/Private/Model/LayerStyles/LayerStyle.swift +85 -0
  195. package/platforms/macos/src/vendor/Lottie/Private/Model/Layers/ImageLayerModel.swift +49 -0
  196. package/platforms/macos/src/vendor/Lottie/Private/Model/Layers/LayerModel.swift +266 -0
  197. package/platforms/macos/src/vendor/Lottie/Private/Model/Layers/PreCompLayerModel.swift +74 -0
  198. package/platforms/macos/src/vendor/Lottie/Private/Model/Layers/ShapeLayerModel.swift +50 -0
  199. package/platforms/macos/src/vendor/Lottie/Private/Model/Layers/SolidLayerModel.swift +63 -0
  200. package/platforms/macos/src/vendor/Lottie/Private/Model/Layers/TextLayerModel.swift +65 -0
  201. package/platforms/macos/src/vendor/Lottie/Private/Model/Objects/DashPattern.swift +42 -0
  202. package/platforms/macos/src/vendor/Lottie/Private/Model/Objects/Marker.swift +35 -0
  203. package/platforms/macos/src/vendor/Lottie/Private/Model/Objects/Mask.swift +80 -0
  204. package/platforms/macos/src/vendor/Lottie/Private/Model/Objects/Transform.swift +261 -0
  205. package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/Ellipse.swift +79 -0
  206. package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/Fill.swift +79 -0
  207. package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/GradientFill.swift +142 -0
  208. package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/GradientStroke.swift +244 -0
  209. package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/Group.swift +55 -0
  210. package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/Merge.swift +63 -0
  211. package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/Rectangle.swift +79 -0
  212. package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/Repeater.swift +181 -0
  213. package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/RoundedCorners.swift +53 -0
  214. package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/Shape.swift +63 -0
  215. package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/ShapeItem.swift +171 -0
  216. package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/ShapeTransform.swift +202 -0
  217. package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/Star.swift +136 -0
  218. package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/Stroke.swift +144 -0
  219. package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/Trim.swift +90 -0
  220. package/platforms/macos/src/vendor/Lottie/Private/Model/Text/Font.swift +67 -0
  221. package/platforms/macos/src/vendor/Lottie/Private/Model/Text/Glyph.swift +94 -0
  222. package/platforms/macos/src/vendor/Lottie/Private/Model/Text/TextAnimator.swift +240 -0
  223. package/platforms/macos/src/vendor/Lottie/Private/Model/Text/TextDocument.swift +142 -0
  224. package/platforms/macos/src/vendor/Lottie/Private/RootAnimationLayer.swift +54 -0
  225. package/platforms/macos/src/vendor/Lottie/Private/Utility/Debugging/AnimatorNodeDebugging.swift +23 -0
  226. package/platforms/macos/src/vendor/Lottie/Private/Utility/Debugging/LayerDebugging.swift +231 -0
  227. package/platforms/macos/src/vendor/Lottie/Private/Utility/Debugging/TestHelpers.swift +10 -0
  228. package/platforms/macos/src/vendor/Lottie/Private/Utility/Extensions/AnimationKeypathExtension.swift +303 -0
  229. package/platforms/macos/src/vendor/Lottie/Private/Utility/Extensions/BlendMode+Filter.swift +31 -0
  230. package/platforms/macos/src/vendor/Lottie/Private/Utility/Extensions/CGColor+RGB.swift +45 -0
  231. package/platforms/macos/src/vendor/Lottie/Private/Utility/Extensions/CGFloatExtensions.swift +152 -0
  232. package/platforms/macos/src/vendor/Lottie/Private/Utility/Extensions/DataExtension.swift +33 -0
  233. package/platforms/macos/src/vendor/Lottie/Private/Utility/Extensions/MathKit.swift +454 -0
  234. package/platforms/macos/src/vendor/Lottie/Private/Utility/Extensions/StringExtensions.swift +44 -0
  235. package/platforms/macos/src/vendor/Lottie/Private/Utility/Helpers/AnimationContext.swift +95 -0
  236. package/platforms/macos/src/vendor/Lottie/Private/Utility/Helpers/AnyEquatable.swift +23 -0
  237. package/platforms/macos/src/vendor/Lottie/Private/Utility/Helpers/Binding+Map.swift +19 -0
  238. package/platforms/macos/src/vendor/Lottie/Private/Utility/Helpers/View+ValueChanged.swift +35 -0
  239. package/platforms/macos/src/vendor/Lottie/Private/Utility/Interpolatable/InterpolatableExtensions.swift +143 -0
  240. package/platforms/macos/src/vendor/Lottie/Private/Utility/Interpolatable/KeyframeExtensions.swift +47 -0
  241. package/platforms/macos/src/vendor/Lottie/Private/Utility/Interpolatable/KeyframeInterpolator.swift +250 -0
  242. package/platforms/macos/src/vendor/Lottie/Private/Utility/LottieAnimationSource.swift +51 -0
  243. package/platforms/macos/src/vendor/Lottie/Private/Utility/Primitives/BezierPath.swift +509 -0
  244. package/platforms/macos/src/vendor/Lottie/Private/Utility/Primitives/BezierPathRoundExtension.swift +163 -0
  245. package/platforms/macos/src/vendor/Lottie/Private/Utility/Primitives/CGPointExtension.swift +35 -0
  246. package/platforms/macos/src/vendor/Lottie/Private/Utility/Primitives/ColorExtension.swift +101 -0
  247. package/platforms/macos/src/vendor/Lottie/Private/Utility/Primitives/CompoundBezierPath.swift +169 -0
  248. package/platforms/macos/src/vendor/Lottie/Private/Utility/Primitives/CurveVertex.swift +190 -0
  249. package/platforms/macos/src/vendor/Lottie/Private/Utility/Primitives/PathElement.swift +78 -0
  250. package/platforms/macos/src/vendor/Lottie/Private/Utility/Primitives/UnitBezier.swift +119 -0
  251. package/platforms/macos/src/vendor/Lottie/Private/Utility/Primitives/VectorsExtensions.swift +368 -0
  252. package/platforms/macos/src/vendor/Lottie/Public/Animation/LottieAnimation.swift +179 -0
  253. package/platforms/macos/src/vendor/Lottie/Public/Animation/LottieAnimationHelpers.swift +317 -0
  254. package/platforms/macos/src/vendor/Lottie/Public/Animation/LottieAnimationLayer.swift +1582 -0
  255. package/platforms/macos/src/vendor/Lottie/Public/Animation/LottieAnimationView.swift +1090 -0
  256. package/platforms/macos/src/vendor/Lottie/Public/Animation/LottieAnimationViewInitializers.swift +226 -0
  257. package/platforms/macos/src/vendor/Lottie/Public/Animation/LottiePlaybackMode.swift +266 -0
  258. package/platforms/macos/src/vendor/Lottie/Public/Animation/LottieView.swift +643 -0
  259. package/platforms/macos/src/vendor/Lottie/Public/AnimationCache/AnimationCacheProvider.swift +21 -0
  260. package/platforms/macos/src/vendor/Lottie/Public/AnimationCache/DefaultAnimationCache.swift +67 -0
  261. package/platforms/macos/src/vendor/Lottie/Public/AnimationCache/LRUAnimationCache.swift +11 -0
  262. package/platforms/macos/src/vendor/Lottie/Public/AnimationCache/LottieAnimationCache.swift +15 -0
  263. package/platforms/macos/src/vendor/Lottie/Public/Configuration/DecodingStrategy.swift +15 -0
  264. package/platforms/macos/src/vendor/Lottie/Public/Configuration/LottieConfiguration.swift +54 -0
  265. package/platforms/macos/src/vendor/Lottie/Public/Configuration/LottieURLSession.swift +31 -0
  266. package/platforms/macos/src/vendor/Lottie/Public/Configuration/ReducedMotionOption.swift +128 -0
  267. package/platforms/macos/src/vendor/Lottie/Public/Configuration/RenderingEngineOption.swift +117 -0
  268. package/platforms/macos/src/vendor/Lottie/Public/Controls/AnimatedButton.swift +128 -0
  269. package/platforms/macos/src/vendor/Lottie/Public/Controls/AnimatedControl.swift +248 -0
  270. package/platforms/macos/src/vendor/Lottie/Public/Controls/AnimatedSwitch.swift +271 -0
  271. package/platforms/macos/src/vendor/Lottie/Public/Controls/LottieButton.swift +119 -0
  272. package/platforms/macos/src/vendor/Lottie/Public/Controls/LottieSwitch.swift +144 -0
  273. package/platforms/macos/src/vendor/Lottie/Public/Controls/LottieViewType.swift +79 -0
  274. package/platforms/macos/src/vendor/Lottie/Public/DotLottie/Cache/DotLottieCache.swift +66 -0
  275. package/platforms/macos/src/vendor/Lottie/Public/DotLottie/Cache/DotLottieCacheProvider.swift +21 -0
  276. package/platforms/macos/src/vendor/Lottie/Public/DotLottie/DotLottieConfiguration.swift +72 -0
  277. package/platforms/macos/src/vendor/Lottie/Public/DotLottie/DotLottieFile.swift +186 -0
  278. package/platforms/macos/src/vendor/Lottie/Public/DotLottie/DotLottieFileHelpers.swift +386 -0
  279. package/platforms/macos/src/vendor/Lottie/Public/DynamicProperties/AnimationKeypath.swift +57 -0
  280. package/platforms/macos/src/vendor/Lottie/Public/DynamicProperties/AnyValueProvider.swift +132 -0
  281. package/platforms/macos/src/vendor/Lottie/Public/DynamicProperties/ValueProviders/ColorValueProvider.swift +96 -0
  282. package/platforms/macos/src/vendor/Lottie/Public/DynamicProperties/ValueProviders/FloatValueProvider.swift +81 -0
  283. package/platforms/macos/src/vendor/Lottie/Public/DynamicProperties/ValueProviders/GradientValueProvider.swift +138 -0
  284. package/platforms/macos/src/vendor/Lottie/Public/DynamicProperties/ValueProviders/PointValueProvider.swift +81 -0
  285. package/platforms/macos/src/vendor/Lottie/Public/DynamicProperties/ValueProviders/SizeValueProvider.swift +81 -0
  286. package/platforms/macos/src/vendor/Lottie/Public/FontProvider/AnimationFontProvider.swift +41 -0
  287. package/platforms/macos/src/vendor/Lottie/Public/ImageProvider/AnimationImageProvider.swift +43 -0
  288. package/platforms/macos/src/vendor/Lottie/Public/Keyframes/Interpolatable.swift +285 -0
  289. package/platforms/macos/src/vendor/Lottie/Public/Keyframes/Keyframe.swift +98 -0
  290. package/platforms/macos/src/vendor/Lottie/Public/Logging/LottieLogger.swift +138 -0
  291. package/platforms/macos/src/vendor/Lottie/Public/Primitives/AnimationTime.swift +15 -0
  292. package/platforms/macos/src/vendor/Lottie/Public/Primitives/LottieColor.swift +43 -0
  293. package/platforms/macos/src/vendor/Lottie/Public/Primitives/Vectors.swift +36 -0
  294. package/platforms/macos/src/vendor/Lottie/Public/TextProvider/AnimationTextProvider.swift +135 -0
  295. package/platforms/macos/src/vendor/Lottie/Public/iOS/AnimationSubview.swift +19 -0
  296. package/platforms/macos/src/vendor/Lottie/Public/iOS/BundleImageProvider.swift +98 -0
  297. package/platforms/macos/src/vendor/Lottie/Public/iOS/Compatibility/CompatibleAnimationKeypath.swift +33 -0
  298. package/platforms/macos/src/vendor/Lottie/Public/iOS/Compatibility/CompatibleAnimationView.swift +567 -0
  299. package/platforms/macos/src/vendor/Lottie/Public/iOS/Compatibility/CompatibleFontProvider.swift +41 -0
  300. package/platforms/macos/src/vendor/Lottie/Public/iOS/Compatibility/CompatibleImageProvider.swift +43 -0
  301. package/platforms/macos/src/vendor/Lottie/Public/iOS/FilepathImageProvider.swift +78 -0
  302. package/platforms/macos/src/vendor/Lottie/Public/iOS/LottieAnimationViewBase.swift +85 -0
  303. package/platforms/macos/src/vendor/Lottie/Public/iOS/UIColorExtension.swift +23 -0
  304. package/platforms/macos/src/vendor/Lottie/Public/macOS/AnimationSubview.macOS.swift +19 -0
  305. package/platforms/macos/src/vendor/Lottie/Public/macOS/BundleImageProvider.macOS.swift +90 -0
  306. package/platforms/macos/src/vendor/Lottie/Public/macOS/FilepathImageProvider.macOS.swift +86 -0
  307. package/platforms/macos/src/vendor/Lottie/Public/macOS/LottieAnimationViewBase.macOS.swift +102 -0
  308. package/src/Lottie.macos.tsrx +129 -0
  309. package/src/Lottie.tsrx +3 -2
  310. package/src/Lottie.web.tsrx +28 -11
  311. package/src/index.macos.ts +2 -0
  312. package/src/props.ts +6 -1
  313. package/types/generated/props.d.ts +5 -1
@@ -0,0 +1,149 @@
1
+ //
2
+ // LayerTransformPropertyMap.swift
3
+ // lottie-swift
4
+ //
5
+ // Created by Brandon Withrow on 2/4/19.
6
+ //
7
+
8
+ import QuartzCore
9
+
10
+ // MARK: - LayerTransformProperties
11
+
12
+ final class LayerTransformProperties: NodePropertyMap, KeypathSearchable {
13
+
14
+ // MARK: Lifecycle
15
+
16
+ init(transform: Transform) {
17
+ anchor = NodeProperty(provider: KeyframeInterpolator(keyframes: transform.anchorPoint.keyframes))
18
+ scale = NodeProperty(provider: KeyframeInterpolator(keyframes: transform.scale.keyframes))
19
+ rotationX = NodeProperty(provider: KeyframeInterpolator(keyframes: transform.rotationX.keyframes))
20
+ rotationY = NodeProperty(provider: KeyframeInterpolator(keyframes: transform.rotationY.keyframes))
21
+ rotationZ = NodeProperty(provider: KeyframeInterpolator(keyframes: transform.rotationZ.keyframes))
22
+ opacity = NodeProperty(provider: KeyframeInterpolator(keyframes: transform.opacity.keyframes))
23
+
24
+ var propertyMap: [String: AnyNodeProperty] = [
25
+ "Anchor Point": anchor,
26
+ PropertyName.scale.rawValue: scale,
27
+ PropertyName.rotation.rawValue: rotationZ,
28
+ "Rotation X": rotationX,
29
+ "Rotation Y": rotationY,
30
+ "Rotation Z": rotationZ,
31
+ PropertyName.opacity.rawValue: opacity,
32
+ ]
33
+
34
+ if
35
+ let positionKeyframesX = transform.positionX?.keyframes,
36
+ let positionKeyframesY = transform.positionY?.keyframes
37
+ {
38
+ let xPosition: NodeProperty<LottieVector1D> = NodeProperty(provider: KeyframeInterpolator(keyframes: positionKeyframesX))
39
+ let yPosition: NodeProperty<LottieVector1D> = NodeProperty(provider: KeyframeInterpolator(keyframes: positionKeyframesY))
40
+ propertyMap["X Position"] = xPosition
41
+ propertyMap["Y Position"] = yPosition
42
+ positionX = xPosition
43
+ positionY = yPosition
44
+ position = nil
45
+ } else if let positionKeyframes = transform.position?.keyframes {
46
+ let position: NodeProperty<LottieVector3D> = NodeProperty(provider: KeyframeInterpolator(keyframes: positionKeyframes))
47
+ propertyMap[PropertyName.position.rawValue] = position
48
+ self.position = position
49
+ positionX = nil
50
+ positionY = nil
51
+ } else {
52
+ position = nil
53
+ positionY = nil
54
+ positionX = nil
55
+ }
56
+
57
+ keypathProperties = propertyMap
58
+ properties = Array(propertyMap.values)
59
+ }
60
+
61
+ // MARK: Internal
62
+
63
+ let keypathProperties: [String: AnyNodeProperty]
64
+ var keypathName = "Transform"
65
+
66
+ let properties: [AnyNodeProperty]
67
+
68
+ let anchor: NodeProperty<LottieVector3D>
69
+ let scale: NodeProperty<LottieVector3D>
70
+ let rotationX: NodeProperty<LottieVector1D>
71
+ let rotationY: NodeProperty<LottieVector1D>
72
+ let rotationZ: NodeProperty<LottieVector1D>
73
+ let position: NodeProperty<LottieVector3D>?
74
+ let positionX: NodeProperty<LottieVector1D>?
75
+ let positionY: NodeProperty<LottieVector1D>?
76
+ let opacity: NodeProperty<LottieVector1D>
77
+
78
+ var childKeypaths: [KeypathSearchable] {
79
+ []
80
+ }
81
+ }
82
+
83
+ // MARK: - LayerTransformNode
84
+
85
+ final class LayerTransformNode: AnimatorNode {
86
+
87
+ // MARK: Lifecycle
88
+
89
+ init(transform: Transform) {
90
+ transformProperties = LayerTransformProperties(transform: transform)
91
+ }
92
+
93
+ // MARK: Internal
94
+
95
+ let outputNode: NodeOutput = PassThroughOutputNode(parent: nil)
96
+
97
+ let transformProperties: LayerTransformProperties
98
+
99
+ var parentNode: AnimatorNode?
100
+ var hasLocalUpdates = false
101
+ var hasUpstreamUpdates = false
102
+ var lastUpdateFrame: CGFloat? = nil
103
+ var isEnabled = true
104
+
105
+ var opacity: Float = 1
106
+ var localTransform: CATransform3D = CATransform3DIdentity
107
+ var globalTransform: CATransform3D = CATransform3DIdentity
108
+
109
+ var propertyMap: NodePropertyMap & KeypathSearchable {
110
+ transformProperties
111
+ }
112
+
113
+ func shouldRebuildOutputs(frame _: CGFloat) -> Bool {
114
+ hasLocalUpdates || hasUpstreamUpdates
115
+ }
116
+
117
+ func rebuildOutputs(frame _: CGFloat) {
118
+ opacity = Float(transformProperties.opacity.value.cgFloatValue) * 0.01
119
+
120
+ let position: CGPoint =
121
+ if let point = transformProperties.position?.value.pointValue {
122
+ point
123
+ } else if
124
+ let xPos = transformProperties.positionX?.value.cgFloatValue,
125
+ let yPos = transformProperties.positionY?.value.cgFloatValue
126
+ {
127
+ CGPoint(x: xPos, y: yPos)
128
+ } else {
129
+ .zero
130
+ }
131
+
132
+ localTransform = CATransform3D.makeTransform(
133
+ anchor: transformProperties.anchor.value.pointValue,
134
+ position: position,
135
+ scale: transformProperties.scale.value.sizeValue,
136
+ rotationX: transformProperties.rotationX.value.cgFloatValue,
137
+ rotationY: transformProperties.rotationY.value.cgFloatValue,
138
+ rotationZ: transformProperties.rotationZ.value.cgFloatValue,
139
+ skew: nil,
140
+ skewAxis: nil
141
+ )
142
+
143
+ if let parentNode = parentNode as? LayerTransformNode {
144
+ globalTransform = CATransform3DConcat(localTransform, parentNode.globalTransform)
145
+ } else {
146
+ globalTransform = localTransform
147
+ }
148
+ }
149
+ }
@@ -0,0 +1,146 @@
1
+ //
2
+ // ItemsExtension.swift
3
+ // lottie-swift
4
+ //
5
+ // Created by Brandon Withrow on 1/18/19.
6
+ //
7
+
8
+ // MARK: - NodeTree
9
+
10
+ final class NodeTree {
11
+ var rootNode: AnimatorNode? = nil
12
+ var transform: ShapeTransform? = nil
13
+ var renderContainers = [ShapeContainerLayer]()
14
+ var paths = [PathOutputNode]()
15
+ var childrenNodes = [AnimatorNode]()
16
+ }
17
+
18
+ extension [ShapeItem] {
19
+ func initializeNodeTree() -> NodeTree {
20
+ let nodeTree = NodeTree()
21
+
22
+ for item in self {
23
+ guard item.hidden == false, item.type != .unknown else { continue }
24
+ if let fill = item as? Fill {
25
+ let node = FillNode(parentNode: nodeTree.rootNode, fill: fill)
26
+ nodeTree.rootNode = node
27
+ nodeTree.childrenNodes.append(node)
28
+ } else if let stroke = item as? Stroke {
29
+ let node = StrokeNode(parentNode: nodeTree.rootNode, stroke: stroke)
30
+ nodeTree.rootNode = node
31
+ nodeTree.childrenNodes.append(node)
32
+ } else if let gradientFill = item as? GradientFill {
33
+ let node = GradientFillNode(parentNode: nodeTree.rootNode, gradientFill: gradientFill)
34
+ nodeTree.rootNode = node
35
+ nodeTree.childrenNodes.append(node)
36
+ } else if let gradientStroke = item as? GradientStroke {
37
+ let node = GradientStrokeNode(parentNode: nodeTree.rootNode, gradientStroke: gradientStroke)
38
+ nodeTree.rootNode = node
39
+ nodeTree.childrenNodes.append(node)
40
+ } else if let ellipse = item as? Ellipse {
41
+ let node = EllipseNode(parentNode: nodeTree.rootNode, ellipse: ellipse)
42
+ nodeTree.rootNode = node
43
+ nodeTree.childrenNodes.append(node)
44
+ } else if let rect = item as? Rectangle {
45
+ let node = RectangleNode(parentNode: nodeTree.rootNode, rectangle: rect)
46
+ nodeTree.rootNode = node
47
+ nodeTree.childrenNodes.append(node)
48
+ } else if let star = item as? Star {
49
+ switch star.starType {
50
+ case .none:
51
+ continue
52
+
53
+ case .polygon:
54
+ let node = PolygonNode(parentNode: nodeTree.rootNode, star: star)
55
+ nodeTree.rootNode = node
56
+ nodeTree.childrenNodes.append(node)
57
+
58
+ case .star:
59
+ let node = StarNode(parentNode: nodeTree.rootNode, star: star)
60
+ nodeTree.rootNode = node
61
+ nodeTree.childrenNodes.append(node)
62
+ }
63
+ } else if let shape = item as? Shape {
64
+ let node = ShapeNode(parentNode: nodeTree.rootNode, shape: shape)
65
+ nodeTree.rootNode = node
66
+ nodeTree.childrenNodes.append(node)
67
+ } else if let trim = item as? Trim {
68
+ let node = TrimPathNode(parentNode: nodeTree.rootNode, trim: trim, upstreamPaths: nodeTree.paths)
69
+ nodeTree.rootNode = node
70
+ nodeTree.childrenNodes.append(node)
71
+ } else if let roundedCorners = item as? RoundedCorners {
72
+ let node = RoundedCornersNode(
73
+ parentNode: nodeTree.rootNode,
74
+ roundedCorners: roundedCorners,
75
+ upstreamPaths: nodeTree.paths
76
+ )
77
+ nodeTree.rootNode = node
78
+ nodeTree.childrenNodes.append(node)
79
+ } else if let xform = item as? ShapeTransform {
80
+ nodeTree.transform = xform
81
+ continue
82
+ } else if let group = item as? Group {
83
+ let tree = group.items.initializeNodeTree()
84
+ let node = GroupNode(name: group.name, parentNode: nodeTree.rootNode, tree: tree)
85
+ nodeTree.rootNode = node
86
+ nodeTree.childrenNodes.append(node)
87
+ /// Now add all child paths to current tree
88
+ nodeTree.paths.append(contentsOf: tree.paths)
89
+ nodeTree.renderContainers.append(node.container)
90
+ } else if item is Repeater {
91
+ LottieLogger.shared.warn("""
92
+ The Main Thread rendering engine doesn't currently support repeaters.
93
+ To play an animation with repeaters, you can use the Core Animation rendering engine instead.
94
+ """)
95
+ }
96
+
97
+ if let pathNode = nodeTree.rootNode?.getPathNode() {
98
+ //// Add path container to the node tree
99
+ nodeTree.paths.append(pathNode.pathOutput)
100
+ }
101
+
102
+ if let renderNode = nodeTree.rootNode?.getRenderNode() {
103
+ nodeTree.renderContainers.append(ShapeRenderLayer(renderer: renderNode.renderer))
104
+ }
105
+ }
106
+ return nodeTree
107
+ }
108
+ }
109
+
110
+ extension AnimatorNode {
111
+ /// Helper function to avoid casting to `PathNode`
112
+ /// More performant replacement for `nodeTree.rootNode as? PathNode`
113
+ fileprivate func getPathNode() -> PathNode? {
114
+ switch self {
115
+ case let node as EllipseNode:
116
+ node
117
+ case let node as PolygonNode:
118
+ node
119
+ case let node as ShapeNode:
120
+ node
121
+ case let node as StarNode:
122
+ node
123
+ case let node as RectangleNode:
124
+ node
125
+ default:
126
+ nil
127
+ }
128
+ }
129
+
130
+ /// Helper function to avoid casting to `RenderNode`
131
+ /// More performant replacement for `nodeTree.rootNode as? RenderNode`
132
+ fileprivate func getRenderNode() -> RenderNode? {
133
+ switch self {
134
+ case let node as GradientFillNode:
135
+ node
136
+ case let node as StrokeNode:
137
+ node
138
+ case let node as FillNode:
139
+ node
140
+ case let node as GradientStrokeNode:
141
+ node
142
+ default:
143
+ nil
144
+ }
145
+ }
146
+ }
@@ -0,0 +1,62 @@
1
+ //
2
+ // NodeProperty.swift
3
+ // lottie-swift
4
+ //
5
+ // Created by Brandon Withrow on 1/30/19.
6
+ //
7
+
8
+ import CoreGraphics
9
+ import Foundation
10
+
11
+ /// A node property that holds a reference to a T ValueProvider and a T ValueContainer.
12
+ final class NodeProperty<T>: AnyNodeProperty {
13
+
14
+ // MARK: Lifecycle
15
+
16
+ init(provider: AnyValueProvider) {
17
+ valueProvider = provider
18
+ originalValueProvider = valueProvider
19
+ typedContainer = ValueContainer<T>(provider.value(frame: 0) as! T)
20
+ typedContainer.setNeedsUpdate()
21
+ }
22
+
23
+ // MARK: Internal
24
+
25
+ var valueProvider: AnyValueProvider
26
+ var originalValueProvider: AnyValueProvider
27
+
28
+ var valueType: Any.Type {
29
+ T.self
30
+ }
31
+
32
+ var value: T {
33
+ typedContainer.outputValue
34
+ }
35
+
36
+ var valueContainer: AnyValueContainer {
37
+ typedContainer
38
+ }
39
+
40
+ func needsUpdate(frame: CGFloat) -> Bool {
41
+ valueContainer.needsUpdate || valueProvider.hasUpdate(frame: frame)
42
+ }
43
+
44
+ func setProvider(provider: AnyValueProvider) {
45
+ guard provider.valueType == valueType else { return }
46
+ valueProvider = provider
47
+ valueContainer.setNeedsUpdate()
48
+ }
49
+
50
+ func removeProvider() {
51
+ valueProvider = originalValueProvider
52
+ valueContainer.setNeedsUpdate()
53
+ }
54
+
55
+ func update(frame: CGFloat) {
56
+ typedContainer.setValue(valueProvider.value(frame: frame), forFrame: frame)
57
+ }
58
+
59
+ // MARK: Fileprivate
60
+
61
+ fileprivate var typedContainer: ValueContainer<T>
62
+ }
@@ -0,0 +1,53 @@
1
+ //
2
+ // AnyNodeProperty.swift
3
+ // lottie-swift
4
+ //
5
+ // Created by Brandon Withrow on 1/30/19.
6
+ //
7
+
8
+ import CoreGraphics
9
+ import Foundation
10
+
11
+ // MARK: - AnyNodeProperty
12
+
13
+ /// A property of a node. The node property holds a provider and a container
14
+ protocol AnyNodeProperty {
15
+
16
+ /// The stored value container for the property
17
+ var valueContainer: AnyValueContainer { get }
18
+
19
+ /// The value provider for the property
20
+ var valueProvider: AnyValueProvider { get }
21
+
22
+ /// The original value provider for the property
23
+ var originalValueProvider: AnyValueProvider { get }
24
+
25
+ /// The Type of the value provider
26
+ var valueType: Any.Type { get }
27
+
28
+ /// Returns true if the property needs to recompute its stored value
29
+ func needsUpdate(frame: CGFloat) -> Bool
30
+
31
+ /// Updates the property for the frame
32
+ func update(frame: CGFloat)
33
+
34
+ /// Sets the value provider for the property.
35
+ func setProvider(provider: AnyValueProvider)
36
+
37
+ /// Removes the value provider for the property.
38
+ func removeProvider()
39
+ }
40
+
41
+ extension AnyNodeProperty {
42
+
43
+ /// Returns the most recently computed value for the keypath, returns nil if property wasn't found
44
+ func getValueOfType<T>() -> T? {
45
+ valueContainer.value as? T
46
+ }
47
+
48
+ /// Returns the most recently computed value for the keypath, returns nil if property wasn't found
49
+ func getValue() -> Any? {
50
+ valueContainer.value
51
+ }
52
+
53
+ }
@@ -0,0 +1,26 @@
1
+ //
2
+ // AnyValueContainer.swift
3
+ // lottie-swift
4
+ //
5
+ // Created by Brandon Withrow on 1/30/19.
6
+ //
7
+
8
+ import CoreGraphics
9
+ import Foundation
10
+
11
+ /// The container for the value of a property.
12
+ protocol AnyValueContainer: AnyObject {
13
+
14
+ /// The stored value of the container
15
+ var value: Any { get }
16
+
17
+ /// When true the container needs to have its value updated by its provider
18
+ var needsUpdate: Bool { get }
19
+
20
+ /// The frame time of the last provided update
21
+ var lastUpdateFrame: CGFloat { get }
22
+
23
+ /// Notifies the provider that it should update its container
24
+ func setNeedsUpdate()
25
+
26
+ }
@@ -0,0 +1,23 @@
1
+ //
2
+ // KeypathSettable.swift
3
+ // lottie-swift
4
+ //
5
+ // Created by Brandon Withrow on 2/4/19.
6
+ //
7
+
8
+ import QuartzCore
9
+
10
+ /// Protocol that provides keypath search functionality. Returns all node properties associated with a keypath.
11
+ protocol KeypathSearchable {
12
+
13
+ /// The name of the Keypath
14
+ var keypathName: String { get }
15
+
16
+ /// A list of properties belonging to the keypath.
17
+ var keypathProperties: [String: AnyNodeProperty] { get }
18
+
19
+ /// Children Keypaths
20
+ var childKeypaths: [KeypathSearchable] { get }
21
+
22
+ var keypathLayer: CALayer? { get }
23
+ }
@@ -0,0 +1,43 @@
1
+ //
2
+ // NodePropertyMap.swift
3
+ // lottie-swift
4
+ //
5
+ // Created by Brandon Withrow on 1/21/19.
6
+ //
7
+
8
+ import QuartzCore
9
+
10
+ // MARK: - NodePropertyMap
11
+
12
+ protocol NodePropertyMap {
13
+ var properties: [AnyNodeProperty] { get }
14
+ }
15
+
16
+ extension NodePropertyMap {
17
+
18
+ var childKeypaths: [KeypathSearchable] {
19
+ []
20
+ }
21
+
22
+ var keypathLayer: CALayer? {
23
+ nil
24
+ }
25
+
26
+ /// Checks if the node's local contents need to be rebuilt.
27
+ func needsLocalUpdate(frame: CGFloat) -> Bool {
28
+ for property in properties {
29
+ if property.needsUpdate(frame: frame) {
30
+ return true
31
+ }
32
+ }
33
+ return false
34
+ }
35
+
36
+ /// Rebuilds only the local nodes that have an update for the frame
37
+ func updateNodeProperties(frame: CGFloat) {
38
+ for property in properties {
39
+ property.update(frame: frame)
40
+ }
41
+ }
42
+
43
+ }
@@ -0,0 +1,47 @@
1
+ //
2
+ // ValueContainer.swift
3
+ // lottie-swift
4
+ //
5
+ // Created by Brandon Withrow on 1/30/19.
6
+ //
7
+
8
+ import CoreGraphics
9
+ import Foundation
10
+
11
+ /// A container for a node value that is Typed to T.
12
+ final class ValueContainer<T>: AnyValueContainer {
13
+
14
+ // MARK: Lifecycle
15
+
16
+ init(_ value: T) {
17
+ outputValue = value
18
+ }
19
+
20
+ // MARK: Internal
21
+
22
+ private(set) var lastUpdateFrame = CGFloat.infinity
23
+
24
+ fileprivate(set) var needsUpdate = true
25
+
26
+ var value: Any {
27
+ outputValue as Any
28
+ }
29
+
30
+ var outputValue: T {
31
+ didSet {
32
+ needsUpdate = false
33
+ }
34
+ }
35
+
36
+ func setValue(_ value: Any, forFrame: CGFloat) {
37
+ if let typedValue = value as? T {
38
+ needsUpdate = false
39
+ lastUpdateFrame = forFrame
40
+ outputValue = typedValue
41
+ }
42
+ }
43
+
44
+ func setNeedsUpdate() {
45
+ needsUpdate = true
46
+ }
47
+ }
@@ -0,0 +1,39 @@
1
+ //
2
+ // KeyframeGroupInterpolator.swift
3
+ // lottie-swift
4
+ //
5
+ // Created by Brandon Withrow on 1/22/19.
6
+ //
7
+
8
+ import CoreGraphics
9
+ import Foundation
10
+
11
+ /// A value provider that produces an array of values from an array of Keyframe Interpolators
12
+ final class GroupInterpolator<ValueType: Interpolatable>: ValueProvider {
13
+
14
+ // MARK: Lifecycle
15
+
16
+ /// Initialize with an array of array of keyframes.
17
+ init(keyframeGroups: ContiguousArray<ContiguousArray<Keyframe<ValueType>>>) {
18
+ keyframeInterpolators = ContiguousArray(keyframeGroups.map { KeyframeInterpolator(keyframes: $0) })
19
+ }
20
+
21
+ // MARK: Internal
22
+
23
+ let keyframeInterpolators: ContiguousArray<KeyframeInterpolator<ValueType>>
24
+
25
+ var valueType: Any.Type {
26
+ [ValueType].self
27
+ }
28
+
29
+ var storage: ValueProviderStorage<[ValueType]> {
30
+ .closure { frame in
31
+ self.keyframeInterpolators.map { $0.value(frame: frame) as! ValueType }
32
+ }
33
+ }
34
+
35
+ func hasUpdate(frame: CGFloat) -> Bool {
36
+ let updated = keyframeInterpolators.first(where: { $0.hasUpdate(frame: frame) })
37
+ return updated != nil
38
+ }
39
+ }
@@ -0,0 +1,43 @@
1
+ //
2
+ // SingleValueProvider.swift
3
+ // lottie-swift
4
+ //
5
+ // Created by Brandon Withrow on 1/30/19.
6
+ //
7
+
8
+ import Foundation
9
+ import QuartzCore
10
+
11
+ /// Returns a value for every frame.
12
+ final class SingleValueProvider<ValueType: AnyInterpolatable>: ValueProvider {
13
+
14
+ // MARK: Lifecycle
15
+
16
+ init(_ value: ValueType) {
17
+ self.value = value
18
+ }
19
+
20
+ // MARK: Internal
21
+
22
+ var value: ValueType {
23
+ didSet {
24
+ hasUpdate = true
25
+ }
26
+ }
27
+
28
+ var storage: ValueProviderStorage<ValueType> {
29
+ .singleValue(value)
30
+ }
31
+
32
+ var valueType: Any.Type {
33
+ ValueType.self
34
+ }
35
+
36
+ func hasUpdate(frame _: CGFloat) -> Bool {
37
+ hasUpdate
38
+ }
39
+
40
+ // MARK: Private
41
+
42
+ private var hasUpdate = true
43
+ }