@octane-xplat/lottie 0.9.0 → 0.11.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 +6 -4
  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,285 @@
1
+ // Created by Cal Stephens on 1/24/22.
2
+ // Copyright © 2022 Airbnb Inc. All rights reserved.
3
+
4
+ import CoreGraphics
5
+
6
+ // MARK: - Interpolatable
7
+
8
+ /// A type that can be interpolated between two values
9
+ public protocol Interpolatable: AnyInterpolatable {
10
+ /// Interpolates the `self` to the given number by `amount`.
11
+ /// - Parameter to: The number to interpolate to.
12
+ /// - Parameter amount: The amount to interpolate,
13
+ /// relative to 0.0 (self) and 1.0 (to).
14
+ /// `amount` can be greater than one and less than zero,
15
+ /// and interpolation should not be clamped.
16
+ ///
17
+ /// ```
18
+ /// let number = 5
19
+ /// let interpolated = number.interpolateTo(10, amount: 0.5)
20
+ /// print(interpolated) // 7.5
21
+ /// ```
22
+ ///
23
+ /// ```
24
+ /// let number = 5
25
+ /// let interpolated = number.interpolateTo(10, amount: 1.5)
26
+ /// print(interpolated) // 12.5
27
+ /// ```
28
+ func interpolate(to: Self, amount: CGFloat) -> Self
29
+ }
30
+
31
+ // MARK: - SpatialInterpolatable
32
+
33
+ /// A type that can be interpolated between two values,
34
+ /// additionally using optional `spatialOutTangent` and `spatialInTangent` values.
35
+ /// - If your implementation doesn't use the `spatialOutTangent` and `spatialInTangent`
36
+ /// parameters, prefer implementing the simpler `Interpolatable` protocol.
37
+ public protocol SpatialInterpolatable: AnyInterpolatable {
38
+ /// Interpolates the `self` to the given number by `amount`.
39
+ /// - Parameter to: The number to interpolate to.
40
+ /// - Parameter amount: The amount to interpolate,
41
+ /// relative to 0.0 (self) and 1.0 (to).
42
+ /// `amount` can be greater than one and less than zero,
43
+ /// and interpolation should not be clamped.
44
+ func interpolate(
45
+ to: Self,
46
+ amount: CGFloat,
47
+ spatialOutTangent: CGPoint?,
48
+ spatialInTangent: CGPoint?
49
+ ) -> Self
50
+ }
51
+
52
+ // MARK: - AnyInterpolatable
53
+
54
+ /// The base protocol that is implemented by both `Interpolatable` and `SpatialInterpolatable`
55
+ /// Types should not directly implement this protocol.
56
+ public protocol AnyInterpolatable {
57
+ /// Interpolates by calling either `Interpolatable.interpolate`
58
+ /// or `SpatialInterpolatable.interpolate`.
59
+ /// Should not be implemented or called by consumers.
60
+ func _interpolate(
61
+ to: Self,
62
+ amount: CGFloat,
63
+ spatialOutTangent: CGPoint?,
64
+ spatialInTangent: CGPoint?
65
+ ) -> Self
66
+ }
67
+
68
+ extension Interpolatable {
69
+ public func _interpolate(
70
+ to: Self,
71
+ amount: CGFloat,
72
+ spatialOutTangent _: CGPoint?,
73
+ spatialInTangent _: CGPoint?
74
+ ) -> Self {
75
+ interpolate(to: to, amount: amount)
76
+ }
77
+ }
78
+
79
+ extension SpatialInterpolatable {
80
+ /// Helper that interpolates this `SpatialInterpolatable`
81
+ /// with `nil` spatial in/out tangents
82
+ public func interpolate(to: Self, amount: CGFloat) -> Self {
83
+ interpolate(
84
+ to: to,
85
+ amount: amount,
86
+ spatialOutTangent: nil,
87
+ spatialInTangent: nil
88
+ )
89
+ }
90
+
91
+ public func _interpolate(
92
+ to: Self,
93
+ amount: CGFloat,
94
+ spatialOutTangent: CGPoint?,
95
+ spatialInTangent: CGPoint?
96
+ ) -> Self {
97
+ interpolate(
98
+ to: to,
99
+ amount: amount,
100
+ spatialOutTangent: spatialOutTangent,
101
+ spatialInTangent: spatialInTangent
102
+ )
103
+ }
104
+ }
105
+
106
+ // MARK: - Double + Interpolatable
107
+
108
+ extension Double: Interpolatable { }
109
+
110
+ // MARK: - CGFloat + Interpolatable
111
+
112
+ extension CGFloat: Interpolatable { }
113
+
114
+ // MARK: - Float + Interpolatable
115
+
116
+ extension Float: Interpolatable { }
117
+
118
+ extension Interpolatable where Self: BinaryFloatingPoint {
119
+ public func interpolate(to: Self, amount: CGFloat) -> Self {
120
+ self + ((to - self) * Self(amount))
121
+ }
122
+ }
123
+
124
+ // MARK: - CGRect + Interpolatable
125
+
126
+ extension CGRect: Interpolatable {
127
+ public func interpolate(to: CGRect, amount: CGFloat) -> CGRect {
128
+ CGRect(
129
+ x: origin.x.interpolate(to: to.origin.x, amount: amount),
130
+ y: origin.y.interpolate(to: to.origin.y, amount: amount),
131
+ width: width.interpolate(to: to.width, amount: amount),
132
+ height: height.interpolate(to: to.height, amount: amount)
133
+ )
134
+ }
135
+ }
136
+
137
+ // MARK: - CGSize + Interpolatable
138
+
139
+ extension CGSize: Interpolatable {
140
+ public func interpolate(to: CGSize, amount: CGFloat) -> CGSize {
141
+ CGSize(
142
+ width: width.interpolate(to: to.width, amount: amount),
143
+ height: height.interpolate(to: to.height, amount: amount)
144
+ )
145
+ }
146
+ }
147
+
148
+ // MARK: - CGPoint + SpatialInterpolatable
149
+
150
+ extension CGPoint: SpatialInterpolatable {
151
+ public func interpolate(
152
+ to: CGPoint,
153
+ amount: CGFloat,
154
+ spatialOutTangent: CGPoint?,
155
+ spatialInTangent: CGPoint?
156
+ ) -> CGPoint {
157
+ guard
158
+ let outTan = spatialOutTangent,
159
+ let inTan = spatialInTangent
160
+ else {
161
+ return CGPoint(
162
+ x: x.interpolate(to: to.x, amount: amount),
163
+ y: y.interpolate(to: to.y, amount: amount)
164
+ )
165
+ }
166
+
167
+ let cp1 = self + outTan
168
+ let cp2 = to + inTan
169
+ return interpolate(to, outTangent: cp1, inTangent: cp2, amount: amount)
170
+ }
171
+ }
172
+
173
+ // MARK: - LottieColor + Interpolatable
174
+
175
+ extension LottieColor: Interpolatable {
176
+ public func interpolate(to: LottieColor, amount: CGFloat) -> LottieColor {
177
+ LottieColor(
178
+ r: r.interpolate(to: to.r, amount: amount),
179
+ g: g.interpolate(to: to.g, amount: amount),
180
+ b: b.interpolate(to: to.b, amount: amount),
181
+ a: a.interpolate(to: to.a, amount: amount)
182
+ )
183
+ }
184
+ }
185
+
186
+ // MARK: - LottieVector1D + Interpolatable
187
+
188
+ extension LottieVector1D: Interpolatable {
189
+ public func interpolate(to: LottieVector1D, amount: CGFloat) -> LottieVector1D {
190
+ value.interpolate(to: to.value, amount: amount).vectorValue
191
+ }
192
+ }
193
+
194
+ // MARK: - LottieVector2D + SpatialInterpolatable
195
+
196
+ extension LottieVector2D: SpatialInterpolatable {
197
+ public func interpolate(
198
+ to: LottieVector2D,
199
+ amount: CGFloat,
200
+ spatialOutTangent: CGPoint?,
201
+ spatialInTangent: CGPoint?
202
+ ) -> LottieVector2D {
203
+ pointValue.interpolate(
204
+ to: to.pointValue,
205
+ amount: amount,
206
+ spatialOutTangent: spatialOutTangent,
207
+ spatialInTangent: spatialInTangent
208
+ )
209
+ .vector2dValue
210
+ }
211
+ }
212
+
213
+ // MARK: - LottieVector3D + SpatialInterpolatable
214
+
215
+ extension LottieVector3D: SpatialInterpolatable {
216
+ public func interpolate(
217
+ to: LottieVector3D,
218
+ amount: CGFloat,
219
+ spatialOutTangent: CGPoint?,
220
+ spatialInTangent: CGPoint?
221
+ ) -> LottieVector3D {
222
+ if spatialInTangent != nil || spatialOutTangent != nil {
223
+ // TODO Support third dimension spatial interpolation
224
+ let point = pointValue.interpolate(
225
+ to: to.pointValue,
226
+ amount: amount,
227
+ spatialOutTangent: spatialOutTangent,
228
+ spatialInTangent: spatialInTangent
229
+ )
230
+
231
+ return LottieVector3D(
232
+ x: point.x,
233
+ y: point.y,
234
+ z: CGFloat(z.interpolate(to: to.z, amount: amount))
235
+ )
236
+ }
237
+
238
+ return LottieVector3D(
239
+ x: x.interpolate(to: to.x, amount: amount),
240
+ y: y.interpolate(to: to.y, amount: amount),
241
+ z: z.interpolate(to: to.z, amount: amount)
242
+ )
243
+ }
244
+ }
245
+
246
+ // MARK: - Array + Interpolatable, AnyInterpolatable
247
+
248
+ extension Array: Interpolatable, AnyInterpolatable where Element: Interpolatable {
249
+ public func interpolate(to: [Element], amount: CGFloat) -> [Element] {
250
+ LottieLogger.shared.assert(
251
+ count == to.count,
252
+ "When interpolating Arrays, both array sound have the same element count."
253
+ )
254
+
255
+ return zip(self, to).map { lhs, rhs in
256
+ lhs.interpolate(to: rhs, amount: amount)
257
+ }
258
+ }
259
+ }
260
+
261
+ // MARK: - Optional + Interpolatable, AnyInterpolatable
262
+
263
+ extension Optional: Interpolatable, AnyInterpolatable where Wrapped: Interpolatable {
264
+ public func interpolate(to: Wrapped?, amount: CGFloat) -> Wrapped? {
265
+ guard let self, let to else { return nil }
266
+ return self.interpolate(to: to, amount: amount)
267
+ }
268
+ }
269
+
270
+ // MARK: - Hold
271
+
272
+ /// An `Interpolatable` container that animates using "hold" keyframes.
273
+ /// The keyframes do not animate, and instead always display the value from the most recent keyframe.
274
+ /// This is necessary when passing non-interpolatable values to a method that requires an `Interpolatable` conformance.
275
+ struct Hold<T>: Interpolatable {
276
+ let value: T
277
+
278
+ func interpolate(to: Hold<T>, amount: CGFloat) -> Hold<T> {
279
+ if amount < 1 {
280
+ self
281
+ } else {
282
+ to
283
+ }
284
+ }
285
+ }
@@ -0,0 +1,98 @@
1
+ // Created by Cal Stephens on 1/24/22.
2
+ // Copyright © 2022 Airbnb Inc. All rights reserved.
3
+
4
+ import CoreFoundation
5
+
6
+ // MARK: - Keyframe
7
+
8
+ /// A keyframe with a single value, and timing information
9
+ /// about when the value should be displayed and how it
10
+ /// should be interpolated.
11
+ public final class Keyframe<T> {
12
+
13
+ // MARK: Lifecycle
14
+
15
+ /// Initialize a value-only keyframe with no time data.
16
+ public init(
17
+ _ value: T,
18
+ spatialInTangent: LottieVector3D? = nil,
19
+ spatialOutTangent: LottieVector3D? = nil
20
+ ) {
21
+ self.value = value
22
+ time = 0
23
+ isHold = true
24
+ inTangent = nil
25
+ outTangent = nil
26
+ self.spatialInTangent = spatialInTangent
27
+ self.spatialOutTangent = spatialOutTangent
28
+ }
29
+
30
+ /// Initialize a keyframe
31
+ public init(
32
+ value: T,
33
+ time: AnimationFrameTime,
34
+ isHold: Bool = false,
35
+ inTangent: LottieVector2D? = nil,
36
+ outTangent: LottieVector2D? = nil,
37
+ spatialInTangent: LottieVector3D? = nil,
38
+ spatialOutTangent: LottieVector3D? = nil
39
+ ) {
40
+ self.value = value
41
+ self.time = time
42
+ self.isHold = isHold
43
+ self.outTangent = outTangent
44
+ self.inTangent = inTangent
45
+ self.spatialInTangent = spatialInTangent
46
+ self.spatialOutTangent = spatialOutTangent
47
+ }
48
+
49
+ // MARK: Public
50
+
51
+ /// The value of the keyframe
52
+ public let value: T
53
+ /// The time in frames of the keyframe.
54
+ public let time: AnimationFrameTime
55
+ /// A hold keyframe freezes interpolation until the next keyframe that is not a hold.
56
+ public let isHold: Bool
57
+ /// The in tangent for the time interpolation curve.
58
+ public let inTangent: LottieVector2D?
59
+ /// The out tangent for the time interpolation curve.
60
+ public let outTangent: LottieVector2D?
61
+
62
+ /// The spatial in tangent of the vector.
63
+ public let spatialInTangent: LottieVector3D?
64
+ /// The spatial out tangent of the vector.
65
+ public let spatialOutTangent: LottieVector3D?
66
+ }
67
+
68
+ // MARK: Equatable
69
+
70
+ extension Keyframe: Equatable where T: Equatable {
71
+ public static func ==(lhs: Keyframe<T>, rhs: Keyframe<T>) -> Bool {
72
+ lhs.value == rhs.value
73
+ && lhs.time == rhs.time
74
+ && lhs.isHold == rhs.isHold
75
+ && lhs.inTangent == rhs.inTangent
76
+ && lhs.outTangent == rhs.outTangent
77
+ && lhs.spatialInTangent == rhs.spatialOutTangent
78
+ && lhs.spatialOutTangent == rhs.spatialOutTangent
79
+ }
80
+ }
81
+
82
+ // MARK: Hashable
83
+
84
+ extension Keyframe: Hashable where T: Hashable {
85
+ public func hash(into hasher: inout Hasher) {
86
+ hasher.combine(value)
87
+ hasher.combine(time)
88
+ hasher.combine(isHold)
89
+ hasher.combine(inTangent)
90
+ hasher.combine(outTangent)
91
+ hasher.combine(spatialInTangent)
92
+ hasher.combine(spatialOutTangent)
93
+ }
94
+ }
95
+
96
+ // MARK: Sendable
97
+
98
+ extension Keyframe: Sendable where T: Sendable { }
@@ -0,0 +1,138 @@
1
+ // Created by eric_horacek on 12/9/20.
2
+ // Copyright © 2020 Airbnb Inc. All rights reserved.
3
+
4
+ // MARK: - LottieLogger
5
+
6
+ /// A shared logger that allows consumers to intercept Lottie assertions and warning messages to pipe
7
+ /// into their own logging systems.
8
+ public final class LottieLogger {
9
+
10
+ // MARK: Lifecycle
11
+
12
+ public init(
13
+ assert: @escaping Assert = { condition, message, file, line in
14
+ // If we default to `Swift.assert` directly with `assert: Assert = Swift.assert`,
15
+ // the call will unexpectedly not respect the -O flag and will crash in release
16
+ // https://github.com/swiftlang/swift/issues/60249
17
+ Swift.assert(condition(), message(), file: file, line: line)
18
+ },
19
+ assertionFailure: @escaping AssertionFailure = { message, file, line in
20
+ // If we default to `Swift.assertionFailure` directly with
21
+ // `assertionFailure: AssertionFailure = Swift.assertionFailure`,
22
+ // the call will unexpectedly not respect the -O flag and will crash in release
23
+ // https://github.com/swiftlang/swift/issues/60249
24
+ Swift.assertionFailure(message(), file: file, line: line)
25
+ },
26
+ warn: @escaping Warn = { message, _, _ in
27
+ #if DEBUG
28
+ // swiftlint:disable:next no_direct_standard_out_logs
29
+ print(message())
30
+ #endif
31
+ },
32
+ info: @escaping Info = { message in
33
+ #if DEBUG
34
+ // swiftlint:disable:next no_direct_standard_out_logs
35
+ print(message())
36
+ #endif
37
+ }
38
+ ) {
39
+ _assert = assert
40
+ _assertionFailure = assertionFailure
41
+ _warn = warn
42
+ _info = info
43
+ }
44
+
45
+ // MARK: Public
46
+
47
+ /// Logs that an assertion occurred.
48
+ public typealias Assert = (
49
+ _ condition: @autoclosure () -> Bool,
50
+ _ message: @autoclosure () -> String,
51
+ _ fileID: StaticString,
52
+ _ line: UInt
53
+ ) -> Void
54
+
55
+ /// Logs that an assertion failure occurred.
56
+ public typealias AssertionFailure = (
57
+ _ message: @autoclosure () -> String,
58
+ _ fileID: StaticString,
59
+ _ line: UInt
60
+ ) -> Void
61
+
62
+ /// Logs a warning message.
63
+ public typealias Warn = (
64
+ _ message: @autoclosure () -> String,
65
+ _ fileID: StaticString,
66
+ _ line: UInt
67
+ ) -> Void
68
+
69
+ /// Prints a purely informational message.
70
+ public typealias Info = (_ message: @autoclosure () -> String) -> Void
71
+
72
+ /// The shared instance used to log Lottie assertions and warnings.
73
+ ///
74
+ /// Set this to a new logger instance to intercept assertions and warnings logged by Lottie.
75
+ public static var shared = LottieLogger()
76
+
77
+ /// Logs that an assertion occurred.
78
+ public func assert(
79
+ _ condition: @autoclosure () -> Bool,
80
+ _ message: @autoclosure () -> String = String(),
81
+ fileID: StaticString = #fileID,
82
+ line: UInt = #line
83
+ ) {
84
+ _assert(condition(), message(), fileID, line)
85
+ }
86
+
87
+ /// Logs that an assertion failure occurred.
88
+ public func assertionFailure(
89
+ _ message: @autoclosure () -> String = String(),
90
+ fileID: StaticString = #fileID,
91
+ line: UInt = #line
92
+ ) {
93
+ _assertionFailure(message(), fileID, line)
94
+ }
95
+
96
+ /// Logs a warning message.
97
+ public func warn(
98
+ _ message: @autoclosure () -> String = String(),
99
+ fileID: StaticString = #fileID,
100
+ line: UInt = #line
101
+ ) {
102
+ _warn(message(), fileID, line)
103
+ }
104
+
105
+ /// Logs a purely informational message.
106
+ public func info(_ message: @autoclosure () -> String = String()) {
107
+ _info(message())
108
+ }
109
+
110
+ // MARK: Private
111
+
112
+ private let _assert: Assert
113
+ private let _assertionFailure: AssertionFailure
114
+ private let _warn: Warn
115
+ private let _info: Info
116
+
117
+ }
118
+
119
+ // MARK: - LottieLogger + printToConsole
120
+
121
+ extension LottieLogger {
122
+ /// A `LottieLogger` instance that always prints to the console (by calling `print`)
123
+ /// instead of calling `assert` / `assertionFailure`, which halt execution in debug builds.
124
+ public static var printToConsole: LottieLogger {
125
+ LottieLogger(
126
+ assert: { condition, message, _, _ in
127
+ if !condition() {
128
+ // swiftlint:disable:next no_direct_standard_out_logs
129
+ print(message())
130
+ }
131
+ },
132
+ assertionFailure: { message, _, _ in
133
+ // swiftlint:disable:next no_direct_standard_out_logs
134
+ print(message())
135
+ }
136
+ )
137
+ }
138
+ }
@@ -0,0 +1,15 @@
1
+ //
2
+ // AnimationTime.swift
3
+ // lottie-swift-iOS
4
+ //
5
+ // Created by Brandon Withrow on 2/6/19.
6
+ //
7
+
8
+ import CoreGraphics
9
+ import Foundation
10
+
11
+ /// Defines animation time in Frames (Seconds * Framerate).
12
+ public typealias AnimationFrameTime = CGFloat
13
+
14
+ /// Defines animation time by a progress from 0 (beginning of the animation) to 1 (end of the animation)
15
+ public typealias AnimationProgressTime = CGFloat
@@ -0,0 +1,43 @@
1
+ //
2
+ // LottieColor.swift
3
+ // lottie-swift
4
+ //
5
+ // Created by Brandon Withrow on 2/4/19.
6
+ //
7
+
8
+ // MARK: - ColorFormatDenominator
9
+
10
+ public enum ColorFormatDenominator: Hashable {
11
+ case One
12
+ case OneHundred
13
+ case TwoFiftyFive
14
+
15
+ var value: Double {
16
+ switch self {
17
+ case .One:
18
+ 1.0
19
+ case .OneHundred:
20
+ 100.0
21
+ case .TwoFiftyFive:
22
+ 255.0
23
+ }
24
+ }
25
+ }
26
+
27
+ // MARK: - LottieColor
28
+
29
+ public struct LottieColor: Hashable {
30
+
31
+ public init(r: Double, g: Double, b: Double, a: Double, denominator: ColorFormatDenominator = .One) {
32
+ self.r = r / denominator.value
33
+ self.g = g / denominator.value
34
+ self.b = b / denominator.value
35
+ self.a = a / denominator.value
36
+ }
37
+
38
+ public var r: Double
39
+ public var g: Double
40
+ public var b: Double
41
+ public var a: Double
42
+
43
+ }
@@ -0,0 +1,36 @@
1
+ //
2
+ // Vectors.swift
3
+ // lottie-swift
4
+ //
5
+ // Created by Brandon Withrow on 2/4/19.
6
+ //
7
+
8
+ // MARK: - LottieVector1D
9
+
10
+ public struct LottieVector1D: Hashable, Sendable {
11
+
12
+ public init(_ value: Double) {
13
+ self.value = value
14
+ }
15
+
16
+ public let value: Double
17
+
18
+ }
19
+
20
+ // MARK: - LottieVector3D
21
+
22
+ /// A three dimensional vector.
23
+ /// These vectors are encoded and decoded from [Double]
24
+ public struct LottieVector3D: Hashable, Sendable {
25
+
26
+ public init(x: Double, y: Double, z: Double) {
27
+ self.x = x
28
+ self.y = y
29
+ self.z = z
30
+ }
31
+
32
+ public let x: Double
33
+ public let y: Double
34
+ public let z: Double
35
+
36
+ }