@octane-xplat/lottie 0.9.0 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +36 -16
- package/dist/native/index.js +10 -9
- package/dist/native/octane-client-build.json +1 -1
- package/dist/web/index.js +39 -25
- package/dist/web/octane-client-build.json +1 -1
- package/package.json +25 -3
- package/platforms/macos/LICENSE-EpoxyCore-Apache-2.0.txt +201 -0
- package/platforms/macos/LICENSE-LRUCache-MIT.txt +22 -0
- package/platforms/macos/LICENSE-Lottie-Apache-2.0.txt +201 -0
- package/platforms/macos/LICENSE-ZIPFoundation-MIT.txt +21 -0
- package/platforms/macos/UPSTREAM.md +13 -0
- package/platforms/macos/resources/PrivacyInfo.xcprivacy +23 -0
- package/platforms/macos/resources/THIRD-PARTY-NOTICES.txt +10 -0
- package/platforms/macos/src/XplatAppKitLottie.swift +246 -0
- package/platforms/macos/src/vendor/Lottie/PrivacyInfo.xcprivacy +23 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/CAAnimation+TimingConfiguration.swift +81 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/CALayer+addAnimation.swift +476 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/CombinedShapeAnimation.swift +92 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/CustomPathAnimation.swift +89 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/DropShadowAnimation.swift +179 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/EllipseAnimation.swift +53 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/GradientAnimations.swift +287 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/LayerProperty.swift +440 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/OpacityAnimation.swift +53 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/RectangleAnimation.swift +59 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/ShapeAnimation.swift +246 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/StarAnimation.swift +119 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/StrokeAnimation.swift +96 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/TransformAnimations.swift +380 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Animations/VisibilityAnimation.swift +63 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/CompatibilityTracker.swift +129 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/CoreAnimationLayer.swift +645 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Extensions/CALayer+fillBounds.swift +35 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Extensions/KeyframeGroup+exactlyOneKeyframe.swift +28 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Extensions/Keyframes+combined.swift +345 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Extensions/Keyframes+timeRemapping.swift +46 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/AnimationLayer.swift +169 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/BaseAnimationLayer.swift +46 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/BaseCompositionLayer.swift +120 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/CALayer+setupLayerHierarchy.swift +169 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/GradientRenderLayer.swift +101 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/ImageLayer.swift +81 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/InfiniteOpaqueAnimationLayer.swift +57 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/LayerModel+makeAnimationLayer.swift +59 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/MaskCompositionLayer.swift +139 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/PreCompLayer.swift +107 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/RepeaterLayer.swift +113 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/ShapeItemLayer.swift +346 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/ShapeLayer.swift +569 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/SolidLayer.swift +66 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/TextLayer.swift +157 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/TransformLayer.swift +13 -0
- package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/ValueProviderStore.swift +157 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Diffing/Collection+Diff.swift +267 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Diffing/Diffable.swift +19 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Diffing/DiffableSection.swift +16 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Diffing/IndexChangeset.swift +187 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Diffing/SectionedChangeset.swift +22 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Logging/EpoxyLogger.swift +102 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/CallbackContextEpoxyModeled.swift +8 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/EpoxyModelArrayBuilder.swift +48 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/EpoxyModelProperty.swift +158 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/EpoxyModelStorage.swift +88 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/EpoxyModeled.swift +54 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Internal/AnyEpoxyModelProperty.swift +31 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Internal/ClassReference.swift +39 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/AnimatedProviding.swift +10 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/DataIDProviding.swift +58 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/DidDisplayProviding.swift +41 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/DidEndDisplayingProviding.swift +42 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/DidSelectProviding.swift +36 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/ErasedContentProviding.swift +49 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/MakeViewProviding.swift +61 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/SetBehaviorsProviding.swift +38 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/SetContentProviding.swift +38 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/StyleIDProviding.swift +38 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/TraitCollectionProviding.swift +14 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/ViewDifferentiatorProviding.swift +34 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/ViewProviding.swift +13 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/Providers/WillDisplayProviding.swift +41 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Model/ViewEpoxyModeled.swift +10 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/README.md +30 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/EpoxySwiftUIIntrinsicContentSizeInvalidator.swift +34 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/EpoxySwiftUILayoutMargins.swift +38 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/EpoxyableView+SwiftUIView.swift +165 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/LayoutUtilities/MeasuringViewRepresentable.swift +127 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/LayoutUtilities/SwiftUIMeasurementContainer.swift +468 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/SwiftUIView.swift +146 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/UIView+SwiftUIView.swift +39 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/SwiftUI/UIViewConfiguringSwiftUIView.swift +41 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Views/BehaviorsConfigurableView.swift +45 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Views/ContentConfigurableView.swift +36 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Views/EpoxyableView.swift +5 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Views/StyledView.swift +43 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/EpoxyCore/Views/ViewType.swift +47 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/LRUCache/LRUCache.swift +257 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/LRUCache/README.md +24 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/README.md +43 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Archive+BackingConfiguration.swift +149 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Archive+Deprecated.swift +23 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Archive+Helpers.swift +361 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Archive+MemoryFile.swift +205 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Archive+Progress.swift +66 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Archive+Reading.swift +160 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Archive+ReadingDeprecated.swift +50 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Archive+Writing.swift +403 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Archive+WritingDeprecated.swift +95 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Archive+ZIP64.swift +191 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Archive.swift +404 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Data+Compression.swift +632 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Data+CompressionDeprecated.swift +43 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Data+Serialization.swift +146 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Date+ZIP.swift +101 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Entry+Serialization.swift +191 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Entry+ZIP64.swift +170 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/Entry.swift +669 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/FileManager+ZIP.swift +405 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/FileManager+ZIPDeprecated.swift +28 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/README.md +24 -0
- package/platforms/macos/src/vendor/Lottie/Private/EmbeddedLibraries/ZipFoundation/URL+ZIP.swift +34 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/CompLayers/CompositionLayer.swift +177 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/CompLayers/ImageCompositionLayer.swift +54 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/CompLayers/MaskContainerLayer.swift +191 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/CompLayers/NullCompositionLayer.swift +28 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/CompLayers/PreCompositionLayer.swift +137 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/CompLayers/ShapeCompositionLayer.swift +60 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/CompLayers/SolidCompositionLayer.swift +57 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/CompLayers/TextCompositionLayer.swift +247 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/MainThreadAnimationLayer.swift +321 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/Utility/CachedImageProvider.swift +56 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/Utility/CompositionLayersInitializer.swift +103 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/Utility/CoreTextRenderLayer.swift +424 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/Utility/InvertedMatteLayer.swift +55 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/Utility/LayerFontProvider.swift +39 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/Utility/LayerImageProvider.swift +52 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/Utility/LayerTextProvider.swift +38 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/LayerContainers/Utility/LayerTransformNode.swift +149 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Extensions/ItemsExtension.swift +146 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/NodeProperties/NodeProperty.swift +62 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/NodeProperties/Protocols/AnyNodeProperty.swift +53 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/NodeProperties/Protocols/AnyValueContainer.swift +26 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/NodeProperties/Protocols/KeypathSearchable.swift +23 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/NodeProperties/Protocols/NodePropertyMap.swift +43 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/NodeProperties/ValueContainer.swift +47 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/NodeProperties/ValueProviders/GroupInterpolator.swift +39 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/NodeProperties/ValueProviders/SingleValueProvider.swift +43 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/LayerEffectNodes/DropShadowNode.swift +102 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/LayerEffectNodes/LayerEffectNode.swift +25 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/ModifierNodes/RoundedCornersNode.swift +85 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/ModifierNodes/TrimPathNode.swift +281 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/OutputNodes/GroupOutputNode.swift +74 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/OutputNodes/PassThroughOutputNode.swift +47 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/OutputNodes/PathOutputNode.swift +89 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/OutputNodes/Renderables/FillRenderer.swift +69 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/OutputNodes/Renderables/GradientFillRenderer.swift +253 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/OutputNodes/Renderables/GradientStrokeRenderer.swift +64 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/OutputNodes/Renderables/LegacyGradientFillRenderer.swift +158 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/OutputNodes/Renderables/StrokeRenderer.swift +165 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/PathNodes/EllipseNode.swift +143 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/PathNodes/PolygonNode.swift +173 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/PathNodes/RectNode.swift +238 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/PathNodes/ShapeNode.swift +73 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/PathNodes/StarNode.swift +224 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/RenderContainers/GroupNode.swift +162 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/RenderNodes/FillNode.swift +88 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/RenderNodes/GradientFillNode.swift +103 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/RenderNodes/GradientStrokeNode.swift +149 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/RenderNodes/StrokeNode.swift +179 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Nodes/Text/TextAnimatorNode.swift +345 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Protocols/AnimatorNode.swift +197 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Protocols/PathNode.swift +20 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/Protocols/RenderNode.swift +60 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/RenderLayers/ShapeContainerLayer.swift +78 -0
- package/platforms/macos/src/vendor/Lottie/Private/MainThread/NodeRenderSystem/RenderLayers/ShapeRenderLayer.swift +98 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/Assets/Asset.swift +51 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/Assets/AssetLibrary.swift +75 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/Assets/ImageAsset.swift +141 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/Assets/PrecompAsset.swift +47 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/DictionaryInitializable.swift +73 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/DotLottie/DotLottieAnimation.swift +57 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/DotLottie/DotLottieImageProvider.swift +89 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/DotLottie/DotLottieManifest.swift +42 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/DotLottie/DotLottieUtils.swift +71 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/Extensions/Bundle.swift +58 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/Extensions/KeyedDecodingContainerExtensions.swift +71 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/Keyframes/KeyframeData.swift +111 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/Keyframes/KeyframeGroup.swift +265 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/LayerEffects/DropShadowEffect.swift +52 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/LayerEffects/EffectValues/ColorEffectValue.swift +45 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/LayerEffects/EffectValues/EffectValue.swift +98 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/LayerEffects/EffectValues/Vector1DEffectValue.swift +45 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/LayerEffects/LayerEffect.swift +103 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/LayerStyles/DropShadowStyle.swift +79 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/LayerStyles/LayerStyle.swift +85 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/Layers/ImageLayerModel.swift +49 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/Layers/LayerModel.swift +266 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/Layers/PreCompLayerModel.swift +74 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/Layers/ShapeLayerModel.swift +50 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/Layers/SolidLayerModel.swift +63 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/Layers/TextLayerModel.swift +65 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/Objects/DashPattern.swift +42 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/Objects/Marker.swift +35 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/Objects/Mask.swift +80 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/Objects/Transform.swift +261 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/Ellipse.swift +79 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/Fill.swift +79 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/GradientFill.swift +142 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/GradientStroke.swift +244 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/Group.swift +55 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/Merge.swift +63 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/Rectangle.swift +79 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/Repeater.swift +181 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/RoundedCorners.swift +53 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/Shape.swift +63 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/ShapeItem.swift +171 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/ShapeTransform.swift +202 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/Star.swift +136 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/Stroke.swift +144 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/ShapeItems/Trim.swift +90 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/Text/Font.swift +67 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/Text/Glyph.swift +94 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/Text/TextAnimator.swift +240 -0
- package/platforms/macos/src/vendor/Lottie/Private/Model/Text/TextDocument.swift +142 -0
- package/platforms/macos/src/vendor/Lottie/Private/RootAnimationLayer.swift +54 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/Debugging/AnimatorNodeDebugging.swift +23 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/Debugging/LayerDebugging.swift +231 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/Debugging/TestHelpers.swift +10 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/Extensions/AnimationKeypathExtension.swift +303 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/Extensions/BlendMode+Filter.swift +31 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/Extensions/CGColor+RGB.swift +45 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/Extensions/CGFloatExtensions.swift +152 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/Extensions/DataExtension.swift +33 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/Extensions/MathKit.swift +454 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/Extensions/StringExtensions.swift +44 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/Helpers/AnimationContext.swift +95 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/Helpers/AnyEquatable.swift +23 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/Helpers/Binding+Map.swift +19 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/Helpers/View+ValueChanged.swift +35 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/Interpolatable/InterpolatableExtensions.swift +143 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/Interpolatable/KeyframeExtensions.swift +47 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/Interpolatable/KeyframeInterpolator.swift +250 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/LottieAnimationSource.swift +51 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/Primitives/BezierPath.swift +509 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/Primitives/BezierPathRoundExtension.swift +163 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/Primitives/CGPointExtension.swift +35 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/Primitives/ColorExtension.swift +101 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/Primitives/CompoundBezierPath.swift +169 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/Primitives/CurveVertex.swift +190 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/Primitives/PathElement.swift +78 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/Primitives/UnitBezier.swift +119 -0
- package/platforms/macos/src/vendor/Lottie/Private/Utility/Primitives/VectorsExtensions.swift +368 -0
- package/platforms/macos/src/vendor/Lottie/Public/Animation/LottieAnimation.swift +179 -0
- package/platforms/macos/src/vendor/Lottie/Public/Animation/LottieAnimationHelpers.swift +317 -0
- package/platforms/macos/src/vendor/Lottie/Public/Animation/LottieAnimationLayer.swift +1582 -0
- package/platforms/macos/src/vendor/Lottie/Public/Animation/LottieAnimationView.swift +1090 -0
- package/platforms/macos/src/vendor/Lottie/Public/Animation/LottieAnimationViewInitializers.swift +226 -0
- package/platforms/macos/src/vendor/Lottie/Public/Animation/LottiePlaybackMode.swift +266 -0
- package/platforms/macos/src/vendor/Lottie/Public/Animation/LottieView.swift +643 -0
- package/platforms/macos/src/vendor/Lottie/Public/AnimationCache/AnimationCacheProvider.swift +21 -0
- package/platforms/macos/src/vendor/Lottie/Public/AnimationCache/DefaultAnimationCache.swift +67 -0
- package/platforms/macos/src/vendor/Lottie/Public/AnimationCache/LRUAnimationCache.swift +11 -0
- package/platforms/macos/src/vendor/Lottie/Public/AnimationCache/LottieAnimationCache.swift +15 -0
- package/platforms/macos/src/vendor/Lottie/Public/Configuration/DecodingStrategy.swift +15 -0
- package/platforms/macos/src/vendor/Lottie/Public/Configuration/LottieConfiguration.swift +54 -0
- package/platforms/macos/src/vendor/Lottie/Public/Configuration/LottieURLSession.swift +31 -0
- package/platforms/macos/src/vendor/Lottie/Public/Configuration/ReducedMotionOption.swift +128 -0
- package/platforms/macos/src/vendor/Lottie/Public/Configuration/RenderingEngineOption.swift +117 -0
- package/platforms/macos/src/vendor/Lottie/Public/Controls/AnimatedButton.swift +128 -0
- package/platforms/macos/src/vendor/Lottie/Public/Controls/AnimatedControl.swift +248 -0
- package/platforms/macos/src/vendor/Lottie/Public/Controls/AnimatedSwitch.swift +271 -0
- package/platforms/macos/src/vendor/Lottie/Public/Controls/LottieButton.swift +119 -0
- package/platforms/macos/src/vendor/Lottie/Public/Controls/LottieSwitch.swift +144 -0
- package/platforms/macos/src/vendor/Lottie/Public/Controls/LottieViewType.swift +79 -0
- package/platforms/macos/src/vendor/Lottie/Public/DotLottie/Cache/DotLottieCache.swift +66 -0
- package/platforms/macos/src/vendor/Lottie/Public/DotLottie/Cache/DotLottieCacheProvider.swift +21 -0
- package/platforms/macos/src/vendor/Lottie/Public/DotLottie/DotLottieConfiguration.swift +72 -0
- package/platforms/macos/src/vendor/Lottie/Public/DotLottie/DotLottieFile.swift +186 -0
- package/platforms/macos/src/vendor/Lottie/Public/DotLottie/DotLottieFileHelpers.swift +386 -0
- package/platforms/macos/src/vendor/Lottie/Public/DynamicProperties/AnimationKeypath.swift +57 -0
- package/platforms/macos/src/vendor/Lottie/Public/DynamicProperties/AnyValueProvider.swift +132 -0
- package/platforms/macos/src/vendor/Lottie/Public/DynamicProperties/ValueProviders/ColorValueProvider.swift +96 -0
- package/platforms/macos/src/vendor/Lottie/Public/DynamicProperties/ValueProviders/FloatValueProvider.swift +81 -0
- package/platforms/macos/src/vendor/Lottie/Public/DynamicProperties/ValueProviders/GradientValueProvider.swift +138 -0
- package/platforms/macos/src/vendor/Lottie/Public/DynamicProperties/ValueProviders/PointValueProvider.swift +81 -0
- package/platforms/macos/src/vendor/Lottie/Public/DynamicProperties/ValueProviders/SizeValueProvider.swift +81 -0
- package/platforms/macos/src/vendor/Lottie/Public/FontProvider/AnimationFontProvider.swift +41 -0
- package/platforms/macos/src/vendor/Lottie/Public/ImageProvider/AnimationImageProvider.swift +43 -0
- package/platforms/macos/src/vendor/Lottie/Public/Keyframes/Interpolatable.swift +285 -0
- package/platforms/macos/src/vendor/Lottie/Public/Keyframes/Keyframe.swift +98 -0
- package/platforms/macos/src/vendor/Lottie/Public/Logging/LottieLogger.swift +138 -0
- package/platforms/macos/src/vendor/Lottie/Public/Primitives/AnimationTime.swift +15 -0
- package/platforms/macos/src/vendor/Lottie/Public/Primitives/LottieColor.swift +43 -0
- package/platforms/macos/src/vendor/Lottie/Public/Primitives/Vectors.swift +36 -0
- package/platforms/macos/src/vendor/Lottie/Public/TextProvider/AnimationTextProvider.swift +135 -0
- package/platforms/macos/src/vendor/Lottie/Public/iOS/AnimationSubview.swift +19 -0
- package/platforms/macos/src/vendor/Lottie/Public/iOS/BundleImageProvider.swift +98 -0
- package/platforms/macos/src/vendor/Lottie/Public/iOS/Compatibility/CompatibleAnimationKeypath.swift +33 -0
- package/platforms/macos/src/vendor/Lottie/Public/iOS/Compatibility/CompatibleAnimationView.swift +567 -0
- package/platforms/macos/src/vendor/Lottie/Public/iOS/Compatibility/CompatibleFontProvider.swift +41 -0
- package/platforms/macos/src/vendor/Lottie/Public/iOS/Compatibility/CompatibleImageProvider.swift +43 -0
- package/platforms/macos/src/vendor/Lottie/Public/iOS/FilepathImageProvider.swift +78 -0
- package/platforms/macos/src/vendor/Lottie/Public/iOS/LottieAnimationViewBase.swift +85 -0
- package/platforms/macos/src/vendor/Lottie/Public/iOS/UIColorExtension.swift +23 -0
- package/platforms/macos/src/vendor/Lottie/Public/macOS/AnimationSubview.macOS.swift +19 -0
- package/platforms/macos/src/vendor/Lottie/Public/macOS/BundleImageProvider.macOS.swift +90 -0
- package/platforms/macos/src/vendor/Lottie/Public/macOS/FilepathImageProvider.macOS.swift +86 -0
- package/platforms/macos/src/vendor/Lottie/Public/macOS/LottieAnimationViewBase.macOS.swift +102 -0
- package/src/Lottie.macos.tsrx +129 -0
- package/src/Lottie.tsrx +6 -4
- package/src/Lottie.web.tsrx +28 -11
- package/src/index.macos.ts +2 -0
- package/src/props.ts +6 -1
- package/types/generated/props.d.ts +5 -1
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
// Created by Lan Xu on 2024/6/7.
|
|
2
|
+
// Copyright © 2024 Airbnb Inc. All rights reserved.
|
|
3
|
+
|
|
4
|
+
import QuartzCore
|
|
5
|
+
|
|
6
|
+
// MARK: - DropShadowNode
|
|
7
|
+
|
|
8
|
+
final class DropShadowNode: LayerEffectNode {
|
|
9
|
+
|
|
10
|
+
// MARK: Lifecycle
|
|
11
|
+
|
|
12
|
+
init(model: DropShadowModel) {
|
|
13
|
+
properties = DropShadowNodeProperties(model: model)
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
// MARK: Internal
|
|
17
|
+
|
|
18
|
+
var properties: DropShadowNodeProperties
|
|
19
|
+
|
|
20
|
+
var propertyMap: any NodePropertyMap {
|
|
21
|
+
properties
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
func applyEffect(to layer: CALayer) {
|
|
25
|
+
if let opacity = properties.opacity?.value.cgFloatValue {
|
|
26
|
+
// Lottie animation files express opacity as a numerical percentage value
|
|
27
|
+
// (e.g. 0%, 50%, 100%) so we divide by 100 to get the decimal values
|
|
28
|
+
// expected by Core Animation (e.g. 0.0, 0.5, 1.0).
|
|
29
|
+
layer.shadowOpacity = Float(opacity / 100)
|
|
30
|
+
}
|
|
31
|
+
if
|
|
32
|
+
let angleDegrees = properties.angle?.value.cgFloatValue,
|
|
33
|
+
let distance = properties.distance?.value.cgFloatValue
|
|
34
|
+
{
|
|
35
|
+
// Lottie animation files express rotation in degrees
|
|
36
|
+
// (e.g. 90º, 180º, 360º) so we convert to radians to get the
|
|
37
|
+
// values expected by Core Animation (e.g. π/2, π, 2π)
|
|
38
|
+
let angleRadians = (angleDegrees * .pi) / 180
|
|
39
|
+
|
|
40
|
+
// Lottie animation files express the `shadowOffset` as (angle, distance) pair,
|
|
41
|
+
// which we convert to the expected x / y offset values:
|
|
42
|
+
let offsetX = distance * cos(angleRadians)
|
|
43
|
+
let offsetY = distance * sin(angleRadians)
|
|
44
|
+
layer.shadowOffset = .init(width: offsetX, height: offsetY)
|
|
45
|
+
}
|
|
46
|
+
layer.shadowColor = properties.color?.value.cgColorValue
|
|
47
|
+
layer.shadowRadius = properties.radius?.value.cgFloatValue ?? 0
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// MARK: - DropShadowNodeProperties
|
|
53
|
+
|
|
54
|
+
final class DropShadowNodeProperties: NodePropertyMap {
|
|
55
|
+
|
|
56
|
+
// MARK: Lifecycle
|
|
57
|
+
|
|
58
|
+
init(model: DropShadowModel) {
|
|
59
|
+
if let opacityKeyframes = model._opacity?.keyframes {
|
|
60
|
+
opacity = NodeProperty(provider: KeyframeInterpolator(keyframes: opacityKeyframes))
|
|
61
|
+
propertyMap[PropertyName.opacity.rawValue] = opacity
|
|
62
|
+
} else {
|
|
63
|
+
opacity = nil
|
|
64
|
+
}
|
|
65
|
+
if let radiusKeyframes = model._radius?.keyframes {
|
|
66
|
+
radius = NodeProperty(provider: KeyframeInterpolator(keyframes: radiusKeyframes))
|
|
67
|
+
propertyMap["Radius"] = radius
|
|
68
|
+
} else {
|
|
69
|
+
radius = nil
|
|
70
|
+
}
|
|
71
|
+
if let colorKeyFrames = model._color?.keyframes {
|
|
72
|
+
color = NodeProperty(provider: KeyframeInterpolator(keyframes: colorKeyFrames))
|
|
73
|
+
propertyMap[PropertyName.color.rawValue] = color
|
|
74
|
+
} else {
|
|
75
|
+
color = nil
|
|
76
|
+
}
|
|
77
|
+
if let angleKeyFrames = model._angle?.keyframes {
|
|
78
|
+
angle = NodeProperty(provider: KeyframeInterpolator(keyframes: angleKeyFrames))
|
|
79
|
+
propertyMap["Angle"] = angle
|
|
80
|
+
} else {
|
|
81
|
+
angle = nil
|
|
82
|
+
}
|
|
83
|
+
if let distanceKeyFrame = model._distance?.keyframes {
|
|
84
|
+
distance = NodeProperty(provider: KeyframeInterpolator(keyframes: distanceKeyFrame))
|
|
85
|
+
propertyMap["Distance"] = distance
|
|
86
|
+
} else {
|
|
87
|
+
distance = nil
|
|
88
|
+
}
|
|
89
|
+
properties = Array(propertyMap.values)
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// MARK: Internal
|
|
93
|
+
|
|
94
|
+
var propertyMap = [String: AnyNodeProperty]()
|
|
95
|
+
var properties: [AnyNodeProperty]
|
|
96
|
+
|
|
97
|
+
let opacity: NodeProperty<LottieVector1D>?
|
|
98
|
+
let radius: NodeProperty<LottieVector1D>?
|
|
99
|
+
let color: NodeProperty<LottieColor>?
|
|
100
|
+
let angle: NodeProperty<LottieVector1D>?
|
|
101
|
+
let distance: NodeProperty<LottieVector1D>?
|
|
102
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// Created by Lan Xu on 2024/6/8.
|
|
2
|
+
// Copyright © 2024 Airbnb Inc. All rights reserved.
|
|
3
|
+
|
|
4
|
+
import QuartzCore
|
|
5
|
+
|
|
6
|
+
// MARK: - LayerEffectNode
|
|
7
|
+
|
|
8
|
+
protocol LayerEffectNode {
|
|
9
|
+
var propertyMap: NodePropertyMap { get }
|
|
10
|
+
|
|
11
|
+
func applyEffect(to layer: CALayer)
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
extension LayerEffectNode {
|
|
15
|
+
|
|
16
|
+
func updateWithFrame(layer: CALayer, frame: CGFloat) {
|
|
17
|
+
for property in propertyMap.properties {
|
|
18
|
+
if property.needsUpdate(frame: frame) {
|
|
19
|
+
property.update(frame: frame)
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
applyEffect(to: layer)
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
//
|
|
2
|
+
// RoundedCornersNode.swift
|
|
3
|
+
// Lottie
|
|
4
|
+
//
|
|
5
|
+
// Created by Duolingo on 10/31/22.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
import Foundation
|
|
9
|
+
import QuartzCore
|
|
10
|
+
|
|
11
|
+
// MARK: - RoundedCornersProperties
|
|
12
|
+
|
|
13
|
+
final class RoundedCornersProperties: NodePropertyMap, KeypathSearchable {
|
|
14
|
+
|
|
15
|
+
// MARK: Lifecycle
|
|
16
|
+
|
|
17
|
+
init(roundedCorners: RoundedCorners) {
|
|
18
|
+
keypathName = roundedCorners.name
|
|
19
|
+
radius = NodeProperty(provider: KeyframeInterpolator(keyframes: roundedCorners.radius.keyframes))
|
|
20
|
+
keypathProperties = ["Radius": radius]
|
|
21
|
+
properties = Array(keypathProperties.values)
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// MARK: Internal
|
|
25
|
+
|
|
26
|
+
let keypathProperties: [String: AnyNodeProperty]
|
|
27
|
+
let properties: [AnyNodeProperty]
|
|
28
|
+
let keypathName: String
|
|
29
|
+
|
|
30
|
+
let radius: NodeProperty<LottieVector1D>
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// MARK: - RoundedCornersNode
|
|
34
|
+
|
|
35
|
+
final class RoundedCornersNode: AnimatorNode {
|
|
36
|
+
|
|
37
|
+
// MARK: Lifecycle
|
|
38
|
+
|
|
39
|
+
init(parentNode: AnimatorNode?, roundedCorners: RoundedCorners, upstreamPaths: [PathOutputNode]) {
|
|
40
|
+
outputNode = PassThroughOutputNode(parent: parentNode?.outputNode)
|
|
41
|
+
self.parentNode = parentNode
|
|
42
|
+
properties = RoundedCornersProperties(roundedCorners: roundedCorners)
|
|
43
|
+
self.upstreamPaths = upstreamPaths
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// MARK: Internal
|
|
47
|
+
|
|
48
|
+
let properties: RoundedCornersProperties
|
|
49
|
+
|
|
50
|
+
let parentNode: AnimatorNode?
|
|
51
|
+
let outputNode: NodeOutput
|
|
52
|
+
var hasLocalUpdates = false
|
|
53
|
+
var hasUpstreamUpdates = false
|
|
54
|
+
var lastUpdateFrame: CGFloat? = nil
|
|
55
|
+
var isEnabled = true
|
|
56
|
+
|
|
57
|
+
var propertyMap: NodePropertyMap & KeypathSearchable {
|
|
58
|
+
properties
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
func forceUpstreamOutputUpdates() -> Bool {
|
|
62
|
+
hasLocalUpdates || hasUpstreamUpdates
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
func rebuildOutputs(frame: CGFloat) {
|
|
66
|
+
for pathContainer in upstreamPaths {
|
|
67
|
+
let pathObjects = pathContainer.removePaths(updateFrame: frame)
|
|
68
|
+
for path in pathObjects {
|
|
69
|
+
let cornerRadius = properties.radius.value.cgFloatValue
|
|
70
|
+
if cornerRadius != 0 {
|
|
71
|
+
pathContainer.appendPath(
|
|
72
|
+
path.roundCorners(radius: cornerRadius),
|
|
73
|
+
updateFrame: frame
|
|
74
|
+
)
|
|
75
|
+
} else {
|
|
76
|
+
pathContainer.appendPath(path, updateFrame: frame)
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// MARK: Fileprivate
|
|
83
|
+
|
|
84
|
+
fileprivate let upstreamPaths: [PathOutputNode]
|
|
85
|
+
}
|
|
@@ -0,0 +1,281 @@
|
|
|
1
|
+
//
|
|
2
|
+
// TrimPathNode.swift
|
|
3
|
+
// lottie-swift
|
|
4
|
+
//
|
|
5
|
+
// Created by Brandon Withrow on 1/23/19.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
import Foundation
|
|
9
|
+
import QuartzCore
|
|
10
|
+
|
|
11
|
+
// MARK: - TrimPathProperties
|
|
12
|
+
|
|
13
|
+
final class TrimPathProperties: NodePropertyMap, KeypathSearchable {
|
|
14
|
+
|
|
15
|
+
// MARK: Lifecycle
|
|
16
|
+
|
|
17
|
+
init(trim: Trim) {
|
|
18
|
+
keypathName = trim.name
|
|
19
|
+
start = NodeProperty(provider: KeyframeInterpolator(keyframes: trim.start.keyframes))
|
|
20
|
+
end = NodeProperty(provider: KeyframeInterpolator(keyframes: trim.end.keyframes))
|
|
21
|
+
offset = NodeProperty(provider: KeyframeInterpolator(keyframes: trim.offset.keyframes))
|
|
22
|
+
type = trim.trimType
|
|
23
|
+
keypathProperties = [
|
|
24
|
+
"Start": start,
|
|
25
|
+
"End": end,
|
|
26
|
+
"Offset": offset,
|
|
27
|
+
]
|
|
28
|
+
properties = Array(keypathProperties.values)
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// MARK: Internal
|
|
32
|
+
|
|
33
|
+
let keypathProperties: [String: AnyNodeProperty]
|
|
34
|
+
let properties: [AnyNodeProperty]
|
|
35
|
+
let keypathName: String
|
|
36
|
+
|
|
37
|
+
let start: NodeProperty<LottieVector1D>
|
|
38
|
+
let end: NodeProperty<LottieVector1D>
|
|
39
|
+
let offset: NodeProperty<LottieVector1D>
|
|
40
|
+
let type: TrimType
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// MARK: - TrimPathNode
|
|
44
|
+
|
|
45
|
+
final class TrimPathNode: AnimatorNode {
|
|
46
|
+
|
|
47
|
+
// MARK: Lifecycle
|
|
48
|
+
|
|
49
|
+
init(parentNode: AnimatorNode?, trim: Trim, upstreamPaths: [PathOutputNode]) {
|
|
50
|
+
outputNode = PassThroughOutputNode(parent: parentNode?.outputNode)
|
|
51
|
+
self.parentNode = parentNode
|
|
52
|
+
properties = TrimPathProperties(trim: trim)
|
|
53
|
+
self.upstreamPaths = upstreamPaths
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// MARK: Internal
|
|
57
|
+
|
|
58
|
+
let properties: TrimPathProperties
|
|
59
|
+
|
|
60
|
+
let parentNode: AnimatorNode?
|
|
61
|
+
let outputNode: NodeOutput
|
|
62
|
+
var hasLocalUpdates = false
|
|
63
|
+
var hasUpstreamUpdates = false
|
|
64
|
+
var lastUpdateFrame: CGFloat? = nil
|
|
65
|
+
var isEnabled = true
|
|
66
|
+
|
|
67
|
+
var propertyMap: NodePropertyMap & KeypathSearchable {
|
|
68
|
+
properties
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
func forceUpstreamOutputUpdates() -> Bool {
|
|
72
|
+
hasLocalUpdates || hasUpstreamUpdates
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
func rebuildOutputs(frame: CGFloat) {
|
|
76
|
+
/// Make sure there is a trim.
|
|
77
|
+
let startValue = properties.start.value.cgFloatValue * 0.01
|
|
78
|
+
let endValue = properties.end.value.cgFloatValue * 0.01
|
|
79
|
+
let start = min(startValue, endValue)
|
|
80
|
+
let end = max(startValue, endValue)
|
|
81
|
+
|
|
82
|
+
let offset = properties.offset.value.cgFloatValue.truncatingRemainder(dividingBy: 360) / 360
|
|
83
|
+
|
|
84
|
+
/// No need to trim, it's a full path
|
|
85
|
+
if start == 0, end == 1 {
|
|
86
|
+
return
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/// All paths are empty.
|
|
90
|
+
if start == end {
|
|
91
|
+
for pathContainer in upstreamPaths {
|
|
92
|
+
pathContainer.removePaths(updateFrame: frame)
|
|
93
|
+
}
|
|
94
|
+
return
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
if properties.type == .simultaneously {
|
|
98
|
+
/// Just trim each path
|
|
99
|
+
for pathContainer in upstreamPaths {
|
|
100
|
+
let pathObjects = pathContainer.removePaths(updateFrame: frame)
|
|
101
|
+
for path in pathObjects {
|
|
102
|
+
// We are treating each compount path as an individual path. Its subpaths are treated as a whole.
|
|
103
|
+
pathContainer.appendPath(
|
|
104
|
+
path.trim(fromPosition: start, toPosition: end, offset: offset, trimSimultaneously: false),
|
|
105
|
+
updateFrame: frame
|
|
106
|
+
)
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
return
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/// Individual path trimming.
|
|
113
|
+
|
|
114
|
+
/// Brace yourself for the below code.
|
|
115
|
+
|
|
116
|
+
/// Normalize lengths with offset.
|
|
117
|
+
var startPosition = (start + offset).truncatingRemainder(dividingBy: 1)
|
|
118
|
+
var endPosition = (end + offset).truncatingRemainder(dividingBy: 1)
|
|
119
|
+
|
|
120
|
+
if startPosition < 0 {
|
|
121
|
+
startPosition = 1 + startPosition
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
if endPosition < 0 {
|
|
125
|
+
endPosition = 1 + endPosition
|
|
126
|
+
}
|
|
127
|
+
if startPosition == 1 {
|
|
128
|
+
startPosition = 0
|
|
129
|
+
}
|
|
130
|
+
if endPosition == 0 {
|
|
131
|
+
endPosition = 1
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/// First get the total length of all paths.
|
|
135
|
+
var totalLength: CGFloat = 0
|
|
136
|
+
for upstreamPath in upstreamPaths {
|
|
137
|
+
totalLength = totalLength + upstreamPath.totalLength
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/// Now determine the start and end cut lengths
|
|
141
|
+
let startLength = startPosition * totalLength
|
|
142
|
+
let endLength = endPosition * totalLength
|
|
143
|
+
var pathStart: CGFloat = 0
|
|
144
|
+
|
|
145
|
+
/// Now loop through all path containers
|
|
146
|
+
for pathContainer in upstreamPaths {
|
|
147
|
+
let pathEnd = pathStart + pathContainer.totalLength
|
|
148
|
+
|
|
149
|
+
if
|
|
150
|
+
!startLength.isInRange(pathStart, pathEnd) &&
|
|
151
|
+
endLength.isInRange(pathStart, pathEnd)
|
|
152
|
+
{
|
|
153
|
+
// pathStart|=======E----------------------|pathEnd
|
|
154
|
+
// Cut path components, removing after end.
|
|
155
|
+
|
|
156
|
+
let pathCutLength = endLength - pathStart
|
|
157
|
+
let subpaths = pathContainer.removePaths(updateFrame: frame)
|
|
158
|
+
var subpathStart: CGFloat = 0
|
|
159
|
+
for path in subpaths {
|
|
160
|
+
let subpathEnd = subpathStart + path.length
|
|
161
|
+
if pathCutLength < subpathEnd {
|
|
162
|
+
/// This is the subpath that needs to be cut.
|
|
163
|
+
let cutLength = pathCutLength - subpathStart
|
|
164
|
+
let newPath = path.trim(fromPosition: 0, toPosition: cutLength / path.length, offset: 0, trimSimultaneously: false)
|
|
165
|
+
pathContainer.appendPath(newPath, updateFrame: frame)
|
|
166
|
+
break
|
|
167
|
+
} else {
|
|
168
|
+
/// Add to container and move on
|
|
169
|
+
pathContainer.appendPath(path, updateFrame: frame)
|
|
170
|
+
}
|
|
171
|
+
if pathCutLength == subpathEnd {
|
|
172
|
+
/// Right on the end. The next subpath is not included. Break.
|
|
173
|
+
break
|
|
174
|
+
}
|
|
175
|
+
subpathStart = subpathEnd
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
} else if
|
|
179
|
+
!endLength.isInRange(pathStart, pathEnd) &&
|
|
180
|
+
startLength.isInRange(pathStart, pathEnd)
|
|
181
|
+
{
|
|
182
|
+
// pathStart|-------S======================|pathEnd
|
|
183
|
+
//
|
|
184
|
+
|
|
185
|
+
// Cut path components, removing before beginning.
|
|
186
|
+
let pathCutLength = startLength - pathStart
|
|
187
|
+
// Clear paths from container
|
|
188
|
+
let subpaths = pathContainer.removePaths(updateFrame: frame)
|
|
189
|
+
var subpathStart: CGFloat = 0
|
|
190
|
+
for path in subpaths {
|
|
191
|
+
let subpathEnd = subpathStart + path.length
|
|
192
|
+
|
|
193
|
+
if subpathStart < pathCutLength, pathCutLength < subpathEnd {
|
|
194
|
+
/// This is the subpath that needs to be cut.
|
|
195
|
+
let cutLength = pathCutLength - subpathStart
|
|
196
|
+
let newPath = path.trim(fromPosition: cutLength / path.length, toPosition: 1, offset: 0, trimSimultaneously: false)
|
|
197
|
+
pathContainer.appendPath(newPath, updateFrame: frame)
|
|
198
|
+
} else if pathCutLength <= subpathStart {
|
|
199
|
+
pathContainer.appendPath(path, updateFrame: frame)
|
|
200
|
+
}
|
|
201
|
+
subpathStart = subpathEnd
|
|
202
|
+
}
|
|
203
|
+
} else if
|
|
204
|
+
endLength.isInRange(pathStart, pathEnd) &&
|
|
205
|
+
startLength.isInRange(pathStart, pathEnd)
|
|
206
|
+
{
|
|
207
|
+
// pathStart|-------S============E---------|endLength
|
|
208
|
+
// pathStart|=====E----------------S=======|endLength
|
|
209
|
+
// trim from path beginning to endLength.
|
|
210
|
+
|
|
211
|
+
// Cut path components, removing before beginnings.
|
|
212
|
+
let startCutLength = startLength - pathStart
|
|
213
|
+
let endCutLength = endLength - pathStart
|
|
214
|
+
// Clear paths from container
|
|
215
|
+
let subpaths = pathContainer.removePaths(updateFrame: frame)
|
|
216
|
+
var subpathStart: CGFloat = 0
|
|
217
|
+
for path in subpaths {
|
|
218
|
+
let subpathEnd = subpathStart + path.length
|
|
219
|
+
|
|
220
|
+
if
|
|
221
|
+
!startCutLength.isInRange(subpathStart, subpathEnd),
|
|
222
|
+
!endCutLength.isInRange(subpathStart, subpathEnd)
|
|
223
|
+
{
|
|
224
|
+
// The whole path is included. Add
|
|
225
|
+
// S|==============================|E
|
|
226
|
+
pathContainer.appendPath(path, updateFrame: frame)
|
|
227
|
+
|
|
228
|
+
} else if
|
|
229
|
+
startCutLength.isInRange(subpathStart, subpathEnd),
|
|
230
|
+
!endCutLength.isInRange(subpathStart, subpathEnd)
|
|
231
|
+
{
|
|
232
|
+
/// The start of the path needs to be trimmed
|
|
233
|
+
// |-------S======================|E
|
|
234
|
+
let cutLength = startCutLength - subpathStart
|
|
235
|
+
let newPath = path.trim(fromPosition: cutLength / path.length, toPosition: 1, offset: 0, trimSimultaneously: false)
|
|
236
|
+
pathContainer.appendPath(newPath, updateFrame: frame)
|
|
237
|
+
} else if
|
|
238
|
+
!startCutLength.isInRange(subpathStart, subpathEnd),
|
|
239
|
+
endCutLength.isInRange(subpathStart, subpathEnd)
|
|
240
|
+
{
|
|
241
|
+
// S|=======E----------------------|
|
|
242
|
+
let cutLength = endCutLength - subpathStart
|
|
243
|
+
let newPath = path.trim(fromPosition: 0, toPosition: cutLength / path.length, offset: 0, trimSimultaneously: false)
|
|
244
|
+
pathContainer.appendPath(newPath, updateFrame: frame)
|
|
245
|
+
break
|
|
246
|
+
} else if
|
|
247
|
+
startCutLength.isInRange(subpathStart, subpathEnd),
|
|
248
|
+
endCutLength.isInRange(subpathStart, subpathEnd)
|
|
249
|
+
{
|
|
250
|
+
// |-------S============E---------|
|
|
251
|
+
let cutFromLength = startCutLength - subpathStart
|
|
252
|
+
let cutToLength = endCutLength - subpathStart
|
|
253
|
+
let newPath = path.trim(
|
|
254
|
+
fromPosition: cutFromLength / path.length,
|
|
255
|
+
toPosition: cutToLength / path.length,
|
|
256
|
+
offset: 0,
|
|
257
|
+
trimSimultaneously: false
|
|
258
|
+
)
|
|
259
|
+
pathContainer.appendPath(newPath, updateFrame: frame)
|
|
260
|
+
break
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
subpathStart = subpathEnd
|
|
264
|
+
}
|
|
265
|
+
} else if
|
|
266
|
+
(endLength <= pathStart && pathEnd <= startLength) ||
|
|
267
|
+
(startLength <= pathStart && endLength <= pathStart) ||
|
|
268
|
+
(pathEnd <= startLength && pathEnd <= endLength)
|
|
269
|
+
{
|
|
270
|
+
/// The Path needs to be cleared
|
|
271
|
+
pathContainer.removePaths(updateFrame: frame)
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
pathStart = pathEnd
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
// MARK: Fileprivate
|
|
279
|
+
|
|
280
|
+
fileprivate let upstreamPaths: [PathOutputNode]
|
|
281
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
//
|
|
2
|
+
// TransformNodeOutput.swift
|
|
3
|
+
// lottie-swift
|
|
4
|
+
//
|
|
5
|
+
// Created by Brandon Withrow on 1/30/19.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
import QuartzCore
|
|
9
|
+
|
|
10
|
+
final class GroupOutputNode: NodeOutput {
|
|
11
|
+
|
|
12
|
+
// MARK: Lifecycle
|
|
13
|
+
|
|
14
|
+
init(parent: NodeOutput?, rootNode: NodeOutput?) {
|
|
15
|
+
self.parent = parent
|
|
16
|
+
self.rootNode = rootNode
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
// MARK: Internal
|
|
20
|
+
|
|
21
|
+
let parent: NodeOutput?
|
|
22
|
+
let rootNode: NodeOutput?
|
|
23
|
+
var isEnabled = true
|
|
24
|
+
|
|
25
|
+
private(set) var outputPath: CGPath? = nil
|
|
26
|
+
private(set) var transform: CATransform3D = CATransform3DIdentity
|
|
27
|
+
|
|
28
|
+
func setTransform(_ xform: CATransform3D, forFrame _: CGFloat) {
|
|
29
|
+
transform = xform
|
|
30
|
+
outputPath = nil
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
func hasOutputUpdates(_ forFrame: CGFloat) -> Bool {
|
|
34
|
+
guard isEnabled else {
|
|
35
|
+
let upstreamUpdates = parent?.hasOutputUpdates(forFrame) ?? false
|
|
36
|
+
outputPath = parent?.outputPath
|
|
37
|
+
return upstreamUpdates
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
let upstreamUpdates = parent?.hasOutputUpdates(forFrame) ?? false
|
|
41
|
+
if upstreamUpdates {
|
|
42
|
+
outputPath = nil
|
|
43
|
+
}
|
|
44
|
+
let rootUpdates = rootNode?.hasOutputUpdates(forFrame) ?? false
|
|
45
|
+
if rootUpdates {
|
|
46
|
+
outputPath = nil
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
var localUpdates = false
|
|
50
|
+
if outputPath == nil {
|
|
51
|
+
localUpdates = true
|
|
52
|
+
|
|
53
|
+
let newPath = CGMutablePath()
|
|
54
|
+
if let parentNode = parent, let parentPath = parentNode.outputPath {
|
|
55
|
+
/// First add parent path.
|
|
56
|
+
newPath.addPath(parentPath)
|
|
57
|
+
}
|
|
58
|
+
var xform = CATransform3DGetAffineTransform(transform)
|
|
59
|
+
if
|
|
60
|
+
let rootNode,
|
|
61
|
+
let rootPath = rootNode.outputPath,
|
|
62
|
+
let xformedPath = rootPath.copy(using: &xform)
|
|
63
|
+
{
|
|
64
|
+
/// Now add root path. Note root path is transformed.
|
|
65
|
+
newPath.addPath(xformedPath)
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
outputPath = newPath
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
return upstreamUpdates || localUpdates
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
//
|
|
2
|
+
// PassThroughOutputNode.swift
|
|
3
|
+
// lottie-swift
|
|
4
|
+
//
|
|
5
|
+
// Created by Brandon Withrow on 1/30/19.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
import CoreGraphics
|
|
9
|
+
|
|
10
|
+
/// Base class for pass-through nodes
|
|
11
|
+
class PassThroughOutputNode: NodeOutput {
|
|
12
|
+
|
|
13
|
+
// MARK: Lifecycle
|
|
14
|
+
|
|
15
|
+
init(parent: NodeOutput?) {
|
|
16
|
+
self.parent = parent
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
// MARK: Internal
|
|
20
|
+
|
|
21
|
+
let parent: NodeOutput?
|
|
22
|
+
|
|
23
|
+
var hasUpdate = false
|
|
24
|
+
var isEnabled = true
|
|
25
|
+
|
|
26
|
+
var outputPath: CGPath? {
|
|
27
|
+
if let parent {
|
|
28
|
+
return parent.outputPath
|
|
29
|
+
}
|
|
30
|
+
return nil
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
func hasOutputUpdates(_ forFrame: CGFloat) -> Bool {
|
|
34
|
+
/// Changes to this node do not affect downstream nodes.
|
|
35
|
+
let parentUpdate = parent?.hasOutputUpdates(forFrame) ?? false
|
|
36
|
+
/// Changes to upstream nodes do, however, affect this nodes state.
|
|
37
|
+
hasUpdate = hasUpdate || parentUpdate
|
|
38
|
+
return parentUpdate
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
func hasRenderUpdates(_ forFrame: CGFloat) -> Bool {
|
|
42
|
+
/// Return true if there are upstream updates or if this node has updates
|
|
43
|
+
let upstreamUpdates = parent?.hasOutputUpdates(forFrame) ?? false
|
|
44
|
+
hasUpdate = hasUpdate || upstreamUpdates
|
|
45
|
+
return hasUpdate
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
//
|
|
2
|
+
// PathNodeOutput.swift
|
|
3
|
+
// lottie-swift
|
|
4
|
+
//
|
|
5
|
+
// Created by Brandon Withrow on 1/30/19.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
import CoreGraphics
|
|
9
|
+
|
|
10
|
+
/// A node that has an output of a BezierPath
|
|
11
|
+
final class PathOutputNode: NodeOutput {
|
|
12
|
+
|
|
13
|
+
// MARK: Lifecycle
|
|
14
|
+
|
|
15
|
+
init(parent: NodeOutput?) {
|
|
16
|
+
self.parent = parent
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
// MARK: Internal
|
|
20
|
+
|
|
21
|
+
let parent: NodeOutput?
|
|
22
|
+
|
|
23
|
+
fileprivate(set) var outputPath: CGPath? = nil
|
|
24
|
+
|
|
25
|
+
var lastUpdateFrame: CGFloat? = nil
|
|
26
|
+
var lastPathBuildFrame: CGFloat? = nil
|
|
27
|
+
var isEnabled = true
|
|
28
|
+
fileprivate(set) var totalLength: CGFloat = 0
|
|
29
|
+
fileprivate(set) var pathObjects = [CompoundBezierPath]()
|
|
30
|
+
|
|
31
|
+
func hasOutputUpdates(_ forFrame: CGFloat) -> Bool {
|
|
32
|
+
guard isEnabled else {
|
|
33
|
+
let upstreamUpdates = parent?.hasOutputUpdates(forFrame) ?? false
|
|
34
|
+
outputPath = parent?.outputPath
|
|
35
|
+
return upstreamUpdates
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/// Ask if parent was updated
|
|
39
|
+
let upstreamUpdates = parent?.hasOutputUpdates(forFrame) ?? false
|
|
40
|
+
|
|
41
|
+
/// If parent was updated and the path hasn't been built for this frame, clear the path.
|
|
42
|
+
if upstreamUpdates && lastPathBuildFrame != forFrame {
|
|
43
|
+
outputPath = nil
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
if outputPath == nil {
|
|
47
|
+
/// If the path is clear, build the new path.
|
|
48
|
+
lastPathBuildFrame = forFrame
|
|
49
|
+
let newPath = CGMutablePath()
|
|
50
|
+
if let parentNode = parent, let parentPath = parentNode.outputPath {
|
|
51
|
+
newPath.addPath(parentPath)
|
|
52
|
+
}
|
|
53
|
+
for path in pathObjects {
|
|
54
|
+
for subPath in path.paths {
|
|
55
|
+
newPath.addPath(subPath.cgPath())
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
outputPath = newPath
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/// Return true if there were upstream updates or if this node was updated.
|
|
62
|
+
return upstreamUpdates || (lastUpdateFrame == forFrame)
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
@discardableResult
|
|
66
|
+
func removePaths(updateFrame: CGFloat?) -> [CompoundBezierPath] {
|
|
67
|
+
lastUpdateFrame = updateFrame
|
|
68
|
+
let returnPaths = pathObjects
|
|
69
|
+
outputPath = nil
|
|
70
|
+
totalLength = 0
|
|
71
|
+
pathObjects = []
|
|
72
|
+
return returnPaths
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
func setPath(_ path: BezierPath, updateFrame: CGFloat) {
|
|
76
|
+
lastUpdateFrame = updateFrame
|
|
77
|
+
outputPath = nil
|
|
78
|
+
totalLength = path.length
|
|
79
|
+
pathObjects = [CompoundBezierPath(path: path)]
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
func appendPath(_ path: CompoundBezierPath, updateFrame: CGFloat) {
|
|
83
|
+
lastUpdateFrame = updateFrame
|
|
84
|
+
outputPath = nil
|
|
85
|
+
totalLength = totalLength + path.length
|
|
86
|
+
pathObjects.append(path)
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
}
|