@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.
- 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 +6 -4
- 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,103 @@
|
|
|
1
|
+
// Created by Cal Stephens on 8/14/23.
|
|
2
|
+
// Copyright © 2023 Airbnb Inc. All rights reserved.
|
|
3
|
+
|
|
4
|
+
// MARK: - LayerEffectType
|
|
5
|
+
|
|
6
|
+
/// https://lottiefiles.github.io/lottie-docs/schema/#/$defs/effects
|
|
7
|
+
enum LayerEffectType: Int, Codable, Sendable {
|
|
8
|
+
case dropShadow = 25
|
|
9
|
+
case unknown = 9999
|
|
10
|
+
|
|
11
|
+
init(from decoder: Decoder) throws {
|
|
12
|
+
self = try LayerEffectType(rawValue: decoder.singleValueContainer().decode(RawValue.self)) ?? .unknown
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
// MARK: ClassFamily
|
|
17
|
+
|
|
18
|
+
extension LayerEffectType: ClassFamily {
|
|
19
|
+
static var discriminator = Discriminator.type
|
|
20
|
+
|
|
21
|
+
func getType() -> AnyObject.Type {
|
|
22
|
+
switch self {
|
|
23
|
+
case .dropShadow:
|
|
24
|
+
DropShadowEffect.self
|
|
25
|
+
case .unknown:
|
|
26
|
+
// Unsupported
|
|
27
|
+
LayerEffect.self
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// MARK: - LayerEffect
|
|
33
|
+
|
|
34
|
+
/// Base class for layer effects
|
|
35
|
+
class LayerEffect: Codable, DictionaryInitializable {
|
|
36
|
+
|
|
37
|
+
// MARK: Lifecycle
|
|
38
|
+
|
|
39
|
+
required init(from decoder: Decoder) throws {
|
|
40
|
+
let container = try decoder.container(keyedBy: LayerEffect.CodingKeys.self)
|
|
41
|
+
name = try container.decodeIfPresent(String.self, forKey: .name) ?? "Effect"
|
|
42
|
+
type = try container.decode(LayerEffectType.self, forKey: .type)
|
|
43
|
+
effects = try container.decodeIfPresent([EffectValue].self, ofFamily: EffectValueType.self, forKey: .effects) ?? []
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
required init(dictionary: [String: Any]) throws {
|
|
47
|
+
name = (try? dictionary.value(for: CodingKeys.name)) ?? "Layer"
|
|
48
|
+
type = LayerEffectType(rawValue: try dictionary.value(for: CodingKeys.type)) ?? .unknown
|
|
49
|
+
if let valueDictionaries = dictionary[CodingKeys.effects.rawValue] as? [[String: Any]] {
|
|
50
|
+
effects = try [EffectValue].fromDictionaries(valueDictionaries)
|
|
51
|
+
} else {
|
|
52
|
+
effects = []
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// MARK: Internal
|
|
57
|
+
|
|
58
|
+
/// The name of the effect
|
|
59
|
+
let name: String
|
|
60
|
+
|
|
61
|
+
/// The type of effect
|
|
62
|
+
let type: LayerEffectType
|
|
63
|
+
|
|
64
|
+
/// Values that configure the behavior of the effect
|
|
65
|
+
let effects: [EffectValue]
|
|
66
|
+
|
|
67
|
+
/// Retrieves the `EffectValue` for the given name
|
|
68
|
+
func value<ValueType: EffectValue>(named name: String) -> ValueType? {
|
|
69
|
+
effects.first(where: {
|
|
70
|
+
$0.name == name && $0 is ValueType
|
|
71
|
+
}) as? ValueType
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// MARK: Fileprivate
|
|
75
|
+
|
|
76
|
+
fileprivate enum CodingKeys: String, CodingKey {
|
|
77
|
+
case name = "nm"
|
|
78
|
+
case type = "ty"
|
|
79
|
+
case effects = "ef"
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
extension [LayerEffect] {
|
|
84
|
+
static func fromDictionaries(_ dictionaries: [[String: Any]]) throws -> [LayerEffect] {
|
|
85
|
+
try dictionaries.compactMap { dictionary in
|
|
86
|
+
let shapeType = dictionary[LayerEffect.CodingKeys.type.rawValue] as? Int
|
|
87
|
+
switch LayerEffectType(rawValue: shapeType ?? LayerEffectType.unknown.rawValue) {
|
|
88
|
+
case .dropShadow:
|
|
89
|
+
return try DropShadowEffect(dictionary: dictionary)
|
|
90
|
+
case .unknown, nil:
|
|
91
|
+
// Unsupported
|
|
92
|
+
return try LayerEffect(dictionary: dictionary)
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// MARK: - LayerEffect + @unchecked Sendable
|
|
99
|
+
|
|
100
|
+
/// Since `LayerEffect` isn't `final`, we have to use `@unchecked Sendable` instead of `Sendable.`
|
|
101
|
+
/// All `LayerEffect` subclasses are immutable `Sendable` values.
|
|
102
|
+
// swiftlint:disable:next no_unchecked_sendable
|
|
103
|
+
extension LayerEffect: @unchecked Sendable { }
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
// Created by Cal Stephens on 8/14/23.
|
|
2
|
+
// Copyright © 2023 Airbnb Inc. All rights reserved.
|
|
3
|
+
|
|
4
|
+
// MARK: - DropShadowStyle
|
|
5
|
+
|
|
6
|
+
final class DropShadowStyle: LayerStyle {
|
|
7
|
+
|
|
8
|
+
// MARK: Lifecycle
|
|
9
|
+
|
|
10
|
+
required init(from decoder: Decoder) throws {
|
|
11
|
+
let container = try decoder.container(keyedBy: DropShadowStyle.CodingKeys.self)
|
|
12
|
+
opacity = try container.decode(KeyframeGroup<LottieVector1D>.self, forKey: .opacity)
|
|
13
|
+
color = try container.decode(KeyframeGroup<LottieColor>.self, forKey: .color)
|
|
14
|
+
angle = try container.decode(KeyframeGroup<LottieVector1D>.self, forKey: .angle)
|
|
15
|
+
size = try container.decode(KeyframeGroup<LottieVector1D>.self, forKey: .size)
|
|
16
|
+
distance = try container.decode(KeyframeGroup<LottieVector1D>.self, forKey: .distance)
|
|
17
|
+
try super.init(from: decoder)
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
required init(dictionary: [String: Any]) throws {
|
|
21
|
+
let opacityDictionary: [String: Any] = try dictionary.value(for: CodingKeys.opacity)
|
|
22
|
+
opacity = try KeyframeGroup<LottieVector1D>(dictionary: opacityDictionary)
|
|
23
|
+
let colorDictionary: [String: Any] = try dictionary.value(for: CodingKeys.color)
|
|
24
|
+
color = try KeyframeGroup<LottieColor>(dictionary: colorDictionary)
|
|
25
|
+
let angleDictionary: [String: Any] = try dictionary.value(for: CodingKeys.angle)
|
|
26
|
+
angle = try KeyframeGroup<LottieVector1D>(dictionary: angleDictionary)
|
|
27
|
+
let sizeDictionary: [String: Any] = try dictionary.value(for: CodingKeys.size)
|
|
28
|
+
size = try KeyframeGroup<LottieVector1D>(dictionary: sizeDictionary)
|
|
29
|
+
let distanceDictionary: [String: Any] = try dictionary.value(for: CodingKeys.distance)
|
|
30
|
+
distance = try KeyframeGroup<LottieVector1D>(dictionary: distanceDictionary)
|
|
31
|
+
try super.init(dictionary: dictionary)
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// MARK: Internal
|
|
35
|
+
|
|
36
|
+
/// The opacity of the drop shadow
|
|
37
|
+
let opacity: KeyframeGroup<LottieVector1D>
|
|
38
|
+
|
|
39
|
+
/// The color of the drop shadow
|
|
40
|
+
let color: KeyframeGroup<LottieColor>
|
|
41
|
+
|
|
42
|
+
/// The angle of the drop shadow, in degrees,
|
|
43
|
+
/// with `0` representing a shadow straight-down from the layer
|
|
44
|
+
/// (`offsetY=distance, offsetX=0`).
|
|
45
|
+
let angle: KeyframeGroup<LottieVector1D>
|
|
46
|
+
|
|
47
|
+
/// The size of the drop shadow
|
|
48
|
+
let size: KeyframeGroup<LottieVector1D>
|
|
49
|
+
|
|
50
|
+
/// The distance of the drop shadow
|
|
51
|
+
let distance: KeyframeGroup<LottieVector1D>
|
|
52
|
+
|
|
53
|
+
override func encode(to encoder: Encoder) throws {
|
|
54
|
+
try super.encode(to: encoder)
|
|
55
|
+
var container = encoder.container(keyedBy: CodingKeys.self)
|
|
56
|
+
try container.encode(opacity, forKey: .opacity)
|
|
57
|
+
try container.encode(color, forKey: .color)
|
|
58
|
+
try container.encode(angle, forKey: .angle)
|
|
59
|
+
try container.encode(size, forKey: .size)
|
|
60
|
+
try container.encode(distance, forKey: .distance)
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// MARK: Private
|
|
64
|
+
|
|
65
|
+
private enum CodingKeys: String, CodingKey {
|
|
66
|
+
case color = "c"
|
|
67
|
+
case opacity = "o"
|
|
68
|
+
case angle = "a"
|
|
69
|
+
case size = "s"
|
|
70
|
+
case distance = "d"
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// MARK: @unchecked Sendable
|
|
75
|
+
|
|
76
|
+
/// `DropShadowStyle` inherits `@unchecked Sendable` from `LayerStyle` and
|
|
77
|
+
/// we need to restate that here to avoid a warning in Xcode 16
|
|
78
|
+
// swiftlint:disable:next no_unchecked_sendable
|
|
79
|
+
extension DropShadowStyle: @unchecked Sendable { }
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
// Created by Cal Stephens on 8/14/23.
|
|
2
|
+
// Copyright © 2023 Airbnb Inc. All rights reserved.
|
|
3
|
+
|
|
4
|
+
// MARK: - LayerStyleType
|
|
5
|
+
|
|
6
|
+
enum LayerStyleType: Int, Codable, Sendable {
|
|
7
|
+
case dropShadow = 1
|
|
8
|
+
case unknown = 9999
|
|
9
|
+
|
|
10
|
+
init(from decoder: Decoder) throws {
|
|
11
|
+
self = try LayerStyleType(rawValue: decoder.singleValueContainer().decode(RawValue.self)) ?? .unknown
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
// MARK: ClassFamily
|
|
16
|
+
|
|
17
|
+
extension LayerStyleType: ClassFamily {
|
|
18
|
+
static var discriminator = Discriminator.type
|
|
19
|
+
|
|
20
|
+
func getType() -> AnyObject.Type {
|
|
21
|
+
switch self {
|
|
22
|
+
case .dropShadow:
|
|
23
|
+
DropShadowStyle.self
|
|
24
|
+
case .unknown:
|
|
25
|
+
// Unsupported
|
|
26
|
+
LayerStyle.self
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// MARK: - LayerStyle
|
|
32
|
+
|
|
33
|
+
/// Base class for layer styles
|
|
34
|
+
class LayerStyle: Codable, DictionaryInitializable {
|
|
35
|
+
|
|
36
|
+
// MARK: Lifecycle
|
|
37
|
+
|
|
38
|
+
required init(from decoder: Decoder) throws {
|
|
39
|
+
let container = try decoder.container(keyedBy: LayerStyle.CodingKeys.self)
|
|
40
|
+
name = try container.decodeIfPresent(String.self, forKey: .name) ?? "Style"
|
|
41
|
+
type = try container.decode(LayerStyleType.self, forKey: .type)
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
required init(dictionary: [String: Any]) throws {
|
|
45
|
+
name = (try? dictionary.value(for: CodingKeys.name)) ?? "Layer"
|
|
46
|
+
type = LayerStyleType(rawValue: try dictionary.value(for: CodingKeys.type)) ?? .unknown
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// MARK: Internal
|
|
50
|
+
|
|
51
|
+
/// The name of the style
|
|
52
|
+
let name: String
|
|
53
|
+
|
|
54
|
+
/// The type of style
|
|
55
|
+
let type: LayerStyleType
|
|
56
|
+
|
|
57
|
+
// MARK: Fileprivate
|
|
58
|
+
|
|
59
|
+
fileprivate enum CodingKeys: String, CodingKey {
|
|
60
|
+
case name = "nm"
|
|
61
|
+
case type = "ty"
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
extension [LayerStyle] {
|
|
66
|
+
static func fromDictionaries(_ dictionaries: [[String: Any]]) throws -> [LayerStyle] {
|
|
67
|
+
try dictionaries.compactMap { dictionary in
|
|
68
|
+
let shapeType = dictionary[LayerStyle.CodingKeys.type.rawValue] as? Int
|
|
69
|
+
switch LayerStyleType(rawValue: shapeType ?? LayerStyleType.unknown.rawValue) {
|
|
70
|
+
case .dropShadow:
|
|
71
|
+
return try DropShadowStyle(dictionary: dictionary)
|
|
72
|
+
case .unknown, nil:
|
|
73
|
+
// Unsupported
|
|
74
|
+
return try LayerStyle(dictionary: dictionary)
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
// MARK: - LayerStyle + @unchecked Sendable
|
|
81
|
+
|
|
82
|
+
/// Since `LayerStyle` isn't `final`, we have to use `@unchecked Sendable` instead of `Sendable.`
|
|
83
|
+
/// All `LayerStyle` subclasses are immutable `Sendable` values.
|
|
84
|
+
// swiftlint:disable:next no_unchecked_sendable
|
|
85
|
+
extension LayerStyle: @unchecked Sendable { }
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
//
|
|
2
|
+
// ImageLayer.swift
|
|
3
|
+
// lottie-swift
|
|
4
|
+
//
|
|
5
|
+
// Created by Brandon Withrow on 1/8/19.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
// MARK: - ImageLayerModel
|
|
9
|
+
|
|
10
|
+
/// A layer that holds an image.
|
|
11
|
+
final class ImageLayerModel: LayerModel {
|
|
12
|
+
|
|
13
|
+
// MARK: Lifecycle
|
|
14
|
+
|
|
15
|
+
required init(from decoder: Decoder) throws {
|
|
16
|
+
let container = try decoder.container(keyedBy: ImageLayerModel.CodingKeys.self)
|
|
17
|
+
referenceID = try container.decode(String.self, forKey: .referenceID)
|
|
18
|
+
try super.init(from: decoder)
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
required init(dictionary: [String: Any]) throws {
|
|
22
|
+
referenceID = try dictionary.value(for: CodingKeys.referenceID)
|
|
23
|
+
try super.init(dictionary: dictionary)
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// MARK: Internal
|
|
27
|
+
|
|
28
|
+
/// The reference ID of the image.
|
|
29
|
+
let referenceID: String
|
|
30
|
+
|
|
31
|
+
override func encode(to encoder: Encoder) throws {
|
|
32
|
+
try super.encode(to: encoder)
|
|
33
|
+
var container = encoder.container(keyedBy: CodingKeys.self)
|
|
34
|
+
try container.encode(referenceID, forKey: .referenceID)
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// MARK: Private
|
|
38
|
+
|
|
39
|
+
private enum CodingKeys: String, CodingKey {
|
|
40
|
+
case referenceID = "refId"
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// MARK: @unchecked Sendable
|
|
45
|
+
|
|
46
|
+
/// `ImageLayerModel` inherits `@unchecked Sendable` from `LayerModel` and
|
|
47
|
+
/// we need to restate that here to avoid a warning in Xcode 16
|
|
48
|
+
// swiftlint:disable:next no_unchecked_sendable
|
|
49
|
+
extension ImageLayerModel: @unchecked Sendable { }
|
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Layer.swift
|
|
3
|
+
// lottie-swift
|
|
4
|
+
//
|
|
5
|
+
// Created by Brandon Withrow on 1/7/19.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
// MARK: - LayerType + ClassFamily
|
|
9
|
+
|
|
10
|
+
/// Used for mapping a heterogeneous list to classes for parsing.
|
|
11
|
+
extension LayerType: ClassFamily {
|
|
12
|
+
static var discriminator = Discriminator.type
|
|
13
|
+
|
|
14
|
+
func getType() -> AnyObject.Type {
|
|
15
|
+
switch self {
|
|
16
|
+
case .precomp:
|
|
17
|
+
PreCompLayerModel.self
|
|
18
|
+
case .solid:
|
|
19
|
+
SolidLayerModel.self
|
|
20
|
+
case .image:
|
|
21
|
+
ImageLayerModel.self
|
|
22
|
+
case .null:
|
|
23
|
+
LayerModel.self
|
|
24
|
+
case .shape:
|
|
25
|
+
ShapeLayerModel.self
|
|
26
|
+
case .text:
|
|
27
|
+
TextLayerModel.self
|
|
28
|
+
case .unknown:
|
|
29
|
+
LayerModel.self
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// MARK: - LayerType
|
|
35
|
+
|
|
36
|
+
public enum LayerType: Int, Codable {
|
|
37
|
+
case precomp
|
|
38
|
+
case solid
|
|
39
|
+
case image
|
|
40
|
+
case null
|
|
41
|
+
case shape
|
|
42
|
+
case text
|
|
43
|
+
case unknown
|
|
44
|
+
|
|
45
|
+
public init(from decoder: Decoder) throws {
|
|
46
|
+
self = try LayerType(rawValue: decoder.singleValueContainer().decode(RawValue.self)) ?? .null
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// MARK: - MatteType
|
|
51
|
+
|
|
52
|
+
public enum MatteType: Int, Codable {
|
|
53
|
+
case none
|
|
54
|
+
case add
|
|
55
|
+
case invert
|
|
56
|
+
case unknown
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// MARK: - BlendMode
|
|
60
|
+
|
|
61
|
+
public enum BlendMode: Int, Codable {
|
|
62
|
+
case normal
|
|
63
|
+
case multiply
|
|
64
|
+
case screen
|
|
65
|
+
case overlay
|
|
66
|
+
case darken
|
|
67
|
+
case lighten
|
|
68
|
+
case colorDodge
|
|
69
|
+
case colorBurn
|
|
70
|
+
case hardLight
|
|
71
|
+
case softLight
|
|
72
|
+
case difference
|
|
73
|
+
case exclusion
|
|
74
|
+
case hue
|
|
75
|
+
case saturation
|
|
76
|
+
case color
|
|
77
|
+
case luminosity
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
// MARK: - LayerModel
|
|
81
|
+
|
|
82
|
+
/// A base top container for shapes, images, and other view objects.
|
|
83
|
+
class LayerModel: Codable, DictionaryInitializable {
|
|
84
|
+
|
|
85
|
+
// MARK: Lifecycle
|
|
86
|
+
|
|
87
|
+
required init(from decoder: Decoder) throws {
|
|
88
|
+
let container = try decoder.container(keyedBy: LayerModel.CodingKeys.self)
|
|
89
|
+
name = try container.decodeIfPresent(String.self, forKey: .name) ?? "Layer"
|
|
90
|
+
index = try container.decodeIfPresent(Int.self, forKey: .index) ?? .random(in: Int.min...Int.max)
|
|
91
|
+
type = try container.decode(LayerType.self, forKey: .type)
|
|
92
|
+
coordinateSpace = try container.decodeIfPresent(CoordinateSpace.self, forKey: .coordinateSpace) ?? .type2d
|
|
93
|
+
inFrame = try container.decode(Double.self, forKey: .inFrame)
|
|
94
|
+
outFrame = try container.decode(Double.self, forKey: .outFrame)
|
|
95
|
+
startTime = try container.decode(Double.self, forKey: .startTime)
|
|
96
|
+
transform = try container.decodeIfPresent(Transform.self, forKey: .transform) ?? .default
|
|
97
|
+
parent = try container.decodeIfPresent(Int.self, forKey: .parent)
|
|
98
|
+
blendMode = try container.decodeIfPresent(BlendMode.self, forKey: .blendMode) ?? .normal
|
|
99
|
+
masks = try container.decodeIfPresent([Mask].self, forKey: .masks)
|
|
100
|
+
timeStretch = try container.decodeIfPresent(Double.self, forKey: .timeStretch) ?? 1
|
|
101
|
+
matte = try container.decodeIfPresent(MatteType.self, forKey: .matte)
|
|
102
|
+
hidden = try container.decodeIfPresent(Bool.self, forKey: .hidden) ?? false
|
|
103
|
+
styles = try container.decodeIfPresent([LayerStyle].self, ofFamily: LayerStyleType.self, forKey: .styles) ?? []
|
|
104
|
+
effects = try container.decodeIfPresent([LayerEffect].self, ofFamily: LayerEffectType.self, forKey: .effects) ?? []
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
required init(dictionary: [String: Any]) throws {
|
|
108
|
+
name = (try? dictionary.value(for: CodingKeys.name)) ?? "Layer"
|
|
109
|
+
index = try dictionary.value(for: CodingKeys.index) ?? .random(in: Int.min...Int.max)
|
|
110
|
+
type = LayerType(rawValue: try dictionary.value(for: CodingKeys.type)) ?? .null
|
|
111
|
+
if
|
|
112
|
+
let coordinateSpaceRawValue = dictionary[CodingKeys.coordinateSpace.rawValue] as? Int,
|
|
113
|
+
let coordinateSpace = CoordinateSpace(rawValue: coordinateSpaceRawValue)
|
|
114
|
+
{
|
|
115
|
+
self.coordinateSpace = coordinateSpace
|
|
116
|
+
} else {
|
|
117
|
+
coordinateSpace = .type2d
|
|
118
|
+
}
|
|
119
|
+
inFrame = try dictionary.value(for: CodingKeys.inFrame)
|
|
120
|
+
outFrame = try dictionary.value(for: CodingKeys.outFrame)
|
|
121
|
+
startTime = try dictionary.value(for: CodingKeys.startTime)
|
|
122
|
+
parent = try? dictionary.value(for: CodingKeys.parent)
|
|
123
|
+
if
|
|
124
|
+
let transformDictionary: [String: Any] = try dictionary.value(for: CodingKeys.transform),
|
|
125
|
+
let transform = try? Transform(dictionary: transformDictionary)
|
|
126
|
+
{
|
|
127
|
+
self.transform = transform
|
|
128
|
+
} else {
|
|
129
|
+
transform = .default
|
|
130
|
+
}
|
|
131
|
+
if
|
|
132
|
+
let blendModeRawValue = dictionary[CodingKeys.blendMode.rawValue] as? Int,
|
|
133
|
+
let blendMode = BlendMode(rawValue: blendModeRawValue)
|
|
134
|
+
{
|
|
135
|
+
self.blendMode = blendMode
|
|
136
|
+
} else {
|
|
137
|
+
blendMode = .normal
|
|
138
|
+
}
|
|
139
|
+
if let maskDictionaries = dictionary[CodingKeys.masks.rawValue] as? [[String: Any]] {
|
|
140
|
+
masks = try maskDictionaries.map { try Mask(dictionary: $0) }
|
|
141
|
+
} else {
|
|
142
|
+
masks = nil
|
|
143
|
+
}
|
|
144
|
+
timeStretch = (try? dictionary.value(for: CodingKeys.timeStretch)) ?? 1
|
|
145
|
+
if let matteRawValue = dictionary[CodingKeys.matte.rawValue] as? Int {
|
|
146
|
+
matte = MatteType(rawValue: matteRawValue)
|
|
147
|
+
} else {
|
|
148
|
+
matte = nil
|
|
149
|
+
}
|
|
150
|
+
hidden = (try? dictionary.value(for: CodingKeys.hidden)) ?? false
|
|
151
|
+
if let styleDictionaries = dictionary[CodingKeys.styles.rawValue] as? [[String: Any]] {
|
|
152
|
+
styles = try [LayerStyle].fromDictionaries(styleDictionaries)
|
|
153
|
+
} else {
|
|
154
|
+
styles = []
|
|
155
|
+
}
|
|
156
|
+
if let effectDictionaries = dictionary[CodingKeys.effects.rawValue] as? [[String: Any]] {
|
|
157
|
+
effects = try [LayerEffect].fromDictionaries(effectDictionaries)
|
|
158
|
+
} else {
|
|
159
|
+
effects = []
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
// MARK: Internal
|
|
164
|
+
|
|
165
|
+
/// The readable name of the layer
|
|
166
|
+
let name: String
|
|
167
|
+
|
|
168
|
+
/// The index of the layer
|
|
169
|
+
let index: Int
|
|
170
|
+
|
|
171
|
+
/// The type of the layer.
|
|
172
|
+
let type: LayerType
|
|
173
|
+
|
|
174
|
+
/// The coordinate space
|
|
175
|
+
let coordinateSpace: CoordinateSpace
|
|
176
|
+
|
|
177
|
+
/// The in time of the layer in frames.
|
|
178
|
+
let inFrame: Double
|
|
179
|
+
/// The out time of the layer in frames.
|
|
180
|
+
let outFrame: Double
|
|
181
|
+
|
|
182
|
+
/// The start time of the layer in frames.
|
|
183
|
+
let startTime: Double
|
|
184
|
+
|
|
185
|
+
/// The transform of the layer
|
|
186
|
+
let transform: Transform
|
|
187
|
+
|
|
188
|
+
/// The index of the parent layer, if applicable.
|
|
189
|
+
let parent: Int?
|
|
190
|
+
|
|
191
|
+
/// The blending mode for the layer
|
|
192
|
+
let blendMode: BlendMode
|
|
193
|
+
|
|
194
|
+
/// An array of masks for the layer.
|
|
195
|
+
let masks: [Mask]?
|
|
196
|
+
|
|
197
|
+
/// A number that stretches time by a multiplier
|
|
198
|
+
let timeStretch: Double
|
|
199
|
+
|
|
200
|
+
/// The type of matte if any.
|
|
201
|
+
let matte: MatteType?
|
|
202
|
+
|
|
203
|
+
/// Whether or not this layer is hidden, in which case it will not be rendered.
|
|
204
|
+
let hidden: Bool
|
|
205
|
+
|
|
206
|
+
/// A list of styles to apply to this layer
|
|
207
|
+
let styles: [LayerStyle]
|
|
208
|
+
|
|
209
|
+
/// A list of effects to apply to this layer
|
|
210
|
+
let effects: [LayerEffect]
|
|
211
|
+
|
|
212
|
+
// MARK: Fileprivate
|
|
213
|
+
|
|
214
|
+
fileprivate enum CodingKeys: String, CodingKey {
|
|
215
|
+
case name = "nm"
|
|
216
|
+
case index = "ind"
|
|
217
|
+
case type = "ty"
|
|
218
|
+
case coordinateSpace = "ddd"
|
|
219
|
+
case inFrame = "ip"
|
|
220
|
+
case outFrame = "op"
|
|
221
|
+
case startTime = "st"
|
|
222
|
+
case transform = "ks"
|
|
223
|
+
case parent
|
|
224
|
+
case blendMode = "bm"
|
|
225
|
+
case masks = "masksProperties"
|
|
226
|
+
case timeStretch = "sr"
|
|
227
|
+
case matte = "tt"
|
|
228
|
+
case hidden = "hd"
|
|
229
|
+
case styles = "sy"
|
|
230
|
+
case effects = "ef"
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
extension [LayerModel] {
|
|
235
|
+
|
|
236
|
+
static func fromDictionaries(_ dictionaries: [[String: Any]]) throws -> [LayerModel] {
|
|
237
|
+
try dictionaries.compactMap { dictionary in
|
|
238
|
+
let layerType = dictionary[LayerModel.CodingKeys.type.rawValue] as? Int
|
|
239
|
+
switch LayerType(rawValue: layerType ?? LayerType.null.rawValue) {
|
|
240
|
+
case .precomp:
|
|
241
|
+
return try PreCompLayerModel(dictionary: dictionary)
|
|
242
|
+
case .solid:
|
|
243
|
+
return try SolidLayerModel(dictionary: dictionary)
|
|
244
|
+
case .image:
|
|
245
|
+
return try ImageLayerModel(dictionary: dictionary)
|
|
246
|
+
case .null:
|
|
247
|
+
return try LayerModel(dictionary: dictionary)
|
|
248
|
+
case .shape:
|
|
249
|
+
return try ShapeLayerModel(dictionary: dictionary)
|
|
250
|
+
case .text:
|
|
251
|
+
return try TextLayerModel(dictionary: dictionary)
|
|
252
|
+
case .unknown:
|
|
253
|
+
return try LayerModel(dictionary: dictionary)
|
|
254
|
+
case .none:
|
|
255
|
+
return nil
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
// MARK: - LayerModel + @unchecked Sendable
|
|
262
|
+
|
|
263
|
+
/// Since `LayerModel` isn't `final`, we have to use `@unchecked Sendable` instead of `Sendable.`
|
|
264
|
+
/// All `LayerModel` subclasses are immutable `Sendable` values.
|
|
265
|
+
// swiftlint:disable:next no_unchecked_sendable
|
|
266
|
+
extension LayerModel: @unchecked Sendable { }
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
//
|
|
2
|
+
// PreCompLayer.swift
|
|
3
|
+
// lottie-swift
|
|
4
|
+
//
|
|
5
|
+
// Created by Brandon Withrow on 1/8/19.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
// MARK: - PreCompLayerModel
|
|
9
|
+
|
|
10
|
+
/// A layer that holds another animation composition.
|
|
11
|
+
final class PreCompLayerModel: LayerModel {
|
|
12
|
+
|
|
13
|
+
// MARK: Lifecycle
|
|
14
|
+
|
|
15
|
+
required init(from decoder: Decoder) throws {
|
|
16
|
+
let container = try decoder.container(keyedBy: PreCompLayerModel.CodingKeys.self)
|
|
17
|
+
referenceID = try container.decode(String.self, forKey: .referenceID)
|
|
18
|
+
timeRemapping = try container.decodeIfPresent(KeyframeGroup<LottieVector1D>.self, forKey: .timeRemapping)
|
|
19
|
+
width = try container.decode(Double.self, forKey: .width)
|
|
20
|
+
height = try container.decode(Double.self, forKey: .height)
|
|
21
|
+
try super.init(from: decoder)
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
required init(dictionary: [String: Any]) throws {
|
|
25
|
+
referenceID = try dictionary.value(for: CodingKeys.referenceID)
|
|
26
|
+
if let timeRemappingDictionary = dictionary[CodingKeys.timeRemapping.rawValue] as? [String: Any] {
|
|
27
|
+
timeRemapping = try KeyframeGroup<LottieVector1D>(dictionary: timeRemappingDictionary)
|
|
28
|
+
} else {
|
|
29
|
+
timeRemapping = nil
|
|
30
|
+
}
|
|
31
|
+
width = try dictionary.value(for: CodingKeys.width)
|
|
32
|
+
height = try dictionary.value(for: CodingKeys.height)
|
|
33
|
+
try super.init(dictionary: dictionary)
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// MARK: Internal
|
|
37
|
+
|
|
38
|
+
/// The reference ID of the precomp.
|
|
39
|
+
let referenceID: String
|
|
40
|
+
|
|
41
|
+
/// A value that remaps time over time.
|
|
42
|
+
let timeRemapping: KeyframeGroup<LottieVector1D>?
|
|
43
|
+
|
|
44
|
+
/// Precomp Width
|
|
45
|
+
let width: Double
|
|
46
|
+
|
|
47
|
+
/// Precomp Height
|
|
48
|
+
let height: Double
|
|
49
|
+
|
|
50
|
+
override func encode(to encoder: Encoder) throws {
|
|
51
|
+
try super.encode(to: encoder)
|
|
52
|
+
var container = encoder.container(keyedBy: CodingKeys.self)
|
|
53
|
+
try container.encode(referenceID, forKey: .referenceID)
|
|
54
|
+
try container.encode(timeRemapping, forKey: .timeRemapping)
|
|
55
|
+
try container.encode(width, forKey: .width)
|
|
56
|
+
try container.encode(height, forKey: .height)
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// MARK: Private
|
|
60
|
+
|
|
61
|
+
private enum CodingKeys: String, CodingKey {
|
|
62
|
+
case referenceID = "refId"
|
|
63
|
+
case timeRemapping = "tm"
|
|
64
|
+
case width = "w"
|
|
65
|
+
case height = "h"
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// MARK: @unchecked Sendable
|
|
70
|
+
|
|
71
|
+
/// `PreCompLayerModel` inherits `@unchecked Sendable` from `LayerModel` and
|
|
72
|
+
/// we need to restate that here to avoid a warning in Xcode 16
|
|
73
|
+
// swiftlint:disable:next no_unchecked_sendable
|
|
74
|
+
extension PreCompLayerModel: @unchecked Sendable { }
|