@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
package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/DropShadowAnimation.swift
ADDED
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
// Created by Cal Stephens on 8/15/23.
|
|
2
|
+
// Copyright © 2023 Airbnb Inc. All rights reserved.
|
|
3
|
+
|
|
4
|
+
import QuartzCore
|
|
5
|
+
|
|
6
|
+
// MARK: - DropShadowModel
|
|
7
|
+
|
|
8
|
+
protocol DropShadowModel {
|
|
9
|
+
/// The opacity of the drop shadow, from 0 to 100.
|
|
10
|
+
var _opacity: KeyframeGroup<LottieVector1D>? { get }
|
|
11
|
+
|
|
12
|
+
/// The shadow radius of the blur
|
|
13
|
+
var _radius: KeyframeGroup<LottieVector1D>? { get }
|
|
14
|
+
|
|
15
|
+
/// The color of the drop shadow
|
|
16
|
+
var _color: KeyframeGroup<LottieColor>? { get }
|
|
17
|
+
|
|
18
|
+
/// The angle of the drop shadow, in degrees,
|
|
19
|
+
/// with "90" resulting in a shadow directly beneath the layer.
|
|
20
|
+
/// Combines with the `distance` to form the `shadowOffset`.
|
|
21
|
+
var _angle: KeyframeGroup<LottieVector1D>? { get }
|
|
22
|
+
|
|
23
|
+
/// The distance of the drop shadow offset.
|
|
24
|
+
/// Combines with the `angle` to form the `shadowOffset`.
|
|
25
|
+
var _distance: KeyframeGroup<LottieVector1D>? { get }
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// MARK: - DropShadowStyle + DropShadowModel
|
|
29
|
+
|
|
30
|
+
extension DropShadowStyle: DropShadowModel {
|
|
31
|
+
var _opacity: KeyframeGroup<LottieVector1D>? {
|
|
32
|
+
opacity
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
var _color: KeyframeGroup<LottieColor>? {
|
|
36
|
+
color
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
var _angle: KeyframeGroup<LottieVector1D>? {
|
|
40
|
+
angle
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
var _distance: KeyframeGroup<LottieVector1D>? {
|
|
44
|
+
distance
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
var _radius: KeyframeGroup<LottieVector1D>? {
|
|
48
|
+
size.map { sizeValue in
|
|
49
|
+
// After Effects shadow softness uses a different range of values than CALayer.shadowRadius,
|
|
50
|
+
// so shadows render too softly if we directly use the value from After Effects. We find that
|
|
51
|
+
// dividing this value from After Effects by 2 produces results that are visually similar.
|
|
52
|
+
LottieVector1D(sizeValue.cgFloatValue / 2)
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// MARK: - DropShadowEffect + DropShadowModel
|
|
58
|
+
|
|
59
|
+
extension DropShadowEffect: DropShadowModel {
|
|
60
|
+
var _color: KeyframeGroup<LottieColor>? {
|
|
61
|
+
color?.value
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
var _distance: KeyframeGroup<LottieVector1D>? {
|
|
65
|
+
distance?.value
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
var _radius: KeyframeGroup<LottieVector1D>? {
|
|
69
|
+
softness?.value?.map { softnessValue in
|
|
70
|
+
// After Effects shadow softness uses a different range of values than CALayer.shadowRadius,
|
|
71
|
+
// so shadows render too softly if we directly use the value from After Effects. We find that
|
|
72
|
+
// dividing this value from After Effects by 5 produces results that are visually similar.
|
|
73
|
+
LottieVector1D(softnessValue.cgFloatValue / 5)
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
var _opacity: KeyframeGroup<LottieVector1D>? {
|
|
78
|
+
opacity?.value?.map { originalOpacityValue in
|
|
79
|
+
// `DropShadowEffect.opacity` is a value between 0 and 255,
|
|
80
|
+
// but `DropShadowModel._opacity` expects a value between 0 and 100.
|
|
81
|
+
LottieVector1D((originalOpacityValue.value / 255.0) * 100)
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
var _angle: KeyframeGroup<LottieVector1D>? {
|
|
86
|
+
direction?.value?.map { originalAngleValue in
|
|
87
|
+
// `DropShadowEffect.distance` is rotated 90º from the
|
|
88
|
+
// angle value representation expected by `DropShadowModel._angle`
|
|
89
|
+
LottieVector1D(originalAngleValue.value - 90)
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
// MARK: - CALayer + DropShadowModel
|
|
95
|
+
|
|
96
|
+
extension CALayer {
|
|
97
|
+
|
|
98
|
+
// MARK: Internal
|
|
99
|
+
|
|
100
|
+
/// Adds drop shadow animations from the given `DropShadowModel` to this layer
|
|
101
|
+
@nonobjc
|
|
102
|
+
func addDropShadowAnimations(
|
|
103
|
+
for dropShadowModel: DropShadowModel,
|
|
104
|
+
context: LayerAnimationContext
|
|
105
|
+
) throws {
|
|
106
|
+
try addShadowOpacityAnimation(from: dropShadowModel, context: context)
|
|
107
|
+
try addShadowColorAnimation(from: dropShadowModel, context: context)
|
|
108
|
+
try addShadowRadiusAnimation(from: dropShadowModel, context: context)
|
|
109
|
+
try addShadowOffsetAnimation(from: dropShadowModel, context: context)
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
// MARK: Private
|
|
113
|
+
|
|
114
|
+
private func addShadowOpacityAnimation(from model: DropShadowModel, context: LayerAnimationContext) throws {
|
|
115
|
+
guard let opacityKeyframes = model._opacity else { return }
|
|
116
|
+
|
|
117
|
+
try addAnimation(
|
|
118
|
+
for: .shadowOpacity,
|
|
119
|
+
keyframes: opacityKeyframes,
|
|
120
|
+
value: {
|
|
121
|
+
// Lottie animation files express opacity as a numerical percentage value
|
|
122
|
+
// (e.g. 0%, 50%, 100%) so we divide by 100 to get the decimal values
|
|
123
|
+
// expected by Core Animation (e.g. 0.0, 0.5, 1.0).
|
|
124
|
+
$0.cgFloatValue / 100
|
|
125
|
+
},
|
|
126
|
+
context: context
|
|
127
|
+
)
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
private func addShadowColorAnimation(from model: DropShadowModel, context: LayerAnimationContext) throws {
|
|
131
|
+
guard let shadowColorKeyframes = model._color else { return }
|
|
132
|
+
|
|
133
|
+
try addAnimation(
|
|
134
|
+
for: .shadowColor,
|
|
135
|
+
keyframes: shadowColorKeyframes,
|
|
136
|
+
value: \.cgColorValue,
|
|
137
|
+
context: context
|
|
138
|
+
)
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
private func addShadowRadiusAnimation(from model: DropShadowModel, context: LayerAnimationContext) throws {
|
|
142
|
+
guard let shadowSizeKeyframes = model._radius else { return }
|
|
143
|
+
|
|
144
|
+
try addAnimation(
|
|
145
|
+
for: .shadowRadius,
|
|
146
|
+
keyframes: shadowSizeKeyframes,
|
|
147
|
+
value: \.cgFloatValue,
|
|
148
|
+
context: context
|
|
149
|
+
)
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
private func addShadowOffsetAnimation(from model: DropShadowModel, context: LayerAnimationContext) throws {
|
|
153
|
+
guard
|
|
154
|
+
let angleKeyframes = model._angle,
|
|
155
|
+
let distanceKeyframes = model._distance
|
|
156
|
+
else { return }
|
|
157
|
+
|
|
158
|
+
let offsetKeyframes = Keyframes.combined(angleKeyframes, distanceKeyframes) { angleDegrees, distance -> CGSize in
|
|
159
|
+
// Lottie animation files express rotation in degrees
|
|
160
|
+
// (e.g. 90º, 180º, 360º) so we convert to radians to get the
|
|
161
|
+
// values expected by Core Animation (e.g. π/2, π, 2π)
|
|
162
|
+
let angleRadians = (angleDegrees.cgFloatValue * .pi) / 180
|
|
163
|
+
|
|
164
|
+
// Lottie animation files express the `shadowOffset` as (angle, distance) pair,
|
|
165
|
+
// which we convert to the expected x / y offset values:
|
|
166
|
+
let offsetX = distance.cgFloatValue * cos(angleRadians)
|
|
167
|
+
let offsetY = distance.cgFloatValue * sin(angleRadians)
|
|
168
|
+
return CGSize(width: offsetX, height: offsetY)
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
try addAnimation(
|
|
172
|
+
for: .shadowOffset,
|
|
173
|
+
keyframes: offsetKeyframes,
|
|
174
|
+
value: { $0 },
|
|
175
|
+
context: context
|
|
176
|
+
)
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
}
|
package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/EllipseAnimation.swift
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
// Created by Cal Stephens on 12/21/21.
|
|
2
|
+
// Copyright © 2021 Airbnb Inc. All rights reserved.
|
|
3
|
+
|
|
4
|
+
import QuartzCore
|
|
5
|
+
|
|
6
|
+
extension CAShapeLayer {
|
|
7
|
+
/// Adds animations for the given `Ellipse` to this `CALayer`
|
|
8
|
+
@nonobjc
|
|
9
|
+
func addAnimations(
|
|
10
|
+
for ellipse: Ellipse,
|
|
11
|
+
context: LayerAnimationContext,
|
|
12
|
+
pathMultiplier: PathMultiplier
|
|
13
|
+
) throws {
|
|
14
|
+
try addAnimation(
|
|
15
|
+
for: .path,
|
|
16
|
+
keyframes: ellipse.combinedKeyframes(),
|
|
17
|
+
value: { keyframe in
|
|
18
|
+
BezierPath.ellipse(
|
|
19
|
+
size: keyframe.size.sizeValue,
|
|
20
|
+
center: keyframe.position.pointValue,
|
|
21
|
+
direction: ellipse.direction
|
|
22
|
+
)
|
|
23
|
+
.cgPath()
|
|
24
|
+
.duplicated(times: pathMultiplier)
|
|
25
|
+
},
|
|
26
|
+
context: context
|
|
27
|
+
)
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
extension Ellipse {
|
|
32
|
+
/// Data that represents how to render an ellipse at a specific point in time
|
|
33
|
+
struct Keyframe: Interpolatable {
|
|
34
|
+
let size: LottieVector3D
|
|
35
|
+
let position: LottieVector3D
|
|
36
|
+
|
|
37
|
+
func interpolate(to: Ellipse.Keyframe, amount: CGFloat) -> Ellipse.Keyframe {
|
|
38
|
+
Keyframe(
|
|
39
|
+
size: size.interpolate(to: to.size, amount: amount),
|
|
40
|
+
position: position.interpolate(to: to.position, amount: amount)
|
|
41
|
+
)
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/// Creates a single array of animatable keyframes from the separate arrays of keyframes in this Ellipse
|
|
46
|
+
func combinedKeyframes() throws -> KeyframeGroup<Ellipse.Keyframe> {
|
|
47
|
+
Keyframes.combined(
|
|
48
|
+
size,
|
|
49
|
+
position,
|
|
50
|
+
makeCombinedResult: Ellipse.Keyframe.init
|
|
51
|
+
)
|
|
52
|
+
}
|
|
53
|
+
}
|
package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/GradientAnimations.swift
ADDED
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
// Created by Cal Stephens on 1/7/22.
|
|
2
|
+
// Copyright © 2022 Airbnb Inc. All rights reserved.
|
|
3
|
+
|
|
4
|
+
import QuartzCore
|
|
5
|
+
|
|
6
|
+
// MARK: - GradientShapeItem
|
|
7
|
+
|
|
8
|
+
/// A `ShapeItem` that represents a gradient
|
|
9
|
+
protocol GradientShapeItem: OpacityAnimationModel {
|
|
10
|
+
var startPoint: KeyframeGroup<LottieVector3D> { get }
|
|
11
|
+
var endPoint: KeyframeGroup<LottieVector3D> { get }
|
|
12
|
+
var gradientType: GradientType { get }
|
|
13
|
+
var numberOfColors: Int { get }
|
|
14
|
+
var colors: KeyframeGroup<[Double]> { get }
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
// MARK: - GradientFill + GradientShapeItem
|
|
18
|
+
|
|
19
|
+
extension GradientFill: GradientShapeItem { }
|
|
20
|
+
|
|
21
|
+
// MARK: - GradientStroke + GradientShapeItem
|
|
22
|
+
|
|
23
|
+
extension GradientStroke: GradientShapeItem { }
|
|
24
|
+
|
|
25
|
+
// MARK: - GradientRenderLayer + GradientShapeItem
|
|
26
|
+
|
|
27
|
+
extension GradientRenderLayer {
|
|
28
|
+
|
|
29
|
+
// MARK: Internal
|
|
30
|
+
|
|
31
|
+
/// Adds gradient-related animations to this layer, from the given `GradientFill`
|
|
32
|
+
/// - The RGB components and alpha components can have different color stops / locations,
|
|
33
|
+
/// so have to be rendered in separate `CAGradientLayer`s.
|
|
34
|
+
func addGradientAnimations(
|
|
35
|
+
for gradient: GradientShapeItem,
|
|
36
|
+
type: GradientContentType,
|
|
37
|
+
context: LayerAnimationContext
|
|
38
|
+
) throws {
|
|
39
|
+
// We have to set `colors` and `locations` to non-nil values
|
|
40
|
+
// for the animations below to actually take effect
|
|
41
|
+
locations = []
|
|
42
|
+
|
|
43
|
+
// The initial value for `colors` must be an array with the exact same number of colors
|
|
44
|
+
// as the gradient that will be applied in the `CAAnimation`
|
|
45
|
+
switch type {
|
|
46
|
+
case .rgb:
|
|
47
|
+
colors = .init(
|
|
48
|
+
repeating: CGColor.rgb(0, 0, 0),
|
|
49
|
+
count: try gradientColorsCount(
|
|
50
|
+
in: context,
|
|
51
|
+
gradient: gradient
|
|
52
|
+
)
|
|
53
|
+
)
|
|
54
|
+
|
|
55
|
+
case .alpha:
|
|
56
|
+
colors = .init(
|
|
57
|
+
repeating: CGColor.rgb(0, 0, 0),
|
|
58
|
+
count: gradient.colorConfiguration(from: gradient.colors.keyframes[0].value, type: .alpha).count
|
|
59
|
+
)
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
try addAnimation(
|
|
63
|
+
for: .colors,
|
|
64
|
+
keyframes: gradient.colors,
|
|
65
|
+
value: { colorComponents in
|
|
66
|
+
gradient.colorConfiguration(from: colorComponents, type: type).map { $0.color }
|
|
67
|
+
},
|
|
68
|
+
context: context
|
|
69
|
+
)
|
|
70
|
+
|
|
71
|
+
try addAnimation(
|
|
72
|
+
for: .locations,
|
|
73
|
+
keyframes: gradient.colors,
|
|
74
|
+
value: { colorComponents in
|
|
75
|
+
gradient.colorConfiguration(from: colorComponents, type: type).map { $0.location }
|
|
76
|
+
},
|
|
77
|
+
context: context
|
|
78
|
+
)
|
|
79
|
+
|
|
80
|
+
try addOpacityAnimation(for: gradient, context: context)
|
|
81
|
+
|
|
82
|
+
switch gradient.gradientType {
|
|
83
|
+
case .linear:
|
|
84
|
+
try addLinearGradientAnimations(for: gradient, context: context)
|
|
85
|
+
case .radial:
|
|
86
|
+
try addRadialGradientAnimations(for: gradient, context: context)
|
|
87
|
+
case .none:
|
|
88
|
+
break
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// MARK: Private
|
|
93
|
+
|
|
94
|
+
private func addLinearGradientAnimations(
|
|
95
|
+
for gradient: GradientShapeItem,
|
|
96
|
+
context: LayerAnimationContext
|
|
97
|
+
) throws {
|
|
98
|
+
type = .axial
|
|
99
|
+
|
|
100
|
+
try addAnimation(
|
|
101
|
+
for: .startPoint,
|
|
102
|
+
keyframes: gradient.startPoint,
|
|
103
|
+
value: { absoluteStartPoint in
|
|
104
|
+
percentBasedPointInBounds(from: absoluteStartPoint.pointValue)
|
|
105
|
+
},
|
|
106
|
+
context: context
|
|
107
|
+
)
|
|
108
|
+
|
|
109
|
+
try addAnimation(
|
|
110
|
+
for: .endPoint,
|
|
111
|
+
keyframes: gradient.endPoint,
|
|
112
|
+
value: { absoluteEndPoint in
|
|
113
|
+
percentBasedPointInBounds(from: absoluteEndPoint.pointValue)
|
|
114
|
+
},
|
|
115
|
+
context: context
|
|
116
|
+
)
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
private func addRadialGradientAnimations(for gradient: GradientShapeItem, context: LayerAnimationContext) throws {
|
|
120
|
+
type = .radial
|
|
121
|
+
|
|
122
|
+
let combinedKeyframes = Keyframes.combined(
|
|
123
|
+
gradient.startPoint,
|
|
124
|
+
gradient.endPoint,
|
|
125
|
+
makeCombinedResult: { absoluteStartPoint, absoluteEndPoint -> RadialGradientKeyframes in
|
|
126
|
+
// Convert the absolute start / end points to the relative structure used by Core Animation
|
|
127
|
+
let relativeStartPoint = percentBasedPointInBounds(from: absoluteStartPoint.pointValue)
|
|
128
|
+
let radius = absoluteStartPoint.pointValue.distanceTo(absoluteEndPoint.pointValue)
|
|
129
|
+
let relativeEndPoint = percentBasedPointInBounds(
|
|
130
|
+
from: CGPoint(
|
|
131
|
+
x: absoluteStartPoint.x + radius,
|
|
132
|
+
y: absoluteStartPoint.y + radius
|
|
133
|
+
)
|
|
134
|
+
)
|
|
135
|
+
|
|
136
|
+
return RadialGradientKeyframes(startPoint: relativeStartPoint, endPoint: relativeEndPoint)
|
|
137
|
+
}
|
|
138
|
+
)
|
|
139
|
+
|
|
140
|
+
try addAnimation(
|
|
141
|
+
for: .startPoint,
|
|
142
|
+
keyframes: combinedKeyframes,
|
|
143
|
+
value: \.startPoint,
|
|
144
|
+
context: context
|
|
145
|
+
)
|
|
146
|
+
|
|
147
|
+
try addAnimation(
|
|
148
|
+
for: .endPoint,
|
|
149
|
+
keyframes: combinedKeyframes,
|
|
150
|
+
value: \.endPoint,
|
|
151
|
+
context: context
|
|
152
|
+
)
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/// Core Animation ignores the gradient animation when the number of provided colors
|
|
156
|
+
/// does not match the expected count. For example, if the `colors` array is initialized
|
|
157
|
+
/// from a JSON value containing 3 colors, but a value provider supplies only 2 colors,
|
|
158
|
+
/// the animation will be ignored. To avoid this, always ensure the `CAGradientLayer`
|
|
159
|
+
/// color count matches the input colors, whether defined in the JSON or supplied via
|
|
160
|
+
/// a value provider.
|
|
161
|
+
private func gradientColorsCount(
|
|
162
|
+
in context: LayerAnimationContext,
|
|
163
|
+
gradient: GradientShapeItem
|
|
164
|
+
) throws -> Int {
|
|
165
|
+
let colorsProperty = LayerProperty<[CGColor]>.colors.customizableProperty
|
|
166
|
+
|
|
167
|
+
guard
|
|
168
|
+
let colorsProperty,
|
|
169
|
+
let customKeyframes = try context.valueProviderStore.customKeyframes(
|
|
170
|
+
of: colorsProperty,
|
|
171
|
+
for: AnimationKeypath(
|
|
172
|
+
keys: context.currentKeypath.keys + colorsProperty.name.map { $0.rawValue }
|
|
173
|
+
),
|
|
174
|
+
context: context
|
|
175
|
+
)
|
|
176
|
+
else {
|
|
177
|
+
return gradient.numberOfColors
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
return customKeyframes.keyframes[0].value.count
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
// MARK: - RadialGradientKeyframes
|
|
185
|
+
|
|
186
|
+
private struct RadialGradientKeyframes: Interpolatable {
|
|
187
|
+
let startPoint: CGPoint
|
|
188
|
+
let endPoint: CGPoint
|
|
189
|
+
|
|
190
|
+
func interpolate(to: RadialGradientKeyframes, amount: CGFloat) -> RadialGradientKeyframes {
|
|
191
|
+
RadialGradientKeyframes(
|
|
192
|
+
startPoint: startPoint.interpolate(to: to.startPoint, amount: amount),
|
|
193
|
+
endPoint: endPoint.interpolate(to: to.endPoint, amount: amount)
|
|
194
|
+
)
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
// MARK: - GradientContentType
|
|
199
|
+
|
|
200
|
+
/// Each type of gradient that can be constructed from a `GradientShapeItem`
|
|
201
|
+
enum GradientContentType {
|
|
202
|
+
case rgb
|
|
203
|
+
case alpha
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
/// `colors` and `locations` configuration for a `CAGradientLayer`
|
|
207
|
+
typealias GradientColorConfiguration = [(color: CGColor, location: CGFloat)]
|
|
208
|
+
|
|
209
|
+
extension GradientShapeItem {
|
|
210
|
+
|
|
211
|
+
// MARK: Internal
|
|
212
|
+
|
|
213
|
+
/// Whether or not this `GradientShapeItem` includes an alpha component
|
|
214
|
+
/// that has to be rendered as a separate `CAGradientLayer` from the
|
|
215
|
+
/// layer that renders the rgb color components
|
|
216
|
+
var hasAlphaComponent: Bool {
|
|
217
|
+
for colorComponentsKeyframe in colors.keyframes {
|
|
218
|
+
let colorComponents = colorComponentsKeyframe.value
|
|
219
|
+
let alphaConfiguration = colorConfiguration(from: colorComponents, type: .alpha)
|
|
220
|
+
|
|
221
|
+
let notFullyOpaque = alphaConfiguration.contains(where: { color, _ in
|
|
222
|
+
color.alpha < 0.999
|
|
223
|
+
})
|
|
224
|
+
|
|
225
|
+
if notFullyOpaque {
|
|
226
|
+
return true
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
return false
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
// MARK: Fileprivate
|
|
234
|
+
|
|
235
|
+
/// Converts the compact `[Double]` color components representation
|
|
236
|
+
/// into an array of `CGColor`s and the location of those colors within the gradient.
|
|
237
|
+
/// - The color components array is a repeating list of `[location, red, green, blue]` values
|
|
238
|
+
/// for each color in the gradient, followed by an optional repeating list of
|
|
239
|
+
/// `[location, alpha]` values that control the colors' alpha values.
|
|
240
|
+
/// - The RGB and alpha values can have different color stops / locations,
|
|
241
|
+
/// so each has to be rendered in a separate `CAGradientLayer`.
|
|
242
|
+
fileprivate func colorConfiguration(
|
|
243
|
+
from colorComponents: [Double],
|
|
244
|
+
type: GradientContentType
|
|
245
|
+
) -> GradientColorConfiguration {
|
|
246
|
+
switch type {
|
|
247
|
+
case .rgb:
|
|
248
|
+
precondition(
|
|
249
|
+
colorComponents.count >= numberOfColors * 4,
|
|
250
|
+
"Each color must have RGB components and a location component"
|
|
251
|
+
)
|
|
252
|
+
|
|
253
|
+
// Each group of four `Double` values represents a single `CGColor`,
|
|
254
|
+
// and its relative location within the gradient.
|
|
255
|
+
var colors = GradientColorConfiguration()
|
|
256
|
+
|
|
257
|
+
for colorIndex in 0 ..< numberOfColors {
|
|
258
|
+
let colorStartIndex = colorIndex * 4
|
|
259
|
+
|
|
260
|
+
let colorLocation = CGFloat(colorComponents[colorStartIndex])
|
|
261
|
+
|
|
262
|
+
let color = CGColor.rgb(
|
|
263
|
+
CGFloat(colorComponents[colorStartIndex + 1]),
|
|
264
|
+
CGFloat(colorComponents[colorStartIndex + 2]),
|
|
265
|
+
CGFloat(colorComponents[colorStartIndex + 3])
|
|
266
|
+
)
|
|
267
|
+
|
|
268
|
+
colors.append((color: color, location: colorLocation))
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
return colors
|
|
272
|
+
|
|
273
|
+
case .alpha:
|
|
274
|
+
// After the rgb color components, there can be arbitrary number of repeating
|
|
275
|
+
// `[alphaLocation, alphaValue]` pairs that define a separate alpha gradient.
|
|
276
|
+
var alphaValues = GradientColorConfiguration()
|
|
277
|
+
|
|
278
|
+
for alphaIndex in stride(from: numberOfColors * 4, to: colorComponents.endIndex, by: 2) {
|
|
279
|
+
let alphaLocation = CGFloat(colorComponents[alphaIndex])
|
|
280
|
+
let alphaValue = CGFloat(colorComponents[alphaIndex + 1])
|
|
281
|
+
alphaValues.append((color: .rgba(0, 0, 0, alphaValue), location: alphaLocation))
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
return alphaValues
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
}
|