@octane-xplat/lottie 0.9.0 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +36 -16
- package/dist/native/index.js +10 -9
- package/dist/native/octane-client-build.json +1 -1
- package/dist/web/index.js +39 -25
- package/dist/web/octane-client-build.json +1 -1
- package/package.json +25 -3
- package/platforms/macos/LICENSE-EpoxyCore-Apache-2.0.txt +201 -0
- package/platforms/macos/LICENSE-LRUCache-MIT.txt +22 -0
- package/platforms/macos/LICENSE-Lottie-Apache-2.0.txt +201 -0
- package/platforms/macos/LICENSE-ZIPFoundation-MIT.txt +21 -0
- package/platforms/macos/UPSTREAM.md +13 -0
- package/platforms/macos/resources/PrivacyInfo.xcprivacy +23 -0
- package/platforms/macos/resources/THIRD-PARTY-NOTICES.txt +10 -0
- package/platforms/macos/src/XplatAppKitLottie.swift +246 -0
- package/platforms/macos/src/vendor/Lottie/PrivacyInfo.xcprivacy +23 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/CAAnimation+TimingConfiguration.swift +81 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/CALayer+addAnimation.swift +476 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/CombinedShapeAnimation.swift +92 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/CustomPathAnimation.swift +89 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/DropShadowAnimation.swift +179 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/EllipseAnimation.swift +53 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/GradientAnimations.swift +287 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/LayerProperty.swift +440 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/OpacityAnimation.swift +53 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/RectangleAnimation.swift +59 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/ShapeAnimation.swift +246 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/StarAnimation.swift +119 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/StrokeAnimation.swift +96 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/TransformAnimations.swift +380 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/VisibilityAnimation.swift +63 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/CompatibilityTracker.swift +129 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/CoreAnimationLayer.swift +645 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Extensions/CALayer+fillBounds.swift +35 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Extensions/KeyframeGroup+exactlyOneKeyframe.swift +28 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Extensions/Keyframes+combined.swift +345 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Extensions/Keyframes+timeRemapping.swift +46 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/AnimationLayer.swift +169 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/BaseAnimationLayer.swift +46 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/BaseCompositionLayer.swift +120 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/CALayer+setupLayerHierarchy.swift +169 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/GradientRenderLayer.swift +101 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/ImageLayer.swift +81 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/InfiniteOpaqueAnimationLayer.swift +57 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/LayerModel+makeAnimationLayer.swift +59 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/MaskCompositionLayer.swift +139 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/PreCompLayer.swift +107 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/RepeaterLayer.swift +113 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/ShapeItemLayer.swift +346 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/ShapeLayer.swift +569 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/SolidLayer.swift +66 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/TextLayer.swift +157 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/TransformLayer.swift +13 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/ValueProviderStore.swift +157 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Diffing/Collection+Diff.swift +267 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Diffing/Diffable.swift +19 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Diffing/DiffableSection.swift +16 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Diffing/IndexChangeset.swift +187 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Diffing/SectionedChangeset.swift +22 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Logging/EpoxyLogger.swift +102 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/CallbackContextEpoxyModeled.swift +8 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/EpoxyModelArrayBuilder.swift +48 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/EpoxyModelProperty.swift +158 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/EpoxyModelStorage.swift +88 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/EpoxyModeled.swift +54 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Internal/AnyEpoxyModelProperty.swift +31 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Internal/ClassReference.swift +39 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/AnimatedProviding.swift +10 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/DataIDProviding.swift +58 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/DidDisplayProviding.swift +41 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/DidEndDisplayingProviding.swift +42 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/DidSelectProviding.swift +36 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/ErasedContentProviding.swift +49 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/MakeViewProviding.swift +61 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/SetBehaviorsProviding.swift +38 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/SetContentProviding.swift +38 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/StyleIDProviding.swift +38 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/TraitCollectionProviding.swift +14 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/ViewDifferentiatorProviding.swift +34 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/ViewProviding.swift +13 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/WillDisplayProviding.swift +41 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/ViewEpoxyModeled.swift +10 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/README.md +30 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/EpoxySwiftUIIntrinsicContentSizeInvalidator.swift +34 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/EpoxySwiftUILayoutMargins.swift +38 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/EpoxyableView+SwiftUIView.swift +165 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/LayoutUtilities/MeasuringViewRepresentable.swift +127 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/LayoutUtilities/SwiftUIMeasurementContainer.swift +468 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/SwiftUIView.swift +146 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/UIView+SwiftUIView.swift +39 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/UIViewConfiguringSwiftUIView.swift +41 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Views/BehaviorsConfigurableView.swift +45 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Views/ContentConfigurableView.swift +36 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Views/EpoxyableView.swift +5 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Views/StyledView.swift +43 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Views/ViewType.swift +47 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/LRUCache/LRUCache.swift +257 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/LRUCache/README.md +24 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/README.md +43 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Archive+BackingConfiguration.swift +149 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Archive+Deprecated.swift +23 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Archive+Helpers.swift +361 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Archive+MemoryFile.swift +205 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Archive+Progress.swift +66 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Archive+Reading.swift +160 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Archive+ReadingDeprecated.swift +50 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Archive+Writing.swift +403 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Archive+WritingDeprecated.swift +95 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Archive+ZIP64.swift +191 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Archive.swift +404 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Data+Compression.swift +632 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Data+CompressionDeprecated.swift +43 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Data+Serialization.swift +146 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Date+ZIP.swift +101 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Entry+Serialization.swift +191 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Entry+ZIP64.swift +170 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Entry.swift +669 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/FileManager+ZIP.swift +405 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/FileManager+ZIPDeprecated.swift +28 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/README.md +24 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/URL+ZIP.swift +34 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/CompLayers/CompositionLayer.swift +177 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/CompLayers/ImageCompositionLayer.swift +54 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/CompLayers/MaskContainerLayer.swift +191 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/CompLayers/NullCompositionLayer.swift +28 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/CompLayers/PreCompositionLayer.swift +137 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/CompLayers/ShapeCompositionLayer.swift +60 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/CompLayers/SolidCompositionLayer.swift +57 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/CompLayers/TextCompositionLayer.swift +247 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/MainThreadAnimationLayer.swift +321 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/Utility/CachedImageProvider.swift +56 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/Utility/CompositionLayersInitializer.swift +103 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/Utility/CoreTextRenderLayer.swift +424 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/Utility/InvertedMatteLayer.swift +55 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/Utility/LayerFontProvider.swift +39 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/Utility/LayerImageProvider.swift +52 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/Utility/LayerTextProvider.swift +38 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/Utility/LayerTransformNode.swift +149 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Extensions/ItemsExtension.swift +146 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/NodeProperties/NodeProperty.swift +62 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/NodeProperties/Protocols/AnyNodeProperty.swift +53 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/NodeProperties/Protocols/AnyValueContainer.swift +26 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/NodeProperties/Protocols/KeypathSearchable.swift +23 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/NodeProperties/Protocols/NodePropertyMap.swift +43 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/NodeProperties/ValueContainer.swift +47 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/NodeProperties/ValueProviders/GroupInterpolator.swift +39 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/NodeProperties/ValueProviders/SingleValueProvider.swift +43 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/LayerEffectNodes/DropShadowNode.swift +102 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/LayerEffectNodes/LayerEffectNode.swift +25 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/ModifierNodes/RoundedCornersNode.swift +85 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/ModifierNodes/TrimPathNode.swift +281 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/OutputNodes/GroupOutputNode.swift +74 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/OutputNodes/PassThroughOutputNode.swift +47 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/OutputNodes/PathOutputNode.swift +89 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/OutputNodes/Renderables/FillRenderer.swift +69 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/OutputNodes/Renderables/GradientFillRenderer.swift +253 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/OutputNodes/Renderables/GradientStrokeRenderer.swift +64 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/OutputNodes/Renderables/LegacyGradientFillRenderer.swift +158 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/OutputNodes/Renderables/StrokeRenderer.swift +165 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/PathNodes/EllipseNode.swift +143 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/PathNodes/PolygonNode.swift +173 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/PathNodes/RectNode.swift +238 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/PathNodes/ShapeNode.swift +73 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/PathNodes/StarNode.swift +224 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/RenderContainers/GroupNode.swift +162 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/RenderNodes/FillNode.swift +88 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/RenderNodes/GradientFillNode.swift +103 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/RenderNodes/GradientStrokeNode.swift +149 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/RenderNodes/StrokeNode.swift +179 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/Text/TextAnimatorNode.swift +345 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Protocols/AnimatorNode.swift +197 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Protocols/PathNode.swift +20 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Protocols/RenderNode.swift +60 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/RenderLayers/ShapeContainerLayer.swift +78 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/RenderLayers/ShapeRenderLayer.swift +98 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/Assets/Asset.swift +51 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/Assets/AssetLibrary.swift +75 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/Assets/ImageAsset.swift +141 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/Assets/PrecompAsset.swift +47 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/DictionaryInitializable.swift +73 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/DotLottie/DotLottieAnimation.swift +57 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/DotLottie/DotLottieImageProvider.swift +89 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/DotLottie/DotLottieManifest.swift +42 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/DotLottie/DotLottieUtils.swift +71 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/Extensions/Bundle.swift +58 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/Extensions/KeyedDecodingContainerExtensions.swift +71 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/Keyframes/KeyframeData.swift +111 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/Keyframes/KeyframeGroup.swift +265 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/LayerEffects/DropShadowEffect.swift +52 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/LayerEffects/EffectValues/ColorEffectValue.swift +45 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/LayerEffects/EffectValues/EffectValue.swift +98 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/LayerEffects/EffectValues/Vector1DEffectValue.swift +45 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/LayerEffects/LayerEffect.swift +103 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/LayerStyles/DropShadowStyle.swift +79 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/LayerStyles/LayerStyle.swift +85 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/Layers/ImageLayerModel.swift +49 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/Layers/LayerModel.swift +266 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/Layers/PreCompLayerModel.swift +74 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/Layers/ShapeLayerModel.swift +50 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/Layers/SolidLayerModel.swift +63 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/Layers/TextLayerModel.swift +65 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/Objects/DashPattern.swift +42 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/Objects/Marker.swift +35 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/Objects/Mask.swift +80 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/Objects/Transform.swift +261 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/Ellipse.swift +79 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/Fill.swift +79 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/GradientFill.swift +142 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/GradientStroke.swift +244 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/Group.swift +55 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/Merge.swift +63 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/Rectangle.swift +79 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/Repeater.swift +181 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/RoundedCorners.swift +53 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/Shape.swift +63 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/ShapeItem.swift +171 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/ShapeTransform.swift +202 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/Star.swift +136 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/Stroke.swift +144 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/Trim.swift +90 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/Text/Font.swift +67 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/Text/Glyph.swift +94 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/Text/TextAnimator.swift +240 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/Text/TextDocument.swift +142 -0
- package/platforms/macos/src/vendor/Lottie/Private/RootAnimationLayer.swift +54 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/Debugging/AnimatorNodeDebugging.swift +23 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/Debugging/LayerDebugging.swift +231 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/Debugging/TestHelpers.swift +10 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/Extensions/AnimationKeypathExtension.swift +303 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/Extensions/BlendMode+Filter.swift +31 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/Extensions/CGColor+RGB.swift +45 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/Extensions/CGFloatExtensions.swift +152 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/Extensions/DataExtension.swift +33 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/Extensions/MathKit.swift +454 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/Extensions/StringExtensions.swift +44 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/Helpers/AnimationContext.swift +95 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/Helpers/AnyEquatable.swift +23 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/Helpers/Binding+Map.swift +19 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/Helpers/View+ValueChanged.swift +35 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/Interpolatable/InterpolatableExtensions.swift +143 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/Interpolatable/KeyframeExtensions.swift +47 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/Interpolatable/KeyframeInterpolator.swift +250 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/LottieAnimationSource.swift +51 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/Primitives/BezierPath.swift +509 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/Primitives/BezierPathRoundExtension.swift +163 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/Primitives/CGPointExtension.swift +35 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/Primitives/ColorExtension.swift +101 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/Primitives/CompoundBezierPath.swift +169 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/Primitives/CurveVertex.swift +190 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/Primitives/PathElement.swift +78 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/Primitives/UnitBezier.swift +119 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/Primitives/VectorsExtensions.swift +368 -0
- package/platforms/macos/src/vendor/Lottie/Public/Animation/LottieAnimation.swift +179 -0
- package/platforms/macos/src/vendor/Lottie/Public/Animation/LottieAnimationHelpers.swift +317 -0
- package/platforms/macos/src/vendor/Lottie/Public/Animation/LottieAnimationLayer.swift +1582 -0
- package/platforms/macos/src/vendor/Lottie/Public/Animation/LottieAnimationView.swift +1090 -0
- package/platforms/macos/src/vendor/Lottie/Public/Animation/LottieAnimationViewInitializers.swift +226 -0
- package/platforms/macos/src/vendor/Lottie/Public/Animation/LottiePlaybackMode.swift +266 -0
- package/platforms/macos/src/vendor/Lottie/Public/Animation/LottieView.swift +643 -0
- package/platforms/macos/src/vendor/Lottie/Public/AnimationCache/AnimationCacheProvider.swift +21 -0
- package/platforms/macos/src/vendor/Lottie/Public/AnimationCache/DefaultAnimationCache.swift +67 -0
- package/platforms/macos/src/vendor/Lottie/Public/AnimationCache/LRUAnimationCache.swift +11 -0
- package/platforms/macos/src/vendor/Lottie/Public/AnimationCache/LottieAnimationCache.swift +15 -0
- package/platforms/macos/src/vendor/Lottie/Public/Configuration/DecodingStrategy.swift +15 -0
- package/platforms/macos/src/vendor/Lottie/Public/Configuration/LottieConfiguration.swift +54 -0
- package/platforms/macos/src/vendor/Lottie/Public/Configuration/LottieURLSession.swift +31 -0
- package/platforms/macos/src/vendor/Lottie/Public/Configuration/ReducedMotionOption.swift +128 -0
- package/platforms/macos/src/vendor/Lottie/Public/Configuration/RenderingEngineOption.swift +117 -0
- package/platforms/macos/src/vendor/Lottie/Public/Controls/AnimatedButton.swift +128 -0
- package/platforms/macos/src/vendor/Lottie/Public/Controls/AnimatedControl.swift +248 -0
- package/platforms/macos/src/vendor/Lottie/Public/Controls/AnimatedSwitch.swift +271 -0
- package/platforms/macos/src/vendor/Lottie/Public/Controls/LottieButton.swift +119 -0
- package/platforms/macos/src/vendor/Lottie/Public/Controls/LottieSwitch.swift +144 -0
- package/platforms/macos/src/vendor/Lottie/Public/Controls/LottieViewType.swift +79 -0
- package/platforms/macos/src/vendor/Lottie/Public/DotLottie/Cache/DotLottieCache.swift +66 -0
- package/platforms/macos/src/vendor/Lottie/Public/DotLottie/Cache/DotLottieCacheProvider.swift +21 -0
- package/platforms/macos/src/vendor/Lottie/Public/DotLottie/DotLottieConfiguration.swift +72 -0
- package/platforms/macos/src/vendor/Lottie/Public/DotLottie/DotLottieFile.swift +186 -0
- package/platforms/macos/src/vendor/Lottie/Public/DotLottie/DotLottieFileHelpers.swift +386 -0
- package/platforms/macos/src/vendor/Lottie/Public/DynamicProperties/AnimationKeypath.swift +57 -0
- package/platforms/macos/src/vendor/Lottie/Public/DynamicProperties/AnyValueProvider.swift +132 -0
- package/platforms/macos/src/vendor/Lottie/Public/DynamicProperties/ValueProviders/ColorValueProvider.swift +96 -0
- package/platforms/macos/src/vendor/Lottie/Public/DynamicProperties/ValueProviders/FloatValueProvider.swift +81 -0
- package/platforms/macos/src/vendor/Lottie/Public/DynamicProperties/ValueProviders/GradientValueProvider.swift +138 -0
- package/platforms/macos/src/vendor/Lottie/Public/DynamicProperties/ValueProviders/PointValueProvider.swift +81 -0
- package/platforms/macos/src/vendor/Lottie/Public/DynamicProperties/ValueProviders/SizeValueProvider.swift +81 -0
- package/platforms/macos/src/vendor/Lottie/Public/FontProvider/AnimationFontProvider.swift +41 -0
- package/platforms/macos/src/vendor/Lottie/Public/ImageProvider/AnimationImageProvider.swift +43 -0
- package/platforms/macos/src/vendor/Lottie/Public/Keyframes/Interpolatable.swift +285 -0
- package/platforms/macos/src/vendor/Lottie/Public/Keyframes/Keyframe.swift +98 -0
- package/platforms/macos/src/vendor/Lottie/Public/Logging/LottieLogger.swift +138 -0
- package/platforms/macos/src/vendor/Lottie/Public/Primitives/AnimationTime.swift +15 -0
- package/platforms/macos/src/vendor/Lottie/Public/Primitives/LottieColor.swift +43 -0
- package/platforms/macos/src/vendor/Lottie/Public/Primitives/Vectors.swift +36 -0
- package/platforms/macos/src/vendor/Lottie/Public/TextProvider/AnimationTextProvider.swift +135 -0
- package/platforms/macos/src/vendor/Lottie/Public/iOS/AnimationSubview.swift +19 -0
- package/platforms/macos/src/vendor/Lottie/Public/iOS/BundleImageProvider.swift +98 -0
- package/platforms/macos/src/vendor/Lottie/Public/iOS/Compatibility/CompatibleAnimationKeypath.swift +33 -0
- package/platforms/macos/src/vendor/Lottie/Public/iOS/Compatibility/CompatibleAnimationView.swift +567 -0
- package/platforms/macos/src/vendor/Lottie/Public/iOS/Compatibility/CompatibleFontProvider.swift +41 -0
- package/platforms/macos/src/vendor/Lottie/Public/iOS/Compatibility/CompatibleImageProvider.swift +43 -0
- package/platforms/macos/src/vendor/Lottie/Public/iOS/FilepathImageProvider.swift +78 -0
- package/platforms/macos/src/vendor/Lottie/Public/iOS/LottieAnimationViewBase.swift +85 -0
- package/platforms/macos/src/vendor/Lottie/Public/iOS/UIColorExtension.swift +23 -0
- package/platforms/macos/src/vendor/Lottie/Public/macOS/AnimationSubview.macOS.swift +19 -0
- package/platforms/macos/src/vendor/Lottie/Public/macOS/BundleImageProvider.macOS.swift +90 -0
- package/platforms/macos/src/vendor/Lottie/Public/macOS/FilepathImageProvider.macOS.swift +86 -0
- package/platforms/macos/src/vendor/Lottie/Public/macOS/LottieAnimationViewBase.macOS.swift +102 -0
- package/src/Lottie.macos.tsrx +129 -0
- package/src/Lottie.tsrx +3 -2
- package/src/Lottie.web.tsrx +28 -11
- package/src/index.macos.ts +2 -0
- package/src/props.ts +6 -1
- package/types/generated/props.d.ts +5 -1
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
//
|
|
2
|
+
// FilepathImageProvider.swift
|
|
3
|
+
// lottie-swift
|
|
4
|
+
//
|
|
5
|
+
// Created by Brandon Withrow on 2/1/19.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
import Foundation
|
|
9
|
+
#if canImport(UIKit)
|
|
10
|
+
import UIKit
|
|
11
|
+
|
|
12
|
+
/// Provides an image for a lottie animation from a provided Bundle.
|
|
13
|
+
public final class FilepathImageProvider: AnimationImageProvider {
|
|
14
|
+
|
|
15
|
+
// MARK: Lifecycle
|
|
16
|
+
|
|
17
|
+
/// Initializes an image provider with a specific filepath.
|
|
18
|
+
///
|
|
19
|
+
/// - Parameter filepath: The absolute filepath containing the images.
|
|
20
|
+
/// - Parameter contentsGravity: The contents gravity to use when rendering the images.
|
|
21
|
+
///
|
|
22
|
+
public init(filepath: String, contentsGravity: CALayerContentsGravity = .resize) {
|
|
23
|
+
self.filepath = URL(fileURLWithPath: filepath)
|
|
24
|
+
self.contentsGravity = contentsGravity
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/// Initializes an image provider with a specific filepath.
|
|
28
|
+
///
|
|
29
|
+
/// - Parameter filepath: The absolute filepath containing the images.
|
|
30
|
+
/// - Parameter contentsGravity: The contents gravity to use when rendering the images.
|
|
31
|
+
///
|
|
32
|
+
public init(filepath: URL, contentsGravity: CALayerContentsGravity = .resize) {
|
|
33
|
+
self.filepath = filepath
|
|
34
|
+
self.contentsGravity = contentsGravity
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// MARK: Public
|
|
38
|
+
|
|
39
|
+
public func imageForAsset(asset: ImageAsset) -> CGImage? {
|
|
40
|
+
if
|
|
41
|
+
asset.name.hasPrefix("data:"),
|
|
42
|
+
let url = URL(string: asset.name),
|
|
43
|
+
let data = try? Data(contentsOf: url),
|
|
44
|
+
let image = UIImage(data: data)
|
|
45
|
+
{
|
|
46
|
+
return image.cgImage
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
let directPath = filepath.appendingPathComponent(asset.name).path
|
|
50
|
+
if FileManager.default.fileExists(atPath: directPath) {
|
|
51
|
+
return UIImage(contentsOfFile: directPath)?.cgImage
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
let pathWithDirectory = filepath.appendingPathComponent(asset.directory).appendingPathComponent(asset.name).path
|
|
55
|
+
if FileManager.default.fileExists(atPath: pathWithDirectory) {
|
|
56
|
+
return UIImage(contentsOfFile: pathWithDirectory)?.cgImage
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
LottieLogger.shared.warn("Could not find image \"\(asset.name)\" in bundle")
|
|
60
|
+
return nil
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
public func contentsGravity(for _: ImageAsset) -> CALayerContentsGravity {
|
|
64
|
+
contentsGravity
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// MARK: Internal
|
|
68
|
+
|
|
69
|
+
let filepath: URL
|
|
70
|
+
let contentsGravity: CALayerContentsGravity
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
extension FilepathImageProvider: Equatable {
|
|
74
|
+
public static func ==(_ lhs: FilepathImageProvider, _ rhs: FilepathImageProvider) -> Bool {
|
|
75
|
+
lhs.filepath == rhs.filepath
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
#endif
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
//
|
|
2
|
+
// LottieAnimationViewBase.swift
|
|
3
|
+
// lottie-swift-iOS
|
|
4
|
+
//
|
|
5
|
+
// Created by Brandon Withrow on 2/6/19.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
#if canImport(UIKit)
|
|
9
|
+
import UIKit
|
|
10
|
+
|
|
11
|
+
/// The base view for `LottieAnimationView` on iOS, tvOS, watchOS, and macCatalyst.
|
|
12
|
+
///
|
|
13
|
+
/// Enables the `LottieAnimationView` implementation to be shared across platforms.
|
|
14
|
+
open class LottieAnimationViewBase: UIView {
|
|
15
|
+
|
|
16
|
+
// MARK: Public
|
|
17
|
+
|
|
18
|
+
public override var contentMode: UIView.ContentMode {
|
|
19
|
+
didSet {
|
|
20
|
+
setNeedsLayout()
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
public override func didMoveToWindow() {
|
|
25
|
+
super.didMoveToWindow()
|
|
26
|
+
animationMovedToWindow()
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
public override func layoutSubviews() {
|
|
30
|
+
super.layoutSubviews()
|
|
31
|
+
layoutAnimation()
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// MARK: Internal
|
|
35
|
+
|
|
36
|
+
var viewLayer: CALayer? {
|
|
37
|
+
layer
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
var screenScale: CGFloat {
|
|
41
|
+
#if os(iOS) || os(tvOS)
|
|
42
|
+
max(UITraitCollection.current.displayScale, 1)
|
|
43
|
+
#else // if os(visionOS)
|
|
44
|
+
// We intentionally don't check `#if os(visionOS)`, because that emits
|
|
45
|
+
// a warning when building on Xcode 14 and earlier.
|
|
46
|
+
1.0
|
|
47
|
+
#endif
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
func layoutAnimation() {
|
|
51
|
+
// Implemented by subclasses.
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
func animationMovedToWindow() {
|
|
55
|
+
// Implemented by subclasses.
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
func commonInit() {
|
|
59
|
+
contentMode = .scaleAspectFit
|
|
60
|
+
clipsToBounds = true
|
|
61
|
+
NotificationCenter.default.addObserver(
|
|
62
|
+
self,
|
|
63
|
+
selector: #selector(animationWillEnterForeground),
|
|
64
|
+
name: UIApplication.willEnterForegroundNotification,
|
|
65
|
+
object: nil
|
|
66
|
+
)
|
|
67
|
+
NotificationCenter.default.addObserver(
|
|
68
|
+
self,
|
|
69
|
+
selector: #selector(animationWillMoveToBackground),
|
|
70
|
+
name: UIApplication.didEnterBackgroundNotification,
|
|
71
|
+
object: nil
|
|
72
|
+
)
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
@objc
|
|
76
|
+
func animationWillMoveToBackground() {
|
|
77
|
+
// Implemented by subclasses.
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
@objc
|
|
81
|
+
func animationWillEnterForeground() {
|
|
82
|
+
// Implemented by subclasses.
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
#endif
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
//
|
|
2
|
+
// UIColorExtension.swift
|
|
3
|
+
// lottie-swift
|
|
4
|
+
//
|
|
5
|
+
// Created by Brandon Withrow on 2/4/19.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
#if canImport(UIKit)
|
|
9
|
+
import UIKit
|
|
10
|
+
|
|
11
|
+
extension UIColor {
|
|
12
|
+
|
|
13
|
+
public var lottieColorValue: LottieColor {
|
|
14
|
+
var r: CGFloat = 0
|
|
15
|
+
var g: CGFloat = 0
|
|
16
|
+
var b: CGFloat = 0
|
|
17
|
+
var a: CGFloat = 0
|
|
18
|
+
getRed(&r, green: &g, blue: &b, alpha: &a)
|
|
19
|
+
return LottieColor(r: Double(r), g: Double(g), b: Double(b), a: Double(a))
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
}
|
|
23
|
+
#endif
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
//
|
|
2
|
+
// AnimationSubview.swift
|
|
3
|
+
// lottie-swift-iOS
|
|
4
|
+
//
|
|
5
|
+
// Created by Brandon Withrow on 2/5/19.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
#if os(macOS)
|
|
9
|
+
import AppKit
|
|
10
|
+
|
|
11
|
+
/// A view that can be added to a keypath of an AnimationView
|
|
12
|
+
public final class AnimationSubview: NSView {
|
|
13
|
+
|
|
14
|
+
var viewLayer: CALayer? {
|
|
15
|
+
layer
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
}
|
|
19
|
+
#endif
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
//
|
|
2
|
+
// LottieBundleImageProvider.swift
|
|
3
|
+
// lottie-swift
|
|
4
|
+
//
|
|
5
|
+
// Created by Brandon Withrow on 1/25/19.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
#if os(macOS)
|
|
9
|
+
import AppKit
|
|
10
|
+
|
|
11
|
+
/// Provides an image for a lottie animation from a provided Bundle.
|
|
12
|
+
public final class BundleImageProvider: AnimationImageProvider {
|
|
13
|
+
|
|
14
|
+
// MARK: Lifecycle
|
|
15
|
+
|
|
16
|
+
/// Initializes an image provider with a bundle and an optional subpath.
|
|
17
|
+
///
|
|
18
|
+
/// Provides images for an animation from a bundle. Additionally the provider can
|
|
19
|
+
/// search a specific subpath for the images.
|
|
20
|
+
///
|
|
21
|
+
/// - Parameter bundle: The bundle containing images for the provider.
|
|
22
|
+
/// - Parameter searchPath: The subpath is a path within the bundle to search for image assets.
|
|
23
|
+
/// - Parameter contentsGravity: The contents gravity to use when rendering the image.
|
|
24
|
+
///
|
|
25
|
+
public init(bundle: Bundle, searchPath: String?, contentsGravity: CALayerContentsGravity = .resize) {
|
|
26
|
+
self.bundle = bundle
|
|
27
|
+
self.searchPath = searchPath
|
|
28
|
+
self.contentsGravity = contentsGravity
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// MARK: Public
|
|
32
|
+
|
|
33
|
+
public func imageForAsset(asset: ImageAsset) -> CGImage? {
|
|
34
|
+
if let base64Image = asset.base64Image {
|
|
35
|
+
return base64Image
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
let imagePath: String?
|
|
39
|
+
/// Try to find the image in the bundle.
|
|
40
|
+
if let searchPath {
|
|
41
|
+
/// Search in the provided search path for the image
|
|
42
|
+
var directoryPath = URL(fileURLWithPath: searchPath)
|
|
43
|
+
directoryPath.appendPathComponent(asset.directory)
|
|
44
|
+
|
|
45
|
+
if let path = bundle.path(forResource: asset.name, ofType: nil, inDirectory: directoryPath.path) {
|
|
46
|
+
/// First search for the image in the asset provided sub directory.
|
|
47
|
+
imagePath = path
|
|
48
|
+
} else if let path = bundle.path(forResource: asset.name, ofType: nil, inDirectory: searchPath) {
|
|
49
|
+
/// Try finding the image in the search path.
|
|
50
|
+
imagePath = path
|
|
51
|
+
} else {
|
|
52
|
+
imagePath = bundle.path(forResource: asset.name, ofType: nil)
|
|
53
|
+
}
|
|
54
|
+
} else {
|
|
55
|
+
if let path = bundle.path(forResource: asset.name, ofType: nil, inDirectory: asset.directory) {
|
|
56
|
+
/// First search for the image in the asset provided sub directory.
|
|
57
|
+
imagePath = path
|
|
58
|
+
} else {
|
|
59
|
+
/// First search for the image in bundle.
|
|
60
|
+
imagePath = bundle.path(forResource: asset.name, ofType: nil)
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
guard let foundPath = imagePath, let image = NSImage(contentsOfFile: foundPath) else {
|
|
65
|
+
/// No image found.
|
|
66
|
+
LottieLogger.shared.warn("Could not find image \"\(asset.name)\" in bundle")
|
|
67
|
+
return nil
|
|
68
|
+
}
|
|
69
|
+
return image.lottie_CGImage
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
public func contentsGravity(for _: ImageAsset) -> CALayerContentsGravity {
|
|
73
|
+
contentsGravity
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// MARK: Internal
|
|
77
|
+
|
|
78
|
+
let bundle: Bundle
|
|
79
|
+
let searchPath: String?
|
|
80
|
+
let contentsGravity: CALayerContentsGravity
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
extension BundleImageProvider: Equatable {
|
|
84
|
+
public static func ==(_ lhs: BundleImageProvider, _ rhs: BundleImageProvider) -> Bool {
|
|
85
|
+
lhs.bundle == rhs.bundle
|
|
86
|
+
&& lhs.searchPath == rhs.searchPath
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
#endif
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
//
|
|
2
|
+
// FilepathImageProvider.swift
|
|
3
|
+
// lottie-swift
|
|
4
|
+
//
|
|
5
|
+
// Created by Brandon Withrow on 2/1/19.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
#if os(macOS)
|
|
9
|
+
import AppKit
|
|
10
|
+
|
|
11
|
+
/// An `AnimationImageProvider` that provides images by name from a specific filepath.
|
|
12
|
+
public final class FilepathImageProvider: AnimationImageProvider {
|
|
13
|
+
|
|
14
|
+
// MARK: Lifecycle
|
|
15
|
+
|
|
16
|
+
/// Initializes an image provider with a specific filepath.
|
|
17
|
+
///
|
|
18
|
+
/// - Parameter filepath: The absolute filepath containing the images.
|
|
19
|
+
/// - Parameter contentsGravity: The contents gravity to use when rendering the images.
|
|
20
|
+
///
|
|
21
|
+
public init(filepath: String, contentsGravity: CALayerContentsGravity = .resize) {
|
|
22
|
+
self.filepath = URL(fileURLWithPath: filepath)
|
|
23
|
+
self.contentsGravity = contentsGravity
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/// Initializes an image provider with a specific filepath.
|
|
27
|
+
///
|
|
28
|
+
/// - Parameter filepath: The absolute filepath containing the images.
|
|
29
|
+
/// - Parameter contentsGravity: The contents gravity to use when rendering the images.
|
|
30
|
+
///
|
|
31
|
+
public init(filepath: URL, contentsGravity: CALayerContentsGravity = .resize) {
|
|
32
|
+
self.filepath = filepath
|
|
33
|
+
self.contentsGravity = contentsGravity
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// MARK: Public
|
|
37
|
+
|
|
38
|
+
public func imageForAsset(asset: ImageAsset) -> CGImage? {
|
|
39
|
+
if
|
|
40
|
+
asset.name.hasPrefix("data:"),
|
|
41
|
+
let url = URL(string: asset.name),
|
|
42
|
+
let data = try? Data(contentsOf: url),
|
|
43
|
+
let image = NSImage(data: data)
|
|
44
|
+
{
|
|
45
|
+
return image.lottie_CGImage
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
let directPath = filepath.appendingPathComponent(asset.name).path
|
|
49
|
+
if FileManager.default.fileExists(atPath: directPath) {
|
|
50
|
+
return NSImage(contentsOfFile: directPath)?.lottie_CGImage
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
let pathWithDirectory = filepath.appendingPathComponent(asset.directory).appendingPathComponent(asset.name).path
|
|
54
|
+
if FileManager.default.fileExists(atPath: pathWithDirectory) {
|
|
55
|
+
return NSImage(contentsOfFile: pathWithDirectory)?.lottie_CGImage
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
LottieLogger.shared.warn("Could not find image \"\(asset.name)\" in bundle")
|
|
59
|
+
return nil
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
public func contentsGravity(for _: ImageAsset) -> CALayerContentsGravity {
|
|
63
|
+
contentsGravity
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// MARK: Internal
|
|
67
|
+
|
|
68
|
+
let filepath: URL
|
|
69
|
+
let contentsGravity: CALayerContentsGravity
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
extension FilepathImageProvider: Equatable {
|
|
73
|
+
public static func ==(_ lhs: FilepathImageProvider, _ rhs: FilepathImageProvider) -> Bool {
|
|
74
|
+
lhs.filepath == rhs.filepath
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
extension NSImage {
|
|
79
|
+
@nonobjc
|
|
80
|
+
var lottie_CGImage: CGImage? {
|
|
81
|
+
guard let imageData = tiffRepresentation else { return nil }
|
|
82
|
+
guard let sourceData = CGImageSourceCreateWithData(imageData as CFData, nil) else { return nil }
|
|
83
|
+
return CGImageSourceCreateImageAtIndex(sourceData, 0, nil)
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
#endif
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
//
|
|
2
|
+
// LottieAnimationViewBase.swift
|
|
3
|
+
// lottie-swift-iOS
|
|
4
|
+
//
|
|
5
|
+
// Created by Brandon Withrow on 2/6/19.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
#if os(macOS)
|
|
9
|
+
import AppKit
|
|
10
|
+
|
|
11
|
+
public enum LottieContentMode: Int {
|
|
12
|
+
case scaleToFill
|
|
13
|
+
case scaleAspectFit
|
|
14
|
+
case scaleAspectFill
|
|
15
|
+
case redraw
|
|
16
|
+
case center
|
|
17
|
+
case top
|
|
18
|
+
case bottom
|
|
19
|
+
case left
|
|
20
|
+
case right
|
|
21
|
+
case topLeft
|
|
22
|
+
case topRight
|
|
23
|
+
case bottomLeft
|
|
24
|
+
case bottomRight
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/// The base view for `LottieAnimationView` on macOs.
|
|
28
|
+
///
|
|
29
|
+
/// Enables the `LottieAnimationView` implementation to be shared across platforms.
|
|
30
|
+
open class LottieAnimationViewBase: NSView {
|
|
31
|
+
|
|
32
|
+
// MARK: Public
|
|
33
|
+
|
|
34
|
+
public override var wantsUpdateLayer: Bool {
|
|
35
|
+
true
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
public override var isFlipped: Bool {
|
|
39
|
+
true
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
public var contentMode = LottieContentMode.scaleAspectFit {
|
|
43
|
+
didSet {
|
|
44
|
+
setNeedsLayout()
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
public override func viewDidMoveToWindow() {
|
|
49
|
+
super.viewDidMoveToWindow()
|
|
50
|
+
animationMovedToWindow()
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
public override func layout() {
|
|
54
|
+
super.layout()
|
|
55
|
+
CATransaction.begin()
|
|
56
|
+
CATransaction.setDisableActions(true)
|
|
57
|
+
layoutAnimation()
|
|
58
|
+
CATransaction.commit()
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// MARK: Internal
|
|
62
|
+
|
|
63
|
+
var screenScale: CGFloat {
|
|
64
|
+
NSApp.mainWindow?.backingScaleFactor ?? 1
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
var viewLayer: CALayer? {
|
|
68
|
+
layer
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
func layoutAnimation() {
|
|
72
|
+
// Implemented by subclasses.
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
func animationMovedToWindow() {
|
|
76
|
+
// Implemented by subclasses.
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
func commonInit() {
|
|
80
|
+
wantsLayer = true
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
func setNeedsLayout() {
|
|
84
|
+
needsLayout = true
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
func layoutIfNeeded() {
|
|
88
|
+
// Implemented by subclasses.
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
@objc
|
|
92
|
+
func animationWillMoveToBackground() {
|
|
93
|
+
// Implemented by subclasses.
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
@objc
|
|
97
|
+
func animationWillEnterForeground() {
|
|
98
|
+
// Implemented by subclasses.
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
}
|
|
102
|
+
#endif
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
/** @jsxImportSource @octane-xplat/macos-renderer */
|
|
2
|
+
import { useEffect, useImperativeHandle, useMemo, useRef } from 'octane'
|
|
3
|
+
import { layoutChildProps } from './layout-child'
|
|
4
|
+
import type { LottieHandle, LottieProps } from './props'
|
|
5
|
+
|
|
6
|
+
type AppKitLottieAdapter = {
|
|
7
|
+
nativeView: any
|
|
8
|
+
durationMs: number
|
|
9
|
+
progress: number
|
|
10
|
+
isPlaying: boolean
|
|
11
|
+
onLoaded: ((duration: number) => void) | null
|
|
12
|
+
onEnded: (() => void) | null
|
|
13
|
+
onError: ((message: string) => void) | null
|
|
14
|
+
mountIn(host: any): void
|
|
15
|
+
loadJSON(json: string): void
|
|
16
|
+
loadFile(pathOrURL: string): void
|
|
17
|
+
loadURL(address: string): void
|
|
18
|
+
clear(): void
|
|
19
|
+
play(): void
|
|
20
|
+
pause(): void
|
|
21
|
+
stop(): void
|
|
22
|
+
seekTo(progress: number): void
|
|
23
|
+
speed: number
|
|
24
|
+
loop: boolean
|
|
25
|
+
fit: string
|
|
26
|
+
dispose(): void
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function createHandle(adapter: AppKitLottieAdapter): LottieHandle {
|
|
30
|
+
return {
|
|
31
|
+
play: () => adapter.play(),
|
|
32
|
+
pause: () => adapter.pause(),
|
|
33
|
+
stop: () => adapter.stop(),
|
|
34
|
+
seekTo: (progress) => adapter.seekTo(progress),
|
|
35
|
+
setSpeed: (speed) => {
|
|
36
|
+
adapter.speed = speed
|
|
37
|
+
},
|
|
38
|
+
progress: () => adapter.progress,
|
|
39
|
+
duration: () => adapter.durationMs,
|
|
40
|
+
isPlaying: () => adapter.isPlaying,
|
|
41
|
+
native: adapter.nativeView,
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/** AppKit Lottie uses the vendored Airbnb engine through the macOS leaf build. */
|
|
46
|
+
export function Lottie(props: LottieProps) @{
|
|
47
|
+
const adapter = useMemo(
|
|
48
|
+
() => (globalThis as any).XplatLottieAdapter.new() as AppKitLottieAdapter,
|
|
49
|
+
[],
|
|
50
|
+
)
|
|
51
|
+
const latest = useRef(props)
|
|
52
|
+
latest.current = props
|
|
53
|
+
|
|
54
|
+
useImperativeHandle<LottieHandle>(props.ref, () => createHandle(adapter), [adapter])
|
|
55
|
+
|
|
56
|
+
useEffect(() => {
|
|
57
|
+
adapter.onLoaded = (duration) => {
|
|
58
|
+
const current = latest.current
|
|
59
|
+
if (current.speed !== undefined) adapter.speed = current.speed
|
|
60
|
+
if (current.progress !== undefined) adapter.seekTo(current.progress)
|
|
61
|
+
current.onLoaded?.({ duration })
|
|
62
|
+
if (current.playing ?? current.autoPlay ?? true) adapter.play()
|
|
63
|
+
}
|
|
64
|
+
adapter.onEnded = () => latest.current.onEnded?.()
|
|
65
|
+
adapter.onError = (message) => latest.current.onError?.({ message })
|
|
66
|
+
|
|
67
|
+
return () => adapter.dispose()
|
|
68
|
+
}, [])
|
|
69
|
+
|
|
70
|
+
useEffect(() => {
|
|
71
|
+
if (props.data !== undefined) {
|
|
72
|
+
try {
|
|
73
|
+
adapter.loadJSON(JSON.stringify(props.data))
|
|
74
|
+
} catch (error) {
|
|
75
|
+
props.onError?.({ message: String(error) })
|
|
76
|
+
}
|
|
77
|
+
return
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
const src = props.src
|
|
81
|
+
if (!src) {
|
|
82
|
+
adapter.clear()
|
|
83
|
+
} else if (src.trimStart().startsWith('{')) {
|
|
84
|
+
adapter.loadJSON(src)
|
|
85
|
+
} else if (/^https?:\/\//i.test(src)) {
|
|
86
|
+
adapter.loadURL(src)
|
|
87
|
+
} else {
|
|
88
|
+
adapter.loadFile(src)
|
|
89
|
+
}
|
|
90
|
+
}, [props.src, props.data])
|
|
91
|
+
|
|
92
|
+
useEffect(() => {
|
|
93
|
+
adapter.fit = props.fit ?? 'contain'
|
|
94
|
+
}, [props.fit])
|
|
95
|
+
|
|
96
|
+
useEffect(() => {
|
|
97
|
+
if (props.loop !== undefined) adapter.loop = props.loop
|
|
98
|
+
}, [props.loop])
|
|
99
|
+
|
|
100
|
+
useEffect(() => {
|
|
101
|
+
if (props.speed !== undefined) adapter.speed = props.speed
|
|
102
|
+
}, [props.speed])
|
|
103
|
+
|
|
104
|
+
useEffect(() => {
|
|
105
|
+
if (props.progress !== undefined && adapter.durationMs > 0) {
|
|
106
|
+
adapter.seekTo(props.progress)
|
|
107
|
+
}
|
|
108
|
+
}, [props.progress])
|
|
109
|
+
|
|
110
|
+
useEffect(() => {
|
|
111
|
+
if (props.playing === undefined || adapter.durationMs === 0) return
|
|
112
|
+
if (props.playing) adapter.play()
|
|
113
|
+
else adapter.pause()
|
|
114
|
+
}, [props.playing])
|
|
115
|
+
|
|
116
|
+
<flexboxlayout
|
|
117
|
+
ref={(host: any) => host && adapter.mountIn(host)}
|
|
118
|
+
id={props.id}
|
|
119
|
+
className={props.className}
|
|
120
|
+
style={props.style}
|
|
121
|
+
{...layoutChildProps(props)}
|
|
122
|
+
accessible={props.accessible}
|
|
123
|
+
accessibilityLabel={props.accessibilityLabel}
|
|
124
|
+
accessibilityRole={props.accessibilityRole ?? 'image'}
|
|
125
|
+
accessibilityHint={props.accessibilityHint}
|
|
126
|
+
accessibilityValue={props.accessibilityValue}
|
|
127
|
+
accessibilityState={props.accessibilityState}
|
|
128
|
+
/>
|
|
129
|
+
}
|
package/src/Lottie.tsrx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** @jsxImportSource @nativescript-community/octane */
|
|
2
|
-
import { useCallback, useEffect, useRef } from 'octane';
|
|
2
|
+
import { useImperativeHandle, useCallback, useEffect, useRef } from 'octane';
|
|
3
3
|
import { registerElement } from '@nativescript-community/octane';
|
|
4
4
|
import { isAndroid } from '@nativescript/core';
|
|
5
5
|
import { LottieView } from './vendor/ui-lottie/src/lottie';
|
|
@@ -52,6 +52,8 @@ export function Lottie(props: LottieProps) @{
|
|
|
52
52
|
const appliedSrc = useRef<string | undefined>(undefined);
|
|
53
53
|
const loadedRef = useRef(false);
|
|
54
54
|
|
|
55
|
+
useImperativeHandle(props.ref, () => handle(host.current!), []);
|
|
56
|
+
|
|
55
57
|
const bindHost = useCallback((v: LottieView) => {
|
|
56
58
|
host.current = v;
|
|
57
59
|
}, []);
|
|
@@ -89,7 +91,6 @@ export function Lottie(props: LottieProps) @{
|
|
|
89
91
|
if (finished) props.onEnded?.();
|
|
90
92
|
};
|
|
91
93
|
|
|
92
|
-
props.bind?.(handle(v));
|
|
93
94
|
}, []);
|
|
94
95
|
|
|
95
96
|
// src — applied imperatively after the listeners exist.
|