@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.
- package/README.md +36 -16
- package/dist/native/index.js +10 -9
- package/dist/native/octane-client-build.json +1 -1
- package/dist/web/index.js +39 -25
- package/dist/web/octane-client-build.json +1 -1
- package/package.json +25 -3
- package/platforms/macos/LICENSE-EpoxyCore-Apache-2.0.txt +201 -0
- package/platforms/macos/LICENSE-LRUCache-MIT.txt +22 -0
- package/platforms/macos/LICENSE-Lottie-Apache-2.0.txt +201 -0
- package/platforms/macos/LICENSE-ZIPFoundation-MIT.txt +21 -0
- package/platforms/macos/UPSTREAM.md +13 -0
- package/platforms/macos/resources/PrivacyInfo.xcprivacy +23 -0
- package/platforms/macos/resources/THIRD-PARTY-NOTICES.txt +10 -0
- package/platforms/macos/src/XplatAppKitLottie.swift +246 -0
- package/platforms/macos/src/vendor/Lottie/PrivacyInfo.xcprivacy +23 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/CAAnimation+TimingConfiguration.swift +81 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/CALayer+addAnimation.swift +476 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/CombinedShapeAnimation.swift +92 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/CustomPathAnimation.swift +89 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/DropShadowAnimation.swift +179 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/EllipseAnimation.swift +53 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/GradientAnimations.swift +287 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/LayerProperty.swift +440 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/OpacityAnimation.swift +53 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/RectangleAnimation.swift +59 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/ShapeAnimation.swift +246 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/StarAnimation.swift +119 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/StrokeAnimation.swift +96 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/TransformAnimations.swift +380 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/VisibilityAnimation.swift +63 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/CompatibilityTracker.swift +129 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/CoreAnimationLayer.swift +645 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Extensions/CALayer+fillBounds.swift +35 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Extensions/KeyframeGroup+exactlyOneKeyframe.swift +28 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Extensions/Keyframes+combined.swift +345 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Extensions/Keyframes+timeRemapping.swift +46 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/AnimationLayer.swift +169 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/BaseAnimationLayer.swift +46 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/BaseCompositionLayer.swift +120 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/CALayer+setupLayerHierarchy.swift +169 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/GradientRenderLayer.swift +101 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/ImageLayer.swift +81 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/InfiniteOpaqueAnimationLayer.swift +57 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/LayerModel+makeAnimationLayer.swift +59 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/MaskCompositionLayer.swift +139 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/PreCompLayer.swift +107 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/RepeaterLayer.swift +113 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/ShapeItemLayer.swift +346 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/ShapeLayer.swift +569 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/SolidLayer.swift +66 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/TextLayer.swift +157 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/TransformLayer.swift +13 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/ValueProviderStore.swift +157 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Diffing/Collection+Diff.swift +267 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Diffing/Diffable.swift +19 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Diffing/DiffableSection.swift +16 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Diffing/IndexChangeset.swift +187 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Diffing/SectionedChangeset.swift +22 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Logging/EpoxyLogger.swift +102 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/CallbackContextEpoxyModeled.swift +8 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/EpoxyModelArrayBuilder.swift +48 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/EpoxyModelProperty.swift +158 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/EpoxyModelStorage.swift +88 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/EpoxyModeled.swift +54 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Internal/AnyEpoxyModelProperty.swift +31 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Internal/ClassReference.swift +39 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/AnimatedProviding.swift +10 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/DataIDProviding.swift +58 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/DidDisplayProviding.swift +41 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/DidEndDisplayingProviding.swift +42 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/DidSelectProviding.swift +36 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/ErasedContentProviding.swift +49 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/MakeViewProviding.swift +61 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/SetBehaviorsProviding.swift +38 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/SetContentProviding.swift +38 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/StyleIDProviding.swift +38 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/TraitCollectionProviding.swift +14 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/ViewDifferentiatorProviding.swift +34 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/ViewProviding.swift +13 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/WillDisplayProviding.swift +41 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/ViewEpoxyModeled.swift +10 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/README.md +30 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/EpoxySwiftUIIntrinsicContentSizeInvalidator.swift +34 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/EpoxySwiftUILayoutMargins.swift +38 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/EpoxyableView+SwiftUIView.swift +165 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/LayoutUtilities/MeasuringViewRepresentable.swift +127 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/LayoutUtilities/SwiftUIMeasurementContainer.swift +468 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/SwiftUIView.swift +146 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/UIView+SwiftUIView.swift +39 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/UIViewConfiguringSwiftUIView.swift +41 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Views/BehaviorsConfigurableView.swift +45 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Views/ContentConfigurableView.swift +36 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Views/EpoxyableView.swift +5 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Views/StyledView.swift +43 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Views/ViewType.swift +47 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/LRUCache/LRUCache.swift +257 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/LRUCache/README.md +24 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/README.md +43 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Archive+BackingConfiguration.swift +149 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Archive+Deprecated.swift +23 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Archive+Helpers.swift +361 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Archive+MemoryFile.swift +205 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Archive+Progress.swift +66 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Archive+Reading.swift +160 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Archive+ReadingDeprecated.swift +50 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Archive+Writing.swift +403 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Archive+WritingDeprecated.swift +95 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Archive+ZIP64.swift +191 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Archive.swift +404 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Data+Compression.swift +632 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Data+CompressionDeprecated.swift +43 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Data+Serialization.swift +146 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Date+ZIP.swift +101 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Entry+Serialization.swift +191 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Entry+ZIP64.swift +170 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Entry.swift +669 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/FileManager+ZIP.swift +405 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/FileManager+ZIPDeprecated.swift +28 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/README.md +24 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/URL+ZIP.swift +34 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/CompLayers/CompositionLayer.swift +177 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/CompLayers/ImageCompositionLayer.swift +54 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/CompLayers/MaskContainerLayer.swift +191 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/CompLayers/NullCompositionLayer.swift +28 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/CompLayers/PreCompositionLayer.swift +137 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/CompLayers/ShapeCompositionLayer.swift +60 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/CompLayers/SolidCompositionLayer.swift +57 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/CompLayers/TextCompositionLayer.swift +247 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/MainThreadAnimationLayer.swift +321 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/Utility/CachedImageProvider.swift +56 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/Utility/CompositionLayersInitializer.swift +103 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/Utility/CoreTextRenderLayer.swift +424 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/Utility/InvertedMatteLayer.swift +55 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/Utility/LayerFontProvider.swift +39 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/Utility/LayerImageProvider.swift +52 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/Utility/LayerTextProvider.swift +38 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/Utility/LayerTransformNode.swift +149 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Extensions/ItemsExtension.swift +146 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/NodeProperties/NodeProperty.swift +62 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/NodeProperties/Protocols/AnyNodeProperty.swift +53 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/NodeProperties/Protocols/AnyValueContainer.swift +26 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/NodeProperties/Protocols/KeypathSearchable.swift +23 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/NodeProperties/Protocols/NodePropertyMap.swift +43 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/NodeProperties/ValueContainer.swift +47 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/NodeProperties/ValueProviders/GroupInterpolator.swift +39 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/NodeProperties/ValueProviders/SingleValueProvider.swift +43 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/LayerEffectNodes/DropShadowNode.swift +102 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/LayerEffectNodes/LayerEffectNode.swift +25 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/ModifierNodes/RoundedCornersNode.swift +85 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/ModifierNodes/TrimPathNode.swift +281 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/OutputNodes/GroupOutputNode.swift +74 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/OutputNodes/PassThroughOutputNode.swift +47 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/OutputNodes/PathOutputNode.swift +89 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/OutputNodes/Renderables/FillRenderer.swift +69 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/OutputNodes/Renderables/GradientFillRenderer.swift +253 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/OutputNodes/Renderables/GradientStrokeRenderer.swift +64 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/OutputNodes/Renderables/LegacyGradientFillRenderer.swift +158 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/OutputNodes/Renderables/StrokeRenderer.swift +165 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/PathNodes/EllipseNode.swift +143 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/PathNodes/PolygonNode.swift +173 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/PathNodes/RectNode.swift +238 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/PathNodes/ShapeNode.swift +73 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/PathNodes/StarNode.swift +224 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/RenderContainers/GroupNode.swift +162 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/RenderNodes/FillNode.swift +88 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/RenderNodes/GradientFillNode.swift +103 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/RenderNodes/GradientStrokeNode.swift +149 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/RenderNodes/StrokeNode.swift +179 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/Text/TextAnimatorNode.swift +345 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Protocols/AnimatorNode.swift +197 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Protocols/PathNode.swift +20 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Protocols/RenderNode.swift +60 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/RenderLayers/ShapeContainerLayer.swift +78 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/RenderLayers/ShapeRenderLayer.swift +98 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/Assets/Asset.swift +51 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/Assets/AssetLibrary.swift +75 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/Assets/ImageAsset.swift +141 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/Assets/PrecompAsset.swift +47 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/DictionaryInitializable.swift +73 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/DotLottie/DotLottieAnimation.swift +57 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/DotLottie/DotLottieImageProvider.swift +89 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/DotLottie/DotLottieManifest.swift +42 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/DotLottie/DotLottieUtils.swift +71 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/Extensions/Bundle.swift +58 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/Extensions/KeyedDecodingContainerExtensions.swift +71 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/Keyframes/KeyframeData.swift +111 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/Keyframes/KeyframeGroup.swift +265 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/LayerEffects/DropShadowEffect.swift +52 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/LayerEffects/EffectValues/ColorEffectValue.swift +45 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/LayerEffects/EffectValues/EffectValue.swift +98 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/LayerEffects/EffectValues/Vector1DEffectValue.swift +45 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/LayerEffects/LayerEffect.swift +103 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/LayerStyles/DropShadowStyle.swift +79 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/LayerStyles/LayerStyle.swift +85 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/Layers/ImageLayerModel.swift +49 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/Layers/LayerModel.swift +266 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/Layers/PreCompLayerModel.swift +74 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/Layers/ShapeLayerModel.swift +50 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/Layers/SolidLayerModel.swift +63 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/Layers/TextLayerModel.swift +65 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/Objects/DashPattern.swift +42 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/Objects/Marker.swift +35 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/Objects/Mask.swift +80 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/Objects/Transform.swift +261 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/Ellipse.swift +79 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/Fill.swift +79 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/GradientFill.swift +142 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/GradientStroke.swift +244 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/Group.swift +55 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/Merge.swift +63 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/Rectangle.swift +79 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/Repeater.swift +181 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/RoundedCorners.swift +53 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/Shape.swift +63 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/ShapeItem.swift +171 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/ShapeTransform.swift +202 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/Star.swift +136 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/Stroke.swift +144 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/Trim.swift +90 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/Text/Font.swift +67 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/Text/Glyph.swift +94 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/Text/TextAnimator.swift +240 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/Text/TextDocument.swift +142 -0
- package/platforms/macos/src/vendor/Lottie/Private/RootAnimationLayer.swift +54 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/Debugging/AnimatorNodeDebugging.swift +23 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/Debugging/LayerDebugging.swift +231 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/Debugging/TestHelpers.swift +10 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/Extensions/AnimationKeypathExtension.swift +303 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/Extensions/BlendMode+Filter.swift +31 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/Extensions/CGColor+RGB.swift +45 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/Extensions/CGFloatExtensions.swift +152 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/Extensions/DataExtension.swift +33 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/Extensions/MathKit.swift +454 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/Extensions/StringExtensions.swift +44 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/Helpers/AnimationContext.swift +95 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/Helpers/AnyEquatable.swift +23 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/Helpers/Binding+Map.swift +19 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/Helpers/View+ValueChanged.swift +35 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/Interpolatable/InterpolatableExtensions.swift +143 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/Interpolatable/KeyframeExtensions.swift +47 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/Interpolatable/KeyframeInterpolator.swift +250 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/LottieAnimationSource.swift +51 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/Primitives/BezierPath.swift +509 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/Primitives/BezierPathRoundExtension.swift +163 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/Primitives/CGPointExtension.swift +35 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/Primitives/ColorExtension.swift +101 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/Primitives/CompoundBezierPath.swift +169 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/Primitives/CurveVertex.swift +190 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/Primitives/PathElement.swift +78 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/Primitives/UnitBezier.swift +119 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/Primitives/VectorsExtensions.swift +368 -0
- package/platforms/macos/src/vendor/Lottie/Public/Animation/LottieAnimation.swift +179 -0
- package/platforms/macos/src/vendor/Lottie/Public/Animation/LottieAnimationHelpers.swift +317 -0
- package/platforms/macos/src/vendor/Lottie/Public/Animation/LottieAnimationLayer.swift +1582 -0
- package/platforms/macos/src/vendor/Lottie/Public/Animation/LottieAnimationView.swift +1090 -0
- package/platforms/macos/src/vendor/Lottie/Public/Animation/LottieAnimationViewInitializers.swift +226 -0
- package/platforms/macos/src/vendor/Lottie/Public/Animation/LottiePlaybackMode.swift +266 -0
- package/platforms/macos/src/vendor/Lottie/Public/Animation/LottieView.swift +643 -0
- package/platforms/macos/src/vendor/Lottie/Public/AnimationCache/AnimationCacheProvider.swift +21 -0
- package/platforms/macos/src/vendor/Lottie/Public/AnimationCache/DefaultAnimationCache.swift +67 -0
- package/platforms/macos/src/vendor/Lottie/Public/AnimationCache/LRUAnimationCache.swift +11 -0
- package/platforms/macos/src/vendor/Lottie/Public/AnimationCache/LottieAnimationCache.swift +15 -0
- package/platforms/macos/src/vendor/Lottie/Public/Configuration/DecodingStrategy.swift +15 -0
- package/platforms/macos/src/vendor/Lottie/Public/Configuration/LottieConfiguration.swift +54 -0
- package/platforms/macos/src/vendor/Lottie/Public/Configuration/LottieURLSession.swift +31 -0
- package/platforms/macos/src/vendor/Lottie/Public/Configuration/ReducedMotionOption.swift +128 -0
- package/platforms/macos/src/vendor/Lottie/Public/Configuration/RenderingEngineOption.swift +117 -0
- package/platforms/macos/src/vendor/Lottie/Public/Controls/AnimatedButton.swift +128 -0
- package/platforms/macos/src/vendor/Lottie/Public/Controls/AnimatedControl.swift +248 -0
- package/platforms/macos/src/vendor/Lottie/Public/Controls/AnimatedSwitch.swift +271 -0
- package/platforms/macos/src/vendor/Lottie/Public/Controls/LottieButton.swift +119 -0
- package/platforms/macos/src/vendor/Lottie/Public/Controls/LottieSwitch.swift +144 -0
- package/platforms/macos/src/vendor/Lottie/Public/Controls/LottieViewType.swift +79 -0
- package/platforms/macos/src/vendor/Lottie/Public/DotLottie/Cache/DotLottieCache.swift +66 -0
- package/platforms/macos/src/vendor/Lottie/Public/DotLottie/Cache/DotLottieCacheProvider.swift +21 -0
- package/platforms/macos/src/vendor/Lottie/Public/DotLottie/DotLottieConfiguration.swift +72 -0
- package/platforms/macos/src/vendor/Lottie/Public/DotLottie/DotLottieFile.swift +186 -0
- package/platforms/macos/src/vendor/Lottie/Public/DotLottie/DotLottieFileHelpers.swift +386 -0
- package/platforms/macos/src/vendor/Lottie/Public/DynamicProperties/AnimationKeypath.swift +57 -0
- package/platforms/macos/src/vendor/Lottie/Public/DynamicProperties/AnyValueProvider.swift +132 -0
- package/platforms/macos/src/vendor/Lottie/Public/DynamicProperties/ValueProviders/ColorValueProvider.swift +96 -0
- package/platforms/macos/src/vendor/Lottie/Public/DynamicProperties/ValueProviders/FloatValueProvider.swift +81 -0
- package/platforms/macos/src/vendor/Lottie/Public/DynamicProperties/ValueProviders/GradientValueProvider.swift +138 -0
- package/platforms/macos/src/vendor/Lottie/Public/DynamicProperties/ValueProviders/PointValueProvider.swift +81 -0
- package/platforms/macos/src/vendor/Lottie/Public/DynamicProperties/ValueProviders/SizeValueProvider.swift +81 -0
- package/platforms/macos/src/vendor/Lottie/Public/FontProvider/AnimationFontProvider.swift +41 -0
- package/platforms/macos/src/vendor/Lottie/Public/ImageProvider/AnimationImageProvider.swift +43 -0
- package/platforms/macos/src/vendor/Lottie/Public/Keyframes/Interpolatable.swift +285 -0
- package/platforms/macos/src/vendor/Lottie/Public/Keyframes/Keyframe.swift +98 -0
- package/platforms/macos/src/vendor/Lottie/Public/Logging/LottieLogger.swift +138 -0
- package/platforms/macos/src/vendor/Lottie/Public/Primitives/AnimationTime.swift +15 -0
- package/platforms/macos/src/vendor/Lottie/Public/Primitives/LottieColor.swift +43 -0
- package/platforms/macos/src/vendor/Lottie/Public/Primitives/Vectors.swift +36 -0
- package/platforms/macos/src/vendor/Lottie/Public/TextProvider/AnimationTextProvider.swift +135 -0
- package/platforms/macos/src/vendor/Lottie/Public/iOS/AnimationSubview.swift +19 -0
- package/platforms/macos/src/vendor/Lottie/Public/iOS/BundleImageProvider.swift +98 -0
- package/platforms/macos/src/vendor/Lottie/Public/iOS/Compatibility/CompatibleAnimationKeypath.swift +33 -0
- package/platforms/macos/src/vendor/Lottie/Public/iOS/Compatibility/CompatibleAnimationView.swift +567 -0
- package/platforms/macos/src/vendor/Lottie/Public/iOS/Compatibility/CompatibleFontProvider.swift +41 -0
- package/platforms/macos/src/vendor/Lottie/Public/iOS/Compatibility/CompatibleImageProvider.swift +43 -0
- package/platforms/macos/src/vendor/Lottie/Public/iOS/FilepathImageProvider.swift +78 -0
- package/platforms/macos/src/vendor/Lottie/Public/iOS/LottieAnimationViewBase.swift +85 -0
- package/platforms/macos/src/vendor/Lottie/Public/iOS/UIColorExtension.swift +23 -0
- package/platforms/macos/src/vendor/Lottie/Public/macOS/AnimationSubview.macOS.swift +19 -0
- package/platforms/macos/src/vendor/Lottie/Public/macOS/BundleImageProvider.macOS.swift +90 -0
- package/platforms/macos/src/vendor/Lottie/Public/macOS/FilepathImageProvider.macOS.swift +86 -0
- package/platforms/macos/src/vendor/Lottie/Public/macOS/LottieAnimationViewBase.macOS.swift +102 -0
- package/src/Lottie.macos.tsrx +129 -0
- package/src/Lottie.tsrx +3 -2
- package/src/Lottie.web.tsrx +28 -11
- package/src/index.macos.ts +2 -0
- package/src/props.ts +6 -1
- package/types/generated/props.d.ts +5 -1
|
@@ -0,0 +1,368 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Vector.swift
|
|
3
|
+
// lottie-swift
|
|
4
|
+
//
|
|
5
|
+
// Created by Brandon Withrow on 1/7/19.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
import CoreGraphics
|
|
9
|
+
import Foundation
|
|
10
|
+
import QuartzCore
|
|
11
|
+
|
|
12
|
+
// MARK: - LottieVector1D + Codable
|
|
13
|
+
|
|
14
|
+
/// Single value container. Needed because lottie sometimes wraps a Double in an array.
|
|
15
|
+
extension LottieVector1D: Codable {
|
|
16
|
+
|
|
17
|
+
// MARK: Lifecycle
|
|
18
|
+
|
|
19
|
+
public init(from decoder: Decoder) throws {
|
|
20
|
+
/// Try to decode an array of doubles
|
|
21
|
+
do {
|
|
22
|
+
var container = try decoder.unkeyedContainer()
|
|
23
|
+
value = try container.decode(Double.self)
|
|
24
|
+
} catch {
|
|
25
|
+
value = try decoder.singleValueContainer().decode(Double.self)
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// MARK: Public
|
|
30
|
+
|
|
31
|
+
public func encode(to encoder: Encoder) throws {
|
|
32
|
+
var container = encoder.singleValueContainer()
|
|
33
|
+
try container.encode(value)
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// MARK: Internal
|
|
37
|
+
|
|
38
|
+
var cgFloatValue: CGFloat {
|
|
39
|
+
CGFloat(value)
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// MARK: - LottieVector1D + AnyInitializable
|
|
45
|
+
|
|
46
|
+
extension LottieVector1D: AnyInitializable {
|
|
47
|
+
|
|
48
|
+
init(value: Any) throws {
|
|
49
|
+
if
|
|
50
|
+
let array = value as? [Double],
|
|
51
|
+
let double = array.first
|
|
52
|
+
{
|
|
53
|
+
self.value = double
|
|
54
|
+
} else if let double = value as? Double {
|
|
55
|
+
self.value = double
|
|
56
|
+
} else {
|
|
57
|
+
throw InitializableError.invalidInput()
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
extension Double {
|
|
64
|
+
var vectorValue: LottieVector1D {
|
|
65
|
+
LottieVector1D(self)
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// MARK: - LottieVector2D
|
|
70
|
+
|
|
71
|
+
/// Needed for decoding json {x: y:} to a CGPoint
|
|
72
|
+
public struct LottieVector2D: Codable, Hashable, Sendable {
|
|
73
|
+
|
|
74
|
+
// MARK: Lifecycle
|
|
75
|
+
|
|
76
|
+
init(x: Double, y: Double) {
|
|
77
|
+
self.x = x
|
|
78
|
+
self.y = y
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
public init(from decoder: Decoder) throws {
|
|
82
|
+
let container = try decoder.container(keyedBy: LottieVector2D.CodingKeys.self)
|
|
83
|
+
|
|
84
|
+
do {
|
|
85
|
+
let xValue: [Double] = try container.decode([Double].self, forKey: .x)
|
|
86
|
+
x = xValue[0]
|
|
87
|
+
} catch {
|
|
88
|
+
x = try container.decode(Double.self, forKey: .x)
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
do {
|
|
92
|
+
let yValue: [Double] = try container.decode([Double].self, forKey: .y)
|
|
93
|
+
y = yValue[0]
|
|
94
|
+
} catch {
|
|
95
|
+
y = try container.decode(Double.self, forKey: .y)
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
// MARK: Public
|
|
100
|
+
|
|
101
|
+
public func encode(to encoder: Encoder) throws {
|
|
102
|
+
var container = encoder.container(keyedBy: LottieVector2D.CodingKeys.self)
|
|
103
|
+
try container.encode(x, forKey: .x)
|
|
104
|
+
try container.encode(y, forKey: .y)
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
// MARK: Internal
|
|
108
|
+
|
|
109
|
+
var x: Double
|
|
110
|
+
var y: Double
|
|
111
|
+
|
|
112
|
+
var pointValue: CGPoint {
|
|
113
|
+
CGPoint(x: x, y: y)
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
// MARK: Private
|
|
117
|
+
|
|
118
|
+
private enum CodingKeys: String, CodingKey {
|
|
119
|
+
case x
|
|
120
|
+
case y
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
// MARK: AnyInitializable
|
|
125
|
+
|
|
126
|
+
extension LottieVector2D: AnyInitializable {
|
|
127
|
+
|
|
128
|
+
init(value: Any) throws {
|
|
129
|
+
guard let dictionary = value as? [String: Any] else {
|
|
130
|
+
throw InitializableError.invalidInput()
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
if
|
|
134
|
+
let array = dictionary[CodingKeys.x.rawValue] as? [Double],
|
|
135
|
+
let double = array.first
|
|
136
|
+
{
|
|
137
|
+
x = double
|
|
138
|
+
} else if let double = dictionary[CodingKeys.x.rawValue] as? Double {
|
|
139
|
+
x = double
|
|
140
|
+
} else {
|
|
141
|
+
throw InitializableError.invalidInput()
|
|
142
|
+
}
|
|
143
|
+
if
|
|
144
|
+
let array = dictionary[CodingKeys.y.rawValue] as? [Double],
|
|
145
|
+
let double = array.first
|
|
146
|
+
{
|
|
147
|
+
y = double
|
|
148
|
+
} else if let double = dictionary[CodingKeys.y.rawValue] as? Double {
|
|
149
|
+
y = double
|
|
150
|
+
} else {
|
|
151
|
+
throw InitializableError.invalidInput()
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
extension CGPoint {
|
|
157
|
+
var vector2dValue: LottieVector2D {
|
|
158
|
+
LottieVector2D(x: Double(x), y: Double(y))
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
// MARK: - LottieVector3D + Codable
|
|
163
|
+
|
|
164
|
+
/// A three dimensional vector.
|
|
165
|
+
/// These vectors are encoded and decoded from [Double]
|
|
166
|
+
|
|
167
|
+
extension LottieVector3D: Codable {
|
|
168
|
+
|
|
169
|
+
// MARK: Lifecycle
|
|
170
|
+
|
|
171
|
+
init(x: CGFloat, y: CGFloat, z: CGFloat) {
|
|
172
|
+
self.x = Double(x)
|
|
173
|
+
self.y = Double(y)
|
|
174
|
+
self.z = Double(z)
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
public init(from decoder: Decoder) throws {
|
|
178
|
+
var container = try decoder.unkeyedContainer()
|
|
179
|
+
|
|
180
|
+
if !container.isAtEnd {
|
|
181
|
+
x = try container.decode(Double.self)
|
|
182
|
+
} else {
|
|
183
|
+
x = 0
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
if !container.isAtEnd {
|
|
187
|
+
y = try container.decode(Double.self)
|
|
188
|
+
} else {
|
|
189
|
+
y = 0
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
if !container.isAtEnd {
|
|
193
|
+
z = try container.decode(Double.self)
|
|
194
|
+
} else {
|
|
195
|
+
z = 0
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
// MARK: Public
|
|
200
|
+
|
|
201
|
+
public func encode(to encoder: Encoder) throws {
|
|
202
|
+
var container = encoder.unkeyedContainer()
|
|
203
|
+
try container.encode(x)
|
|
204
|
+
try container.encode(y)
|
|
205
|
+
try container.encode(z)
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
// MARK: - LottieVector3D + AnyInitializable
|
|
211
|
+
|
|
212
|
+
extension LottieVector3D: AnyInitializable {
|
|
213
|
+
|
|
214
|
+
init(value: Any) throws {
|
|
215
|
+
guard var array = value as? [Double] else {
|
|
216
|
+
throw InitializableError.invalidInput()
|
|
217
|
+
}
|
|
218
|
+
x = array.count > 0 ? array.removeFirst() : 0
|
|
219
|
+
y = array.count > 0 ? array.removeFirst() : 0
|
|
220
|
+
z = array.count > 0 ? array.removeFirst() : 0
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
extension LottieVector3D {
|
|
226
|
+
public var pointValue: CGPoint {
|
|
227
|
+
CGPoint(x: x, y: y)
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
public var sizeValue: CGSize {
|
|
231
|
+
CGSize(width: x, height: y)
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
extension CGPoint {
|
|
236
|
+
var vector3dValue: LottieVector3D {
|
|
237
|
+
LottieVector3D(x: x, y: y, z: 0)
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
extension CGSize {
|
|
242
|
+
var vector3dValue: LottieVector3D {
|
|
243
|
+
LottieVector3D(x: width, y: height, z: 1)
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
extension CATransform3D {
|
|
248
|
+
|
|
249
|
+
enum Axis {
|
|
250
|
+
case x
|
|
251
|
+
case y
|
|
252
|
+
case z
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
static func makeSkew(skew: CGFloat, skewAxis: CGFloat) -> CATransform3D {
|
|
256
|
+
let mCos = cos(skewAxis.toRadians())
|
|
257
|
+
let mSin = sin(skewAxis.toRadians())
|
|
258
|
+
let aTan = tan(skew.toRadians())
|
|
259
|
+
|
|
260
|
+
let transform1 = CATransform3D(
|
|
261
|
+
m11: mCos,
|
|
262
|
+
m12: mSin,
|
|
263
|
+
m13: 0,
|
|
264
|
+
m14: 0,
|
|
265
|
+
m21: -mSin,
|
|
266
|
+
m22: mCos,
|
|
267
|
+
m23: 0,
|
|
268
|
+
m24: 0,
|
|
269
|
+
m31: 0,
|
|
270
|
+
m32: 0,
|
|
271
|
+
m33: 1,
|
|
272
|
+
m34: 0,
|
|
273
|
+
m41: 0,
|
|
274
|
+
m42: 0,
|
|
275
|
+
m43: 0,
|
|
276
|
+
m44: 1
|
|
277
|
+
)
|
|
278
|
+
|
|
279
|
+
let transform2 = CATransform3D(
|
|
280
|
+
m11: 1,
|
|
281
|
+
m12: 0,
|
|
282
|
+
m13: 0,
|
|
283
|
+
m14: 0,
|
|
284
|
+
m21: aTan,
|
|
285
|
+
m22: 1,
|
|
286
|
+
m23: 0,
|
|
287
|
+
m24: 0,
|
|
288
|
+
m31: 0,
|
|
289
|
+
m32: 0,
|
|
290
|
+
m33: 1,
|
|
291
|
+
m34: 0,
|
|
292
|
+
m41: 0,
|
|
293
|
+
m42: 0,
|
|
294
|
+
m43: 0,
|
|
295
|
+
m44: 1
|
|
296
|
+
)
|
|
297
|
+
|
|
298
|
+
let transform3 = CATransform3D(
|
|
299
|
+
m11: mCos,
|
|
300
|
+
m12: -mSin,
|
|
301
|
+
m13: 0,
|
|
302
|
+
m14: 0,
|
|
303
|
+
m21: mSin,
|
|
304
|
+
m22: mCos,
|
|
305
|
+
m23: 0,
|
|
306
|
+
m24: 0,
|
|
307
|
+
m31: 0,
|
|
308
|
+
m32: 0,
|
|
309
|
+
m33: 1,
|
|
310
|
+
m34: 0,
|
|
311
|
+
m41: 0,
|
|
312
|
+
m42: 0,
|
|
313
|
+
m43: 0,
|
|
314
|
+
m44: 1
|
|
315
|
+
)
|
|
316
|
+
return CATransform3DConcat(transform3, CATransform3DConcat(transform2, transform1))
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
static func makeTransform(
|
|
320
|
+
anchor: CGPoint,
|
|
321
|
+
position: CGPoint,
|
|
322
|
+
scale: CGSize,
|
|
323
|
+
rotationX: CGFloat,
|
|
324
|
+
rotationY: CGFloat,
|
|
325
|
+
rotationZ: CGFloat,
|
|
326
|
+
skew: CGFloat?,
|
|
327
|
+
skewAxis: CGFloat?
|
|
328
|
+
) -> CATransform3D {
|
|
329
|
+
if let skew, let skewAxis {
|
|
330
|
+
return CATransform3DMakeTranslation(position.x, position.y, 0)
|
|
331
|
+
.rotated(rotationX, axis: .x)
|
|
332
|
+
.rotated(rotationY, axis: .y)
|
|
333
|
+
.rotated(rotationZ, axis: .z)
|
|
334
|
+
.skewed(skew: -skew, skewAxis: skewAxis)
|
|
335
|
+
.scaled(scale * 0.01)
|
|
336
|
+
.translated(anchor * -1)
|
|
337
|
+
}
|
|
338
|
+
return CATransform3DMakeTranslation(position.x, position.y, 0)
|
|
339
|
+
.rotated(rotationX, axis: .x)
|
|
340
|
+
.rotated(rotationY, axis: .y)
|
|
341
|
+
.rotated(rotationZ, axis: .z)
|
|
342
|
+
.scaled(scale * 0.01)
|
|
343
|
+
.translated(anchor * -1)
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
func rotated(_ degrees: CGFloat, axis: Axis) -> CATransform3D {
|
|
347
|
+
CATransform3DRotate(
|
|
348
|
+
self,
|
|
349
|
+
degrees.toRadians(),
|
|
350
|
+
axis == .x ? 1 : 0,
|
|
351
|
+
axis == .y ? 1 : 0,
|
|
352
|
+
axis == .z ? 1 : 0
|
|
353
|
+
)
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
func translated(_ translation: CGPoint) -> CATransform3D {
|
|
357
|
+
CATransform3DTranslate(self, translation.x, translation.y, 0)
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
func scaled(_ scale: CGSize) -> CATransform3D {
|
|
361
|
+
CATransform3DScale(self, scale.width, scale.height, 1)
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
func skewed(skew: CGFloat, skewAxis: CGFloat) -> CATransform3D {
|
|
365
|
+
CATransform3DConcat(CATransform3D.makeSkew(skew: skew, skewAxis: skewAxis), self)
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
}
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
//
|
|
2
|
+
// LottieAnimation.swift
|
|
3
|
+
// lottie-swift
|
|
4
|
+
//
|
|
5
|
+
// Created by Brandon Withrow on 1/7/19.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
import Foundation
|
|
9
|
+
|
|
10
|
+
// MARK: - CoordinateSpace
|
|
11
|
+
|
|
12
|
+
public enum CoordinateSpace: Int, Codable, Sendable {
|
|
13
|
+
case type2d
|
|
14
|
+
case type3d
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
// MARK: - LottieAnimation
|
|
18
|
+
|
|
19
|
+
/// The `LottieAnimation` model is the top level model object in Lottie.
|
|
20
|
+
///
|
|
21
|
+
/// A `LottieAnimation` holds all of the animation data backing a Lottie Animation.
|
|
22
|
+
/// Codable, see JSON schema [here](https://github.com/airbnb/lottie-web/tree/master/docs/json).
|
|
23
|
+
public final class LottieAnimation: Codable, Sendable, DictionaryInitializable {
|
|
24
|
+
|
|
25
|
+
// MARK: Lifecycle
|
|
26
|
+
|
|
27
|
+
required public init(from decoder: Decoder) throws {
|
|
28
|
+
let container = try decoder.container(keyedBy: LottieAnimation.CodingKeys.self)
|
|
29
|
+
version = try container.decode(String.self, forKey: .version)
|
|
30
|
+
type = try container.decodeIfPresent(CoordinateSpace.self, forKey: .type) ?? .type2d
|
|
31
|
+
startFrame = try container.decode(AnimationFrameTime.self, forKey: .startFrame)
|
|
32
|
+
endFrame = try container.decode(AnimationFrameTime.self, forKey: .endFrame)
|
|
33
|
+
framerate = try container.decode(Double.self, forKey: .framerate)
|
|
34
|
+
width = try container.decode(Double.self, forKey: .width)
|
|
35
|
+
height = try container.decode(Double.self, forKey: .height)
|
|
36
|
+
layers = try container.decode([LayerModel].self, ofFamily: LayerType.self, forKey: .layers)
|
|
37
|
+
glyphs = try container.decodeIfPresent([Glyph].self, forKey: .glyphs)
|
|
38
|
+
fonts = try container.decodeIfPresent(FontList.self, forKey: .fonts)
|
|
39
|
+
assetLibrary = try container.decodeIfPresent(AssetLibrary.self, forKey: .assetLibrary)
|
|
40
|
+
markers = try container.decodeIfPresent([Marker].self, forKey: .markers)
|
|
41
|
+
|
|
42
|
+
if let markers {
|
|
43
|
+
var markerMap = [String: Marker]()
|
|
44
|
+
for marker in markers {
|
|
45
|
+
markerMap[marker.name] = marker
|
|
46
|
+
}
|
|
47
|
+
self.markerMap = markerMap
|
|
48
|
+
} else {
|
|
49
|
+
markerMap = nil
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
public init(dictionary: [String: Any]) throws {
|
|
54
|
+
version = try dictionary.value(for: CodingKeys.version)
|
|
55
|
+
if
|
|
56
|
+
let typeRawValue = dictionary[CodingKeys.type.rawValue] as? Int,
|
|
57
|
+
let type = CoordinateSpace(rawValue: typeRawValue)
|
|
58
|
+
{
|
|
59
|
+
self.type = type
|
|
60
|
+
} else {
|
|
61
|
+
type = .type2d
|
|
62
|
+
}
|
|
63
|
+
startFrame = try dictionary.value(for: CodingKeys.startFrame)
|
|
64
|
+
endFrame = try dictionary.value(for: CodingKeys.endFrame)
|
|
65
|
+
framerate = try dictionary.value(for: CodingKeys.framerate)
|
|
66
|
+
width = try dictionary.value(for: CodingKeys.width)
|
|
67
|
+
height = try dictionary.value(for: CodingKeys.height)
|
|
68
|
+
let layerDictionaries: [[String: Any]] = try dictionary.value(for: CodingKeys.layers)
|
|
69
|
+
layers = try [LayerModel].fromDictionaries(layerDictionaries)
|
|
70
|
+
if let glyphDictionaries = dictionary[CodingKeys.glyphs.rawValue] as? [[String: Any]] {
|
|
71
|
+
glyphs = try glyphDictionaries.map { try Glyph(dictionary: $0) }
|
|
72
|
+
} else {
|
|
73
|
+
glyphs = nil
|
|
74
|
+
}
|
|
75
|
+
if let fontsDictionary = dictionary[CodingKeys.fonts.rawValue] as? [String: Any] {
|
|
76
|
+
fonts = try FontList(dictionary: fontsDictionary)
|
|
77
|
+
} else {
|
|
78
|
+
fonts = nil
|
|
79
|
+
}
|
|
80
|
+
if let assetLibraryDictionaries = dictionary[CodingKeys.assetLibrary.rawValue] as? [[String: Any]] {
|
|
81
|
+
assetLibrary = try AssetLibrary(value: assetLibraryDictionaries)
|
|
82
|
+
} else {
|
|
83
|
+
assetLibrary = nil
|
|
84
|
+
}
|
|
85
|
+
if let markerDictionaries = dictionary[CodingKeys.markers.rawValue] as? [[String: Any]] {
|
|
86
|
+
let markers = try markerDictionaries.map { try Marker(dictionary: $0) }
|
|
87
|
+
var markerMap = [String: Marker]()
|
|
88
|
+
for marker in markers {
|
|
89
|
+
markerMap[marker.name] = marker
|
|
90
|
+
}
|
|
91
|
+
self.markers = markers
|
|
92
|
+
self.markerMap = markerMap
|
|
93
|
+
} else {
|
|
94
|
+
markers = nil
|
|
95
|
+
markerMap = nil
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
// MARK: Public
|
|
100
|
+
|
|
101
|
+
/// The start time of the composition in frameTime.
|
|
102
|
+
public let startFrame: AnimationFrameTime
|
|
103
|
+
|
|
104
|
+
/// The end time of the composition in frameTime.
|
|
105
|
+
public let endFrame: AnimationFrameTime
|
|
106
|
+
|
|
107
|
+
/// The frame rate of the composition.
|
|
108
|
+
public let framerate: Double
|
|
109
|
+
|
|
110
|
+
/// Return all marker names, in order, or an empty list if none are specified
|
|
111
|
+
public var markerNames: [String] {
|
|
112
|
+
guard let markers else { return [] }
|
|
113
|
+
return markers.map { $0.name }
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
// MARK: Internal
|
|
117
|
+
|
|
118
|
+
enum CodingKeys: String, CodingKey {
|
|
119
|
+
case version = "v"
|
|
120
|
+
case type = "ddd"
|
|
121
|
+
case startFrame = "ip"
|
|
122
|
+
case endFrame = "op"
|
|
123
|
+
case framerate = "fr"
|
|
124
|
+
case width = "w"
|
|
125
|
+
case height = "h"
|
|
126
|
+
case layers
|
|
127
|
+
case glyphs = "chars"
|
|
128
|
+
case fonts
|
|
129
|
+
case assetLibrary = "assets"
|
|
130
|
+
case markers
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/// The version of the JSON Schema.
|
|
134
|
+
let version: String
|
|
135
|
+
|
|
136
|
+
/// The coordinate space of the composition.
|
|
137
|
+
let type: CoordinateSpace
|
|
138
|
+
|
|
139
|
+
/// The height of the composition in points.
|
|
140
|
+
let width: Double
|
|
141
|
+
|
|
142
|
+
/// The width of the composition in points.
|
|
143
|
+
let height: Double
|
|
144
|
+
|
|
145
|
+
/// The list of animation layers
|
|
146
|
+
let layers: [LayerModel]
|
|
147
|
+
|
|
148
|
+
/// The list of glyphs used for text rendering
|
|
149
|
+
let glyphs: [Glyph]?
|
|
150
|
+
|
|
151
|
+
/// The list of fonts used for text rendering
|
|
152
|
+
let fonts: FontList?
|
|
153
|
+
|
|
154
|
+
/// Asset Library
|
|
155
|
+
let assetLibrary: AssetLibrary?
|
|
156
|
+
|
|
157
|
+
/// Markers
|
|
158
|
+
let markers: [Marker]?
|
|
159
|
+
let markerMap: [String: Marker]?
|
|
160
|
+
|
|
161
|
+
/// The marker to use if "reduced motion" is enabled.
|
|
162
|
+
/// Supported marker names are case insensitive, and include:
|
|
163
|
+
/// - reduced motion
|
|
164
|
+
/// - reducedMotion
|
|
165
|
+
/// - reduced_motion
|
|
166
|
+
/// - reduced-motion
|
|
167
|
+
var reducedMotionMarker: Marker? {
|
|
168
|
+
let allowedReducedMotionMarkerNames = Set([
|
|
169
|
+
"reduced motion",
|
|
170
|
+
"reduced_motion",
|
|
171
|
+
"reduced-motion",
|
|
172
|
+
"reducedmotion",
|
|
173
|
+
])
|
|
174
|
+
|
|
175
|
+
return markers?.first(where: { marker in
|
|
176
|
+
allowedReducedMotionMarkerNames.contains(marker.name.lowercased())
|
|
177
|
+
})
|
|
178
|
+
}
|
|
179
|
+
}
|