@octane-xplat/lottie 0.9.0 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +36 -16
- package/dist/native/index.js +10 -9
- package/dist/native/octane-client-build.json +1 -1
- package/dist/web/index.js +39 -25
- package/dist/web/octane-client-build.json +1 -1
- package/package.json +25 -3
- package/platforms/macos/LICENSE-EpoxyCore-Apache-2.0.txt +201 -0
- package/platforms/macos/LICENSE-LRUCache-MIT.txt +22 -0
- package/platforms/macos/LICENSE-Lottie-Apache-2.0.txt +201 -0
- package/platforms/macos/LICENSE-ZIPFoundation-MIT.txt +21 -0
- package/platforms/macos/UPSTREAM.md +13 -0
- package/platforms/macos/resources/PrivacyInfo.xcprivacy +23 -0
- package/platforms/macos/resources/THIRD-PARTY-NOTICES.txt +10 -0
- package/platforms/macos/src/XplatAppKitLottie.swift +246 -0
- package/platforms/macos/src/vendor/Lottie/PrivacyInfo.xcprivacy +23 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/CAAnimation+TimingConfiguration.swift +81 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/CALayer+addAnimation.swift +476 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/CombinedShapeAnimation.swift +92 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/CustomPathAnimation.swift +89 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/DropShadowAnimation.swift +179 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/EllipseAnimation.swift +53 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/GradientAnimations.swift +287 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/LayerProperty.swift +440 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/OpacityAnimation.swift +53 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/RectangleAnimation.swift +59 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/ShapeAnimation.swift +246 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/StarAnimation.swift +119 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/StrokeAnimation.swift +96 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/TransformAnimations.swift +380 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/VisibilityAnimation.swift +63 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/CompatibilityTracker.swift +129 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/CoreAnimationLayer.swift +645 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Extensions/CALayer+fillBounds.swift +35 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Extensions/KeyframeGroup+exactlyOneKeyframe.swift +28 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Extensions/Keyframes+combined.swift +345 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Extensions/Keyframes+timeRemapping.swift +46 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/AnimationLayer.swift +169 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/BaseAnimationLayer.swift +46 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/BaseCompositionLayer.swift +120 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/CALayer+setupLayerHierarchy.swift +169 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/GradientRenderLayer.swift +101 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/ImageLayer.swift +81 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/InfiniteOpaqueAnimationLayer.swift +57 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/LayerModel+makeAnimationLayer.swift +59 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/MaskCompositionLayer.swift +139 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/PreCompLayer.swift +107 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/RepeaterLayer.swift +113 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/ShapeItemLayer.swift +346 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/ShapeLayer.swift +569 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/SolidLayer.swift +66 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/TextLayer.swift +157 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/TransformLayer.swift +13 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/ValueProviderStore.swift +157 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Diffing/Collection+Diff.swift +267 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Diffing/Diffable.swift +19 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Diffing/DiffableSection.swift +16 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Diffing/IndexChangeset.swift +187 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Diffing/SectionedChangeset.swift +22 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Logging/EpoxyLogger.swift +102 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/CallbackContextEpoxyModeled.swift +8 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/EpoxyModelArrayBuilder.swift +48 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/EpoxyModelProperty.swift +158 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/EpoxyModelStorage.swift +88 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/EpoxyModeled.swift +54 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Internal/AnyEpoxyModelProperty.swift +31 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Internal/ClassReference.swift +39 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/AnimatedProviding.swift +10 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/DataIDProviding.swift +58 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/DidDisplayProviding.swift +41 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/DidEndDisplayingProviding.swift +42 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/DidSelectProviding.swift +36 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/ErasedContentProviding.swift +49 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/MakeViewProviding.swift +61 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/SetBehaviorsProviding.swift +38 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/SetContentProviding.swift +38 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/StyleIDProviding.swift +38 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/TraitCollectionProviding.swift +14 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/ViewDifferentiatorProviding.swift +34 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/ViewProviding.swift +13 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/WillDisplayProviding.swift +41 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/ViewEpoxyModeled.swift +10 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/README.md +30 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/EpoxySwiftUIIntrinsicContentSizeInvalidator.swift +34 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/EpoxySwiftUILayoutMargins.swift +38 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/EpoxyableView+SwiftUIView.swift +165 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/LayoutUtilities/MeasuringViewRepresentable.swift +127 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/LayoutUtilities/SwiftUIMeasurementContainer.swift +468 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/SwiftUIView.swift +146 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/UIView+SwiftUIView.swift +39 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/UIViewConfiguringSwiftUIView.swift +41 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Views/BehaviorsConfigurableView.swift +45 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Views/ContentConfigurableView.swift +36 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Views/EpoxyableView.swift +5 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Views/StyledView.swift +43 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Views/ViewType.swift +47 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/LRUCache/LRUCache.swift +257 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/LRUCache/README.md +24 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/README.md +43 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Archive+BackingConfiguration.swift +149 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Archive+Deprecated.swift +23 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Archive+Helpers.swift +361 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Archive+MemoryFile.swift +205 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Archive+Progress.swift +66 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Archive+Reading.swift +160 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Archive+ReadingDeprecated.swift +50 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Archive+Writing.swift +403 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Archive+WritingDeprecated.swift +95 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Archive+ZIP64.swift +191 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Archive.swift +404 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Data+Compression.swift +632 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Data+CompressionDeprecated.swift +43 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Data+Serialization.swift +146 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Date+ZIP.swift +101 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Entry+Serialization.swift +191 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Entry+ZIP64.swift +170 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Entry.swift +669 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/FileManager+ZIP.swift +405 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/FileManager+ZIPDeprecated.swift +28 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/README.md +24 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/URL+ZIP.swift +34 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/CompLayers/CompositionLayer.swift +177 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/CompLayers/ImageCompositionLayer.swift +54 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/CompLayers/MaskContainerLayer.swift +191 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/CompLayers/NullCompositionLayer.swift +28 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/CompLayers/PreCompositionLayer.swift +137 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/CompLayers/ShapeCompositionLayer.swift +60 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/CompLayers/SolidCompositionLayer.swift +57 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/CompLayers/TextCompositionLayer.swift +247 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/MainThreadAnimationLayer.swift +321 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/Utility/CachedImageProvider.swift +56 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/Utility/CompositionLayersInitializer.swift +103 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/Utility/CoreTextRenderLayer.swift +424 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/Utility/InvertedMatteLayer.swift +55 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/Utility/LayerFontProvider.swift +39 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/Utility/LayerImageProvider.swift +52 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/Utility/LayerTextProvider.swift +38 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/Utility/LayerTransformNode.swift +149 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Extensions/ItemsExtension.swift +146 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/NodeProperties/NodeProperty.swift +62 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/NodeProperties/Protocols/AnyNodeProperty.swift +53 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/NodeProperties/Protocols/AnyValueContainer.swift +26 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/NodeProperties/Protocols/KeypathSearchable.swift +23 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/NodeProperties/Protocols/NodePropertyMap.swift +43 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/NodeProperties/ValueContainer.swift +47 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/NodeProperties/ValueProviders/GroupInterpolator.swift +39 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/NodeProperties/ValueProviders/SingleValueProvider.swift +43 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/LayerEffectNodes/DropShadowNode.swift +102 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/LayerEffectNodes/LayerEffectNode.swift +25 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/ModifierNodes/RoundedCornersNode.swift +85 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/ModifierNodes/TrimPathNode.swift +281 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/OutputNodes/GroupOutputNode.swift +74 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/OutputNodes/PassThroughOutputNode.swift +47 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/OutputNodes/PathOutputNode.swift +89 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/OutputNodes/Renderables/FillRenderer.swift +69 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/OutputNodes/Renderables/GradientFillRenderer.swift +253 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/OutputNodes/Renderables/GradientStrokeRenderer.swift +64 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/OutputNodes/Renderables/LegacyGradientFillRenderer.swift +158 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/OutputNodes/Renderables/StrokeRenderer.swift +165 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/PathNodes/EllipseNode.swift +143 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/PathNodes/PolygonNode.swift +173 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/PathNodes/RectNode.swift +238 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/PathNodes/ShapeNode.swift +73 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/PathNodes/StarNode.swift +224 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/RenderContainers/GroupNode.swift +162 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/RenderNodes/FillNode.swift +88 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/RenderNodes/GradientFillNode.swift +103 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/RenderNodes/GradientStrokeNode.swift +149 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/RenderNodes/StrokeNode.swift +179 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/Text/TextAnimatorNode.swift +345 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Protocols/AnimatorNode.swift +197 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Protocols/PathNode.swift +20 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Protocols/RenderNode.swift +60 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/RenderLayers/ShapeContainerLayer.swift +78 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/RenderLayers/ShapeRenderLayer.swift +98 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/Assets/Asset.swift +51 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/Assets/AssetLibrary.swift +75 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/Assets/ImageAsset.swift +141 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/Assets/PrecompAsset.swift +47 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/DictionaryInitializable.swift +73 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/DotLottie/DotLottieAnimation.swift +57 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/DotLottie/DotLottieImageProvider.swift +89 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/DotLottie/DotLottieManifest.swift +42 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/DotLottie/DotLottieUtils.swift +71 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/Extensions/Bundle.swift +58 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/Extensions/KeyedDecodingContainerExtensions.swift +71 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/Keyframes/KeyframeData.swift +111 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/Keyframes/KeyframeGroup.swift +265 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/LayerEffects/DropShadowEffect.swift +52 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/LayerEffects/EffectValues/ColorEffectValue.swift +45 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/LayerEffects/EffectValues/EffectValue.swift +98 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/LayerEffects/EffectValues/Vector1DEffectValue.swift +45 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/LayerEffects/LayerEffect.swift +103 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/LayerStyles/DropShadowStyle.swift +79 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/LayerStyles/LayerStyle.swift +85 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/Layers/ImageLayerModel.swift +49 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/Layers/LayerModel.swift +266 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/Layers/PreCompLayerModel.swift +74 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/Layers/ShapeLayerModel.swift +50 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/Layers/SolidLayerModel.swift +63 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/Layers/TextLayerModel.swift +65 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/Objects/DashPattern.swift +42 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/Objects/Marker.swift +35 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/Objects/Mask.swift +80 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/Objects/Transform.swift +261 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/Ellipse.swift +79 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/Fill.swift +79 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/GradientFill.swift +142 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/GradientStroke.swift +244 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/Group.swift +55 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/Merge.swift +63 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/Rectangle.swift +79 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/Repeater.swift +181 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/RoundedCorners.swift +53 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/Shape.swift +63 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/ShapeItem.swift +171 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/ShapeTransform.swift +202 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/Star.swift +136 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/Stroke.swift +144 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/Trim.swift +90 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/Text/Font.swift +67 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/Text/Glyph.swift +94 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/Text/TextAnimator.swift +240 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/Text/TextDocument.swift +142 -0
- package/platforms/macos/src/vendor/Lottie/Private/RootAnimationLayer.swift +54 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/Debugging/AnimatorNodeDebugging.swift +23 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/Debugging/LayerDebugging.swift +231 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/Debugging/TestHelpers.swift +10 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/Extensions/AnimationKeypathExtension.swift +303 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/Extensions/BlendMode+Filter.swift +31 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/Extensions/CGColor+RGB.swift +45 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/Extensions/CGFloatExtensions.swift +152 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/Extensions/DataExtension.swift +33 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/Extensions/MathKit.swift +454 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/Extensions/StringExtensions.swift +44 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/Helpers/AnimationContext.swift +95 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/Helpers/AnyEquatable.swift +23 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/Helpers/Binding+Map.swift +19 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/Helpers/View+ValueChanged.swift +35 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/Interpolatable/InterpolatableExtensions.swift +143 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/Interpolatable/KeyframeExtensions.swift +47 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/Interpolatable/KeyframeInterpolator.swift +250 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/LottieAnimationSource.swift +51 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/Primitives/BezierPath.swift +509 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/Primitives/BezierPathRoundExtension.swift +163 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/Primitives/CGPointExtension.swift +35 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/Primitives/ColorExtension.swift +101 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/Primitives/CompoundBezierPath.swift +169 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/Primitives/CurveVertex.swift +190 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/Primitives/PathElement.swift +78 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/Primitives/UnitBezier.swift +119 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/Primitives/VectorsExtensions.swift +368 -0
- package/platforms/macos/src/vendor/Lottie/Public/Animation/LottieAnimation.swift +179 -0
- package/platforms/macos/src/vendor/Lottie/Public/Animation/LottieAnimationHelpers.swift +317 -0
- package/platforms/macos/src/vendor/Lottie/Public/Animation/LottieAnimationLayer.swift +1582 -0
- package/platforms/macos/src/vendor/Lottie/Public/Animation/LottieAnimationView.swift +1090 -0
- package/platforms/macos/src/vendor/Lottie/Public/Animation/LottieAnimationViewInitializers.swift +226 -0
- package/platforms/macos/src/vendor/Lottie/Public/Animation/LottiePlaybackMode.swift +266 -0
- package/platforms/macos/src/vendor/Lottie/Public/Animation/LottieView.swift +643 -0
- package/platforms/macos/src/vendor/Lottie/Public/AnimationCache/AnimationCacheProvider.swift +21 -0
- package/platforms/macos/src/vendor/Lottie/Public/AnimationCache/DefaultAnimationCache.swift +67 -0
- package/platforms/macos/src/vendor/Lottie/Public/AnimationCache/LRUAnimationCache.swift +11 -0
- package/platforms/macos/src/vendor/Lottie/Public/AnimationCache/LottieAnimationCache.swift +15 -0
- package/platforms/macos/src/vendor/Lottie/Public/Configuration/DecodingStrategy.swift +15 -0
- package/platforms/macos/src/vendor/Lottie/Public/Configuration/LottieConfiguration.swift +54 -0
- package/platforms/macos/src/vendor/Lottie/Public/Configuration/LottieURLSession.swift +31 -0
- package/platforms/macos/src/vendor/Lottie/Public/Configuration/ReducedMotionOption.swift +128 -0
- package/platforms/macos/src/vendor/Lottie/Public/Configuration/RenderingEngineOption.swift +117 -0
- package/platforms/macos/src/vendor/Lottie/Public/Controls/AnimatedButton.swift +128 -0
- package/platforms/macos/src/vendor/Lottie/Public/Controls/AnimatedControl.swift +248 -0
- package/platforms/macos/src/vendor/Lottie/Public/Controls/AnimatedSwitch.swift +271 -0
- package/platforms/macos/src/vendor/Lottie/Public/Controls/LottieButton.swift +119 -0
- package/platforms/macos/src/vendor/Lottie/Public/Controls/LottieSwitch.swift +144 -0
- package/platforms/macos/src/vendor/Lottie/Public/Controls/LottieViewType.swift +79 -0
- package/platforms/macos/src/vendor/Lottie/Public/DotLottie/Cache/DotLottieCache.swift +66 -0
- package/platforms/macos/src/vendor/Lottie/Public/DotLottie/Cache/DotLottieCacheProvider.swift +21 -0
- package/platforms/macos/src/vendor/Lottie/Public/DotLottie/DotLottieConfiguration.swift +72 -0
- package/platforms/macos/src/vendor/Lottie/Public/DotLottie/DotLottieFile.swift +186 -0
- package/platforms/macos/src/vendor/Lottie/Public/DotLottie/DotLottieFileHelpers.swift +386 -0
- package/platforms/macos/src/vendor/Lottie/Public/DynamicProperties/AnimationKeypath.swift +57 -0
- package/platforms/macos/src/vendor/Lottie/Public/DynamicProperties/AnyValueProvider.swift +132 -0
- package/platforms/macos/src/vendor/Lottie/Public/DynamicProperties/ValueProviders/ColorValueProvider.swift +96 -0
- package/platforms/macos/src/vendor/Lottie/Public/DynamicProperties/ValueProviders/FloatValueProvider.swift +81 -0
- package/platforms/macos/src/vendor/Lottie/Public/DynamicProperties/ValueProviders/GradientValueProvider.swift +138 -0
- package/platforms/macos/src/vendor/Lottie/Public/DynamicProperties/ValueProviders/PointValueProvider.swift +81 -0
- package/platforms/macos/src/vendor/Lottie/Public/DynamicProperties/ValueProviders/SizeValueProvider.swift +81 -0
- package/platforms/macos/src/vendor/Lottie/Public/FontProvider/AnimationFontProvider.swift +41 -0
- package/platforms/macos/src/vendor/Lottie/Public/ImageProvider/AnimationImageProvider.swift +43 -0
- package/platforms/macos/src/vendor/Lottie/Public/Keyframes/Interpolatable.swift +285 -0
- package/platforms/macos/src/vendor/Lottie/Public/Keyframes/Keyframe.swift +98 -0
- package/platforms/macos/src/vendor/Lottie/Public/Logging/LottieLogger.swift +138 -0
- package/platforms/macos/src/vendor/Lottie/Public/Primitives/AnimationTime.swift +15 -0
- package/platforms/macos/src/vendor/Lottie/Public/Primitives/LottieColor.swift +43 -0
- package/platforms/macos/src/vendor/Lottie/Public/Primitives/Vectors.swift +36 -0
- package/platforms/macos/src/vendor/Lottie/Public/TextProvider/AnimationTextProvider.swift +135 -0
- package/platforms/macos/src/vendor/Lottie/Public/iOS/AnimationSubview.swift +19 -0
- package/platforms/macos/src/vendor/Lottie/Public/iOS/BundleImageProvider.swift +98 -0
- package/platforms/macos/src/vendor/Lottie/Public/iOS/Compatibility/CompatibleAnimationKeypath.swift +33 -0
- package/platforms/macos/src/vendor/Lottie/Public/iOS/Compatibility/CompatibleAnimationView.swift +567 -0
- package/platforms/macos/src/vendor/Lottie/Public/iOS/Compatibility/CompatibleFontProvider.swift +41 -0
- package/platforms/macos/src/vendor/Lottie/Public/iOS/Compatibility/CompatibleImageProvider.swift +43 -0
- package/platforms/macos/src/vendor/Lottie/Public/iOS/FilepathImageProvider.swift +78 -0
- package/platforms/macos/src/vendor/Lottie/Public/iOS/LottieAnimationViewBase.swift +85 -0
- package/platforms/macos/src/vendor/Lottie/Public/iOS/UIColorExtension.swift +23 -0
- package/platforms/macos/src/vendor/Lottie/Public/macOS/AnimationSubview.macOS.swift +19 -0
- package/platforms/macos/src/vendor/Lottie/Public/macOS/BundleImageProvider.macOS.swift +90 -0
- package/platforms/macos/src/vendor/Lottie/Public/macOS/FilepathImageProvider.macOS.swift +86 -0
- package/platforms/macos/src/vendor/Lottie/Public/macOS/LottieAnimationViewBase.macOS.swift +102 -0
- package/src/Lottie.macos.tsrx +129 -0
- package/src/Lottie.tsrx +6 -4
- package/src/Lottie.web.tsrx +28 -11
- package/src/index.macos.ts +2 -0
- package/src/props.ts +6 -1
- package/types/generated/props.d.ts +5 -1
package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/ShapeAnimation.swift
ADDED
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
// Created by Cal Stephens on 1/7/22.
|
|
2
|
+
// Copyright © 2022 Airbnb Inc. All rights reserved.
|
|
3
|
+
|
|
4
|
+
import QuartzCore
|
|
5
|
+
|
|
6
|
+
extension CAShapeLayer {
|
|
7
|
+
/// Adds a `path` animation for the given `ShapeItem`
|
|
8
|
+
@nonobjc
|
|
9
|
+
func addAnimations(
|
|
10
|
+
for shape: ShapeItem,
|
|
11
|
+
context: LayerAnimationContext,
|
|
12
|
+
pathMultiplier: PathMultiplier,
|
|
13
|
+
roundedCorners: RoundedCorners?
|
|
14
|
+
) throws {
|
|
15
|
+
switch shape {
|
|
16
|
+
case let customShape as Shape:
|
|
17
|
+
try addAnimations(
|
|
18
|
+
for: customShape.path,
|
|
19
|
+
context: context,
|
|
20
|
+
pathMultiplier: pathMultiplier,
|
|
21
|
+
roundedCorners: roundedCorners
|
|
22
|
+
)
|
|
23
|
+
|
|
24
|
+
case let combinedShape as CombinedShapeItem:
|
|
25
|
+
try addAnimations(for: combinedShape, context: context, pathMultiplier: pathMultiplier)
|
|
26
|
+
try context.compatibilityAssert(roundedCorners == nil, """
|
|
27
|
+
Rounded corners support is not currently implemented for combined shape items
|
|
28
|
+
""")
|
|
29
|
+
|
|
30
|
+
case let ellipse as Ellipse:
|
|
31
|
+
try addAnimations(for: ellipse, context: context, pathMultiplier: pathMultiplier)
|
|
32
|
+
|
|
33
|
+
case let rectangle as Rectangle:
|
|
34
|
+
try addAnimations(
|
|
35
|
+
for: rectangle,
|
|
36
|
+
context: context,
|
|
37
|
+
pathMultiplier: pathMultiplier,
|
|
38
|
+
roundedCorners: roundedCorners
|
|
39
|
+
)
|
|
40
|
+
|
|
41
|
+
case let star as Star:
|
|
42
|
+
try addAnimations(for: star, context: context, pathMultiplier: pathMultiplier)
|
|
43
|
+
try context.compatibilityAssert(roundedCorners == nil, """
|
|
44
|
+
Rounded corners support is currently not implemented for polygon items
|
|
45
|
+
""")
|
|
46
|
+
|
|
47
|
+
default:
|
|
48
|
+
// None of the other `ShapeItem` subclasses draw a `path`
|
|
49
|
+
try context.logCompatibilityIssue("Unexpected shape type \(type(of: shape))")
|
|
50
|
+
return
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/// Adds a `fillColor` animation for the given `Fill` object
|
|
55
|
+
@nonobjc
|
|
56
|
+
func addAnimations(for fill: Fill, context: LayerAnimationContext) throws {
|
|
57
|
+
fillRule = fill.fillRule.caFillRule
|
|
58
|
+
|
|
59
|
+
try addAnimation(
|
|
60
|
+
for: .fillColor,
|
|
61
|
+
keyframes: fill.color,
|
|
62
|
+
value: \.cgColorValue,
|
|
63
|
+
context: context
|
|
64
|
+
)
|
|
65
|
+
|
|
66
|
+
try addOpacityAnimation(for: fill, context: context)
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/// Adds animations for `strokeStart` and `strokeEnd` from the given `Trim` object
|
|
70
|
+
@nonobjc
|
|
71
|
+
func addAnimations(for trim: Trim, context: LayerAnimationContext) throws -> PathMultiplier {
|
|
72
|
+
let (strokeStartKeyframes, strokeEndKeyframes, pathMultiplier) = try trim.caShapeLayerKeyframes()
|
|
73
|
+
|
|
74
|
+
try addAnimation(
|
|
75
|
+
for: .strokeStart,
|
|
76
|
+
keyframes: strokeStartKeyframes,
|
|
77
|
+
value: { strokeStart in
|
|
78
|
+
// Lottie animation files express stoke trims as a numerical percentage value
|
|
79
|
+
// (e.g. 25%, 50%, 100%) so we divide by 100 to get the decimal values
|
|
80
|
+
// expected by Core Animation (e.g. 0.25, 0.5, 1.0).
|
|
81
|
+
CGFloat(strokeStart.cgFloatValue) / CGFloat(pathMultiplier) / 100
|
|
82
|
+
},
|
|
83
|
+
context: context
|
|
84
|
+
)
|
|
85
|
+
|
|
86
|
+
try addAnimation(
|
|
87
|
+
for: .strokeEnd,
|
|
88
|
+
keyframes: strokeEndKeyframes,
|
|
89
|
+
value: { strokeEnd in
|
|
90
|
+
// Lottie animation files express stoke trims as a numerical percentage value
|
|
91
|
+
// (e.g. 25%, 50%, 100%) so we divide by 100 to get the decimal values
|
|
92
|
+
// expected by Core Animation (e.g. 0.25, 0.5, 1.0).
|
|
93
|
+
CGFloat(strokeEnd.cgFloatValue) / CGFloat(pathMultiplier) / 100
|
|
94
|
+
},
|
|
95
|
+
context: context
|
|
96
|
+
)
|
|
97
|
+
|
|
98
|
+
return pathMultiplier
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/// The number of times that a `CGPath` needs to be duplicated in order to support the animation's `Trim` keyframes
|
|
103
|
+
typealias PathMultiplier = Int
|
|
104
|
+
|
|
105
|
+
extension Trim {
|
|
106
|
+
|
|
107
|
+
// MARK: Fileprivate
|
|
108
|
+
|
|
109
|
+
/// The `strokeStart` and `strokeEnd` keyframes to apply to a `CAShapeLayer`,
|
|
110
|
+
/// plus a `pathMultiplier` that should be applied to the layer's `path` so that
|
|
111
|
+
/// trim values larger than 100% can be displayed properly.
|
|
112
|
+
fileprivate func caShapeLayerKeyframes()
|
|
113
|
+
throws
|
|
114
|
+
-> (strokeStart: KeyframeGroup<LottieVector1D>, strokeEnd: KeyframeGroup<LottieVector1D>, pathMultiplier: PathMultiplier)
|
|
115
|
+
{
|
|
116
|
+
let strokeStart: KeyframeGroup<LottieVector1D>
|
|
117
|
+
let strokeEnd: KeyframeGroup<LottieVector1D>
|
|
118
|
+
|
|
119
|
+
// CAShapeLayer requires strokeStart to be less than strokeEnd. This
|
|
120
|
+
// isn't required by the Lottie schema, so some animations may have
|
|
121
|
+
// strokeStart and strokeEnd flipped.
|
|
122
|
+
if startValueIsAlwaysLessOrEqualToThanEndValue() {
|
|
123
|
+
// If the start value is always _less than_ or equal to the end value
|
|
124
|
+
// then we can use the given values without any modifications
|
|
125
|
+
strokeStart = start
|
|
126
|
+
strokeEnd = end
|
|
127
|
+
} else if startValueIsAlwaysGreaterThanOrEqualToEndValue() {
|
|
128
|
+
// If the start value is always _greater than_ or equal to the end value,
|
|
129
|
+
// then we can just swap the start / end keyframes. This lets us avoid
|
|
130
|
+
// manually interpolating the keyframes values at each frame, which
|
|
131
|
+
// would be more expensive.
|
|
132
|
+
strokeStart = end
|
|
133
|
+
strokeEnd = start
|
|
134
|
+
} else {
|
|
135
|
+
// Otherwise if the start / end values ever swap places we have to
|
|
136
|
+
// fix the order on a per-keyframe basis, which may require manually
|
|
137
|
+
// interpolating the keyframe values at each frame.
|
|
138
|
+
(strokeStart, strokeEnd) = interpolatedAtEachFrame()
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
// If there are no offsets, then the stroke values can be used as-is
|
|
142
|
+
guard
|
|
143
|
+
!offset.keyframes.isEmpty,
|
|
144
|
+
offset.keyframes.contains(where: { $0.value.cgFloatValue != 0 })
|
|
145
|
+
else {
|
|
146
|
+
return (strokeStart, strokeEnd, 1)
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
// Apply the offset to the start / end values at each frame
|
|
150
|
+
let offsetStrokeKeyframes = Keyframes.combined(
|
|
151
|
+
strokeStart,
|
|
152
|
+
strokeEnd,
|
|
153
|
+
offset,
|
|
154
|
+
makeCombinedResult: { start, end, offset -> (start: LottieVector1D, end: LottieVector1D) in
|
|
155
|
+
// Compute the adjusted value by converting the offset value to a stroke value
|
|
156
|
+
let offsetStart = start.cgFloatValue + (offset.cgFloatValue / 360 * 100)
|
|
157
|
+
let offsetEnd = end.cgFloatValue + (offset.cgFloatValue / 360 * 100)
|
|
158
|
+
return (start: LottieVector1D(offsetStart), end: LottieVector1D(offsetEnd))
|
|
159
|
+
}
|
|
160
|
+
)
|
|
161
|
+
|
|
162
|
+
var adjustedStrokeStart = offsetStrokeKeyframes.map { $0.start }
|
|
163
|
+
var adjustedStrokeEnd = offsetStrokeKeyframes.map { $0.end }
|
|
164
|
+
|
|
165
|
+
// If maximum stroke value is larger than 100%, then we have to create copies of the path
|
|
166
|
+
// so the total path length includes the maximum stroke
|
|
167
|
+
let startStrokes = adjustedStrokeStart.keyframes.map { $0.value.cgFloatValue }
|
|
168
|
+
let endStrokes = adjustedStrokeEnd.keyframes.map { $0.value.cgFloatValue }
|
|
169
|
+
let minimumStrokeMultiplier = Double(floor((startStrokes.min() ?? 0) / 100.0))
|
|
170
|
+
let maximumStrokeMultiplier = Double(ceil((endStrokes.max() ?? 100) / 100.0))
|
|
171
|
+
|
|
172
|
+
if minimumStrokeMultiplier < 0 {
|
|
173
|
+
// Core Animation doesn't support negative stroke offsets, so we have to
|
|
174
|
+
// shift all of the offset values up by the minimum
|
|
175
|
+
adjustedStrokeStart = adjustedStrokeStart.map { LottieVector1D($0.value + (abs(minimumStrokeMultiplier) * 100.0)) }
|
|
176
|
+
adjustedStrokeEnd = adjustedStrokeEnd.map { LottieVector1D($0.value + (abs(minimumStrokeMultiplier) * 100.0)) }
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
return (
|
|
180
|
+
strokeStart: adjustedStrokeStart,
|
|
181
|
+
strokeEnd: adjustedStrokeEnd,
|
|
182
|
+
pathMultiplier: Int(abs(maximumStrokeMultiplier) + abs(minimumStrokeMultiplier))
|
|
183
|
+
)
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
// MARK: Private
|
|
187
|
+
|
|
188
|
+
/// Checks whether or not the value for `trim.start` is less than
|
|
189
|
+
/// or equal to the value for every `trim.end` at every frame.
|
|
190
|
+
private func startValueIsAlwaysLessOrEqualToThanEndValue() -> Bool {
|
|
191
|
+
startAndEndValuesAllSatisfy { startValue, endValue in
|
|
192
|
+
startValue <= endValue
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
/// Checks whether or not the value for `trim.start` is greater than
|
|
197
|
+
/// or equal to the value for every `trim.end` at every frame.
|
|
198
|
+
private func startValueIsAlwaysGreaterThanOrEqualToEndValue() -> Bool {
|
|
199
|
+
startAndEndValuesAllSatisfy { startValue, endValue in
|
|
200
|
+
startValue >= endValue
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
private func startAndEndValuesAllSatisfy(_ condition: (_ start: CGFloat, _ end: CGFloat) -> Bool) -> Bool {
|
|
205
|
+
let keyframeTimes = Set(start.keyframes.map { $0.time } + end.keyframes.map { $0.time })
|
|
206
|
+
|
|
207
|
+
let startInterpolator = KeyframeInterpolator(keyframes: start.keyframes)
|
|
208
|
+
let endInterpolator = KeyframeInterpolator(keyframes: end.keyframes)
|
|
209
|
+
|
|
210
|
+
for keyframeTime in keyframeTimes {
|
|
211
|
+
guard
|
|
212
|
+
let startAtTime = startInterpolator.value(frame: keyframeTime) as? LottieVector1D,
|
|
213
|
+
let endAtTime = endInterpolator.value(frame: keyframeTime) as? LottieVector1D
|
|
214
|
+
else { continue }
|
|
215
|
+
|
|
216
|
+
if !condition(startAtTime.cgFloatValue, endAtTime.cgFloatValue) {
|
|
217
|
+
return false
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
return true
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
/// Interpolates the start and end keyframes, at each frame if necessary,
|
|
225
|
+
/// so that the value of `strokeStart` is always less than `strokeEnd`.
|
|
226
|
+
private func interpolatedAtEachFrame()
|
|
227
|
+
-> (strokeStart: KeyframeGroup<LottieVector1D>, strokeEnd: KeyframeGroup<LottieVector1D>)
|
|
228
|
+
{
|
|
229
|
+
let combinedKeyframes = Keyframes.combined(
|
|
230
|
+
start,
|
|
231
|
+
end,
|
|
232
|
+
makeCombinedResult: { startValue, endValue -> (start: LottieVector1D, end: LottieVector1D) in
|
|
233
|
+
if startValue.cgFloatValue < endValue.cgFloatValue {
|
|
234
|
+
return (start: startValue, end: endValue)
|
|
235
|
+
} else {
|
|
236
|
+
return (start: endValue, end: startValue)
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
)
|
|
240
|
+
|
|
241
|
+
return (
|
|
242
|
+
strokeStart: combinedKeyframes.map { $0.start },
|
|
243
|
+
strokeEnd: combinedKeyframes.map { $0.end }
|
|
244
|
+
)
|
|
245
|
+
}
|
|
246
|
+
}
|
package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/StarAnimation.swift
ADDED
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
// Created by Cal Stephens on 1/10/22.
|
|
2
|
+
// Copyright © 2022 Airbnb Inc. All rights reserved.
|
|
3
|
+
|
|
4
|
+
import QuartzCore
|
|
5
|
+
|
|
6
|
+
extension CAShapeLayer {
|
|
7
|
+
|
|
8
|
+
// MARK: Internal
|
|
9
|
+
|
|
10
|
+
/// Adds animations for the given `Rectangle` to this `CALayer`
|
|
11
|
+
@nonobjc
|
|
12
|
+
func addAnimations(
|
|
13
|
+
for star: Star,
|
|
14
|
+
context: LayerAnimationContext,
|
|
15
|
+
pathMultiplier: PathMultiplier
|
|
16
|
+
) throws {
|
|
17
|
+
switch star.starType {
|
|
18
|
+
case .star:
|
|
19
|
+
try addStarAnimation(for: star, context: context, pathMultiplier: pathMultiplier)
|
|
20
|
+
case .polygon:
|
|
21
|
+
try addPolygonAnimation(for: star, context: context, pathMultiplier: pathMultiplier)
|
|
22
|
+
case .none:
|
|
23
|
+
break
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// MARK: Private
|
|
28
|
+
|
|
29
|
+
@nonobjc
|
|
30
|
+
private func addStarAnimation(
|
|
31
|
+
for star: Star,
|
|
32
|
+
context: LayerAnimationContext,
|
|
33
|
+
pathMultiplier: PathMultiplier
|
|
34
|
+
) throws {
|
|
35
|
+
try addAnimation(
|
|
36
|
+
for: .path,
|
|
37
|
+
keyframes: try star.combinedKeyframes(),
|
|
38
|
+
value: { keyframe in
|
|
39
|
+
BezierPath.star(
|
|
40
|
+
position: keyframe.position.pointValue,
|
|
41
|
+
outerRadius: keyframe.outerRadius.cgFloatValue,
|
|
42
|
+
innerRadius: keyframe.innerRadius.cgFloatValue,
|
|
43
|
+
outerRoundedness: keyframe.outerRoundness.cgFloatValue,
|
|
44
|
+
innerRoundedness: keyframe.innerRoundness.cgFloatValue,
|
|
45
|
+
numberOfPoints: keyframe.points.cgFloatValue,
|
|
46
|
+
rotation: keyframe.rotation.cgFloatValue,
|
|
47
|
+
direction: star.direction
|
|
48
|
+
)
|
|
49
|
+
.cgPath()
|
|
50
|
+
.duplicated(times: pathMultiplier)
|
|
51
|
+
},
|
|
52
|
+
context: context
|
|
53
|
+
)
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
@nonobjc
|
|
57
|
+
private func addPolygonAnimation(
|
|
58
|
+
for star: Star,
|
|
59
|
+
context: LayerAnimationContext,
|
|
60
|
+
pathMultiplier: PathMultiplier
|
|
61
|
+
) throws {
|
|
62
|
+
try addAnimation(
|
|
63
|
+
for: .path,
|
|
64
|
+
keyframes: try star.combinedKeyframes(),
|
|
65
|
+
value: { keyframe in
|
|
66
|
+
BezierPath.polygon(
|
|
67
|
+
position: keyframe.position.pointValue,
|
|
68
|
+
numberOfPoints: keyframe.points.cgFloatValue,
|
|
69
|
+
outerRadius: keyframe.outerRadius.cgFloatValue,
|
|
70
|
+
outerRoundedness: keyframe.outerRoundness.cgFloatValue,
|
|
71
|
+
rotation: keyframe.rotation.cgFloatValue,
|
|
72
|
+
direction: star.direction
|
|
73
|
+
)
|
|
74
|
+
.cgPath()
|
|
75
|
+
.duplicated(times: pathMultiplier)
|
|
76
|
+
},
|
|
77
|
+
context: context
|
|
78
|
+
)
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
extension Star {
|
|
83
|
+
/// Data that represents how to render a star at a specific point in time
|
|
84
|
+
struct Keyframe: Interpolatable {
|
|
85
|
+
let position: LottieVector3D
|
|
86
|
+
let outerRadius: LottieVector1D
|
|
87
|
+
let innerRadius: LottieVector1D
|
|
88
|
+
let outerRoundness: LottieVector1D
|
|
89
|
+
let innerRoundness: LottieVector1D
|
|
90
|
+
let points: LottieVector1D
|
|
91
|
+
let rotation: LottieVector1D
|
|
92
|
+
|
|
93
|
+
func interpolate(to: Star.Keyframe, amount: CGFloat) -> Star.Keyframe {
|
|
94
|
+
Star.Keyframe(
|
|
95
|
+
position: position.interpolate(to: to.position, amount: amount),
|
|
96
|
+
outerRadius: outerRadius.interpolate(to: to.outerRadius, amount: amount),
|
|
97
|
+
innerRadius: innerRadius.interpolate(to: to.innerRadius, amount: amount),
|
|
98
|
+
outerRoundness: outerRoundness.interpolate(to: to.outerRoundness, amount: amount),
|
|
99
|
+
innerRoundness: innerRoundness.interpolate(to: to.innerRoundness, amount: amount),
|
|
100
|
+
points: points.interpolate(to: to.points, amount: amount),
|
|
101
|
+
rotation: rotation.interpolate(to: to.rotation, amount: amount)
|
|
102
|
+
)
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/// Creates a single array of animatable keyframes from the separate arrays of keyframes in this star/polygon
|
|
107
|
+
func combinedKeyframes() throws -> KeyframeGroup<Keyframe> {
|
|
108
|
+
Keyframes.combined(
|
|
109
|
+
position,
|
|
110
|
+
outerRadius,
|
|
111
|
+
innerRadius ?? KeyframeGroup(LottieVector1D(0)),
|
|
112
|
+
outerRoundness,
|
|
113
|
+
innerRoundness ?? KeyframeGroup(LottieVector1D(0)),
|
|
114
|
+
points,
|
|
115
|
+
rotation,
|
|
116
|
+
makeCombinedResult: Star.Keyframe.init
|
|
117
|
+
)
|
|
118
|
+
}
|
|
119
|
+
}
|
package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/StrokeAnimation.swift
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
// Created by Cal Stephens on 2/10/22.
|
|
2
|
+
// Copyright © 2022 Airbnb Inc. All rights reserved.
|
|
3
|
+
|
|
4
|
+
import QuartzCore
|
|
5
|
+
|
|
6
|
+
// MARK: - StrokeShapeItem
|
|
7
|
+
|
|
8
|
+
/// A `ShapeItem` that represents a stroke
|
|
9
|
+
protocol StrokeShapeItem: ShapeItem, OpacityAnimationModel {
|
|
10
|
+
var strokeColor: KeyframeGroup<LottieColor>? { get }
|
|
11
|
+
var width: KeyframeGroup<LottieVector1D> { get }
|
|
12
|
+
var lineCap: LineCap { get }
|
|
13
|
+
var lineJoin: LineJoin { get }
|
|
14
|
+
var miterLimit: Double { get }
|
|
15
|
+
var dashPattern: [DashElement]? { get }
|
|
16
|
+
|
|
17
|
+
func copy(width: KeyframeGroup<LottieVector1D>) -> StrokeShapeItem
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// MARK: - Stroke + StrokeShapeItem
|
|
21
|
+
|
|
22
|
+
extension Stroke: StrokeShapeItem {
|
|
23
|
+
var strokeColor: KeyframeGroup<LottieColor>? {
|
|
24
|
+
color
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
func copy(width: KeyframeGroup<LottieVector1D>) -> StrokeShapeItem {
|
|
28
|
+
// Type-erase the copy from `Stroke` to `StrokeShapeItem`
|
|
29
|
+
// swiftformat:disable:next redundantProperty
|
|
30
|
+
let copy: Stroke = copy(width: width)
|
|
31
|
+
return copy
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// MARK: - GradientStroke + StrokeShapeItem
|
|
36
|
+
|
|
37
|
+
extension GradientStroke: StrokeShapeItem {
|
|
38
|
+
var strokeColor: KeyframeGroup<LottieColor>? {
|
|
39
|
+
nil
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
func copy(width: KeyframeGroup<LottieVector1D>) -> StrokeShapeItem {
|
|
43
|
+
// Type-erase the copy from `GradientStroke` to `StrokeShapeItem`
|
|
44
|
+
// swiftformat:disable:next redundantProperty
|
|
45
|
+
let copy: GradientStroke = copy(width: width)
|
|
46
|
+
return copy
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// MARK: - CAShapeLayer + StrokeShapeItem
|
|
51
|
+
|
|
52
|
+
extension CAShapeLayer {
|
|
53
|
+
/// Adds animations for properties related to the given `Stroke` object (`strokeColor`, `lineWidth`, etc)
|
|
54
|
+
@nonobjc
|
|
55
|
+
func addStrokeAnimations(for stroke: StrokeShapeItem, context: LayerAnimationContext) throws {
|
|
56
|
+
lineJoin = stroke.lineJoin.caLineJoin
|
|
57
|
+
lineCap = stroke.lineCap.caLineCap
|
|
58
|
+
miterLimit = CGFloat(stroke.miterLimit)
|
|
59
|
+
|
|
60
|
+
if let strokeColor = stroke.strokeColor {
|
|
61
|
+
try addAnimation(
|
|
62
|
+
for: .strokeColor,
|
|
63
|
+
keyframes: strokeColor,
|
|
64
|
+
value: \.cgColorValue,
|
|
65
|
+
context: context
|
|
66
|
+
)
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
try addAnimation(
|
|
70
|
+
for: .lineWidth,
|
|
71
|
+
keyframes: stroke.width,
|
|
72
|
+
value: \.cgFloatValue,
|
|
73
|
+
context: context
|
|
74
|
+
)
|
|
75
|
+
|
|
76
|
+
try addOpacityAnimation(for: stroke, context: context)
|
|
77
|
+
|
|
78
|
+
if let (dashPattern, dashPhase) = stroke.dashPattern?.shapeLayerConfiguration {
|
|
79
|
+
let lineDashPattern = try dashPattern.map {
|
|
80
|
+
try KeyframeGroup(keyframes: $0)
|
|
81
|
+
.exactlyOneKeyframe(context: context, description: "stroke dashPattern").cgFloatValue
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
if lineDashPattern.isSupportedLayerDashPattern {
|
|
85
|
+
self.lineDashPattern = lineDashPattern as [NSNumber]
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
try addAnimation(
|
|
89
|
+
for: .lineDashPhase,
|
|
90
|
+
keyframes: KeyframeGroup(keyframes: dashPhase),
|
|
91
|
+
value: \.cgFloatValue,
|
|
92
|
+
context: context
|
|
93
|
+
)
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|