@octane-xplat/lottie 0.0.1 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +56 -2
- package/dist/native/cx.mobile.js +11 -0
- package/dist/native/escape-props.js +39 -0
- package/dist/native/index.js +183 -0
- package/dist/native/layout-child.js +38 -0
- package/dist/native/octane-client-build.json +8 -0
- package/dist/native/vendor/ui-lottie/index.android.js +286 -0
- package/dist/native/vendor/ui-lottie/index.ios.js +214 -0
- package/dist/native/vendor/ui-lottie/src/lottie/index.common.js +50 -0
- package/dist/native/vendor/ui-lottie/src/lottie/utils.js +6 -0
- package/dist/web/escape-props.web.js +17 -0
- package/dist/web/index.js +346 -0
- package/dist/web/layout-child.web.js +47 -0
- package/dist/web/octane-client-build.json +8 -0
- package/package.json +104 -11
- package/platforms/android/include.gradle +7 -0
- package/platforms/android/java/com/nativescript/lottie/LottieAnimationView.java +92 -0
- package/platforms/android/lottie.aar +0 -0
- package/platforms/android/native-api-usage.json +16 -0
- package/platforms/ios/Podfile +5 -0
- 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 +162 -0
- package/src/Lottie.web.tsrx +152 -0
- package/src/cx.mobile.ts +8 -0
- package/src/escape-props.ts +65 -0
- package/src/escape-props.web.ts +25 -0
- package/src/index.macos.ts +2 -0
- package/src/index.ts +2 -0
- package/src/index.web.ts +2 -0
- package/src/layout-child.ts +57 -0
- package/src/layout-child.web.ts +108 -0
- package/src/native-elements.d.ts +8 -0
- package/src/props.ts +133 -0
- package/src/references.d.ts +3 -0
- package/src/vendor/ui-lottie/LICENSE.md +21 -0
- package/src/vendor/ui-lottie/src/lottie/index.android.ts +447 -0
- package/src/vendor/ui-lottie/src/lottie/index.common.ts +84 -0
- package/src/vendor/ui-lottie/src/lottie/index.d.ts +133 -0
- package/src/vendor/ui-lottie/src/lottie/index.ios.ts +345 -0
- package/src/vendor/ui-lottie/src/lottie/typings/android.d.ts +4149 -0
- package/src/vendor/ui-lottie/src/lottie/typings/android.nativescript.d.ts +12 -0
- package/src/vendor/ui-lottie/src/lottie/typings/dotlottie.ios.d.ts +14 -0
- package/src/vendor/ui-lottie/src/lottie/typings/ios.d.ts +384 -0
- package/src/vendor/ui-lottie/src/lottie/utils.ts +9 -0
- package/types/generated/.tsrx-typegen-manifest.json +18 -0
- package/types/generated/Lottie.d.ts +7 -0
- package/types/generated/Lottie.web.d.ts +7 -0
- package/types/generated/cx.mobile.d.ts +6 -0
- package/types/generated/escape-props.d.ts +15 -0
- package/types/generated/escape-props.web.d.ts +5 -0
- package/types/generated/index.d.ts +2 -0
- package/types/generated/index.web.d.ts +2 -0
- package/types/generated/layout-child.d.ts +6 -0
- package/types/generated/layout-child.web.d.ts +15 -0
- package/types/generated/props.d.ts +110 -0
- package/types/generated/vendor/ui-lottie/src/lottie/index.common.d.ts +30 -0
- package/types/generated/vendor/ui-lottie/src/lottie/index.ios.d.ts +35 -0
- package/types/generated/vendor/ui-lottie/src/lottie/utils.d.ts +1 -0
- package/index.d.ts +0 -1
- package/index.js +0 -2
package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/BaseCompositionLayer.swift
ADDED
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
// Created by Cal Stephens on 12/20/21.
|
|
2
|
+
// Copyright © 2021 Airbnb Inc. All rights reserved.
|
|
3
|
+
|
|
4
|
+
import QuartzCore
|
|
5
|
+
|
|
6
|
+
// MARK: - BaseCompositionLayer
|
|
7
|
+
|
|
8
|
+
/// The base type of `AnimationLayer` that can contain other `AnimationLayer`s
|
|
9
|
+
class BaseCompositionLayer: BaseAnimationLayer {
|
|
10
|
+
|
|
11
|
+
// MARK: Lifecycle
|
|
12
|
+
|
|
13
|
+
init(layerModel: LayerModel) {
|
|
14
|
+
baseLayerModel = layerModel
|
|
15
|
+
super.init()
|
|
16
|
+
|
|
17
|
+
setupSublayers()
|
|
18
|
+
compositingFilter = layerModel.blendMode.filterName
|
|
19
|
+
name = layerModel.name
|
|
20
|
+
contentsLayer.name = "\(layerModel.name) (Content)"
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
required init?(coder _: NSCoder) {
|
|
24
|
+
fatalError("init(coder:) has not been implemented")
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/// Called by CoreAnimation to create a shadow copy of this layer
|
|
28
|
+
/// More details: https://developer.apple.com/documentation/quartzcore/calayer/1410842-init
|
|
29
|
+
override init(layer: Any) {
|
|
30
|
+
guard let typedLayer = layer as? Self else {
|
|
31
|
+
fatalError("\(Self.self).init(layer:) incorrectly called with \(type(of: layer))")
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
baseLayerModel = typedLayer.baseLayerModel
|
|
35
|
+
super.init(layer: typedLayer)
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// MARK: Internal
|
|
39
|
+
|
|
40
|
+
/// The layer that content / sublayers should be rendered in.
|
|
41
|
+
/// This is the layer that transform animations are applied to.
|
|
42
|
+
let contentsLayer = BaseAnimationLayer()
|
|
43
|
+
|
|
44
|
+
/// Whether or not this layer render should render any visible content
|
|
45
|
+
var renderLayerContents: Bool {
|
|
46
|
+
true
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/// Sets up the base `LayerModel` animations for this layer,
|
|
50
|
+
/// and all child `AnimationLayer`s.
|
|
51
|
+
/// - Can be overridden by subclasses, which much call `super`.
|
|
52
|
+
override func setupAnimations(context: LayerAnimationContext) throws {
|
|
53
|
+
let layerContext = context.addingKeypathComponent(baseLayerModel.name)
|
|
54
|
+
let childContext = renderLayerContents ? layerContext : context
|
|
55
|
+
|
|
56
|
+
try setupLayerAnimations(context: layerContext)
|
|
57
|
+
try setupChildAnimations(context: childContext)
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
func setupLayerAnimations(context: LayerAnimationContext) throws {
|
|
61
|
+
let transformContext = context.addingKeypathComponent("Transform")
|
|
62
|
+
|
|
63
|
+
try contentsLayer.addTransformAnimations(for: baseLayerModel.transform, context: transformContext)
|
|
64
|
+
|
|
65
|
+
if renderLayerContents {
|
|
66
|
+
try contentsLayer.addOpacityAnimation(for: baseLayerModel.transform, context: transformContext)
|
|
67
|
+
|
|
68
|
+
try contentsLayer.addVisibilityAnimation(
|
|
69
|
+
inFrame: CGFloat(baseLayerModel.inFrame),
|
|
70
|
+
outFrame: CGFloat(baseLayerModel.outFrame),
|
|
71
|
+
context: context
|
|
72
|
+
)
|
|
73
|
+
|
|
74
|
+
// There are two different drop shadow schemas, either using `DropShadowEffect` or `DropShadowStyle`.
|
|
75
|
+
// If both happen to be present, prefer the `DropShadowEffect` (which is the drop shadow schema
|
|
76
|
+
// supported on other platforms).
|
|
77
|
+
let dropShadowEffect = baseLayerModel.effects.first(where: { $0 is DropShadowEffect }) as? DropShadowModel
|
|
78
|
+
let dropShadowStyle = baseLayerModel.styles.first(where: { $0 is DropShadowStyle }) as? DropShadowModel
|
|
79
|
+
if let dropShadowModel = dropShadowEffect ?? dropShadowStyle {
|
|
80
|
+
try contentsLayer.addDropShadowAnimations(for: dropShadowModel, context: context)
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// Set up mask animations with the layer's own context (parent timeline).
|
|
84
|
+
// Mask keyframes are defined in the parent's global timeline, not the precomp's
|
|
85
|
+
// local timeline, so the mask must not receive the time-remapped child context.
|
|
86
|
+
if let maskLayer = contentsLayer.mask as? AnimationLayer {
|
|
87
|
+
try maskLayer.setupAnimations(context: context)
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
func setupChildAnimations(context: LayerAnimationContext) throws {
|
|
93
|
+
try super.setupAnimations(context: context)
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
override func addSublayer(_ layer: CALayer) {
|
|
97
|
+
if layer === contentsLayer {
|
|
98
|
+
super.addSublayer(contentsLayer)
|
|
99
|
+
} else {
|
|
100
|
+
contentsLayer.addSublayer(layer)
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
// MARK: Private
|
|
105
|
+
|
|
106
|
+
private let baseLayerModel: LayerModel
|
|
107
|
+
|
|
108
|
+
private func setupSublayers() {
|
|
109
|
+
addSublayer(contentsLayer)
|
|
110
|
+
|
|
111
|
+
if
|
|
112
|
+
renderLayerContents,
|
|
113
|
+
let masks = baseLayerModel.masks?.filter({ $0.mode != .none }),
|
|
114
|
+
!masks.isEmpty
|
|
115
|
+
{
|
|
116
|
+
contentsLayer.mask = MaskCompositionLayer(masks: masks)
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
}
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
// Created by Cal Stephens on 1/11/22.
|
|
2
|
+
// Copyright © 2022 Airbnb Inc. All rights reserved.
|
|
3
|
+
|
|
4
|
+
import QuartzCore
|
|
5
|
+
|
|
6
|
+
extension CALayer {
|
|
7
|
+
|
|
8
|
+
// MARK: Internal
|
|
9
|
+
|
|
10
|
+
/// Sets up an `AnimationLayer` / `CALayer` hierarchy in this layer,
|
|
11
|
+
/// using the given list of layers.
|
|
12
|
+
@nonobjc
|
|
13
|
+
func setupLayerHierarchy(
|
|
14
|
+
for layers: [LayerModel],
|
|
15
|
+
context: LayerContext
|
|
16
|
+
) throws {
|
|
17
|
+
// A `LottieAnimation`'s `LayerModel`s are listed from front to back,
|
|
18
|
+
// but `CALayer.sublayers` are listed from back to front.
|
|
19
|
+
// We reverse the layer ordering to match what Core Animation expects.
|
|
20
|
+
// The final view hierarchy must display the layers in this exact order.
|
|
21
|
+
let layersInZAxisOrder = layers.reversed()
|
|
22
|
+
|
|
23
|
+
let layersByIndex = Dictionary(grouping: layersInZAxisOrder, by: \.index)
|
|
24
|
+
.compactMapValues(\.first)
|
|
25
|
+
|
|
26
|
+
/// Layers specify a `parent` layer. Child layers inherit the `transform` of their parent.
|
|
27
|
+
/// - We can't add the child as a sublayer of the parent `CALayer`, since that would
|
|
28
|
+
/// break the ordering specified in `layersInZAxisOrder`.
|
|
29
|
+
/// - Instead, we create an invisible `TransformLayer` to handle the parent
|
|
30
|
+
/// transform animations, and add the child layer to that `TransformLayer`.
|
|
31
|
+
func makeParentTransformLayer(
|
|
32
|
+
childLayerModel: LayerModel,
|
|
33
|
+
childLayer: CALayer,
|
|
34
|
+
name: (LayerModel) -> String
|
|
35
|
+
) -> CALayer {
|
|
36
|
+
guard
|
|
37
|
+
let parentIndex = childLayerModel.parent,
|
|
38
|
+
let parentLayerModel = layersByIndex[parentIndex]
|
|
39
|
+
else { return childLayer }
|
|
40
|
+
|
|
41
|
+
let parentLayer = TransformLayer(layerModel: parentLayerModel)
|
|
42
|
+
parentLayer.name = name(parentLayerModel)
|
|
43
|
+
parentLayer.addSublayer(childLayer)
|
|
44
|
+
|
|
45
|
+
return makeParentTransformLayer(
|
|
46
|
+
childLayerModel: parentLayerModel,
|
|
47
|
+
childLayer: parentLayer,
|
|
48
|
+
name: name
|
|
49
|
+
)
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// Create an `AnimationLayer` for each `LayerModel`
|
|
53
|
+
for (layerModel, mask) in try layersInZAxisOrder.pairedLayersAndMasks() {
|
|
54
|
+
guard let layer = try layerModel.makeAnimationLayer(context: context) else {
|
|
55
|
+
continue
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// If this layer has a `parent`, we create an invisible `TransformLayer`
|
|
59
|
+
// to handle displaying / animating the parent transform.
|
|
60
|
+
let parentTransformLayer = makeParentTransformLayer(
|
|
61
|
+
childLayerModel: layerModel,
|
|
62
|
+
childLayer: layer,
|
|
63
|
+
name: { parentLayerModel in
|
|
64
|
+
"\(layerModel.name) (parent, \(parentLayerModel.name))"
|
|
65
|
+
}
|
|
66
|
+
)
|
|
67
|
+
|
|
68
|
+
// Create the `mask` layer for this layer, if it has a `MatteType`
|
|
69
|
+
if
|
|
70
|
+
let mask,
|
|
71
|
+
let maskLayer = try maskLayer(for: mask.model, type: mask.matteType, context: context)
|
|
72
|
+
{
|
|
73
|
+
let maskParentTransformLayer = makeParentTransformLayer(
|
|
74
|
+
childLayerModel: mask.model,
|
|
75
|
+
childLayer: maskLayer,
|
|
76
|
+
name: { parentLayerModel in
|
|
77
|
+
"\(mask.model.name) (mask of \(layerModel.name)) (parent, \(parentLayerModel.name))"
|
|
78
|
+
}
|
|
79
|
+
)
|
|
80
|
+
|
|
81
|
+
// Set up a parent container to host both the layer
|
|
82
|
+
// and its mask in the same coordinate space
|
|
83
|
+
let maskContainer = BaseAnimationLayer()
|
|
84
|
+
maskContainer.name = "\(layerModel.name) (parent, masked)"
|
|
85
|
+
maskContainer.addSublayer(parentTransformLayer)
|
|
86
|
+
|
|
87
|
+
// Core Animation will silently fail to apply a mask if a `mask` layer
|
|
88
|
+
// itself _also_ has a `mask`. As a workaround, we can wrap this layer's
|
|
89
|
+
// mask in an additional container layer which never has its own `mask`.
|
|
90
|
+
let additionalMaskParent = BaseAnimationLayer()
|
|
91
|
+
additionalMaskParent.addSublayer(maskParentTransformLayer)
|
|
92
|
+
maskContainer.mask = additionalMaskParent
|
|
93
|
+
|
|
94
|
+
addSublayer(maskContainer)
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
else {
|
|
98
|
+
addSublayer(parentTransformLayer)
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
// MARK: Fileprivate
|
|
104
|
+
|
|
105
|
+
/// Creates a mask `CALayer` from the given matte layer model, using the `MatteType`
|
|
106
|
+
/// from the layer that is being masked.
|
|
107
|
+
fileprivate func maskLayer(
|
|
108
|
+
for matteLayerModel: LayerModel,
|
|
109
|
+
type: MatteType,
|
|
110
|
+
context: LayerContext
|
|
111
|
+
) throws -> CALayer? {
|
|
112
|
+
switch type {
|
|
113
|
+
case .add:
|
|
114
|
+
return try matteLayerModel.makeAnimationLayer(context: context)
|
|
115
|
+
|
|
116
|
+
case .invert:
|
|
117
|
+
guard let maskLayer = try matteLayerModel.makeAnimationLayer(context: context) else {
|
|
118
|
+
return nil
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
// We can invert the mask layer by having a large solid black layer with the
|
|
122
|
+
// given mask layer subtracted out using the `xor` blend mode. When applied to the
|
|
123
|
+
// layer being masked, this creates an inverted mask where only areas _outside_
|
|
124
|
+
// of the mask layer are visible.
|
|
125
|
+
// https://developer.apple.com/documentation/coregraphics/cgblendmode/xor
|
|
126
|
+
// - The inverted mask is supposed to expand infinitely around the shape,
|
|
127
|
+
// so we use `InfiniteOpaqueAnimationLayer`
|
|
128
|
+
let base = InfiniteOpaqueAnimationLayer()
|
|
129
|
+
base.backgroundColor = .rgb(0, 0, 0)
|
|
130
|
+
base.addSublayer(maskLayer)
|
|
131
|
+
maskLayer.compositingFilter = "xor"
|
|
132
|
+
return base
|
|
133
|
+
|
|
134
|
+
case .none, .unknown:
|
|
135
|
+
return nil
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
extension Collection<LayerModel> {
|
|
142
|
+
/// Pairs each `LayerModel` within this array with
|
|
143
|
+
/// a `LayerModel` to use as its mask, if applicable
|
|
144
|
+
/// based on the layer's `MatteType` configuration.
|
|
145
|
+
/// - Assumes the layers are sorted in z-axis order.
|
|
146
|
+
fileprivate func pairedLayersAndMasks() throws
|
|
147
|
+
-> [(layer: LayerModel, mask: (model: LayerModel, matteType: MatteType)?)]
|
|
148
|
+
{
|
|
149
|
+
var layersAndMasks = [(layer: LayerModel, mask: (model: LayerModel, matteType: MatteType)?)]()
|
|
150
|
+
var unprocessedLayers = reversed()
|
|
151
|
+
|
|
152
|
+
while let layer = unprocessedLayers.popLast() {
|
|
153
|
+
/// If a layer has a `MatteType`, then the next layer will be used as its `mask`
|
|
154
|
+
if
|
|
155
|
+
let matteType = layer.matte,
|
|
156
|
+
matteType != .none,
|
|
157
|
+
let maskLayer = unprocessedLayers.popLast()
|
|
158
|
+
{
|
|
159
|
+
layersAndMasks.append((layer: layer, mask: (model: maskLayer, matteType: matteType)))
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
else {
|
|
163
|
+
layersAndMasks.append((layer: layer, mask: nil))
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
return layersAndMasks
|
|
168
|
+
}
|
|
169
|
+
}
|
package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/GradientRenderLayer.swift
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
// Created by Cal Stephens on 1/10/22.
|
|
2
|
+
// Copyright © 2022 Airbnb Inc. All rights reserved.
|
|
3
|
+
|
|
4
|
+
import QuartzCore
|
|
5
|
+
|
|
6
|
+
// MARK: - GradientRenderLayer
|
|
7
|
+
|
|
8
|
+
/// A `CAGradientLayer` subclass used to render a gradient _outside_ the normal layer bounds
|
|
9
|
+
///
|
|
10
|
+
/// - `GradientFill.startPoint` and `GradientFill.endPoint` are expressed
|
|
11
|
+
/// with respect to the `bounds` of the `ShapeItemLayer`.
|
|
12
|
+
///
|
|
13
|
+
/// - The gradient itself is supposed to be rendered infinitely in all directions
|
|
14
|
+
/// (e.g. including outside of `bounds`). This is because `ShapeItemLayer` paths
|
|
15
|
+
/// don't necessarily sit within the layer's `bounds`.
|
|
16
|
+
///
|
|
17
|
+
/// - To support this, `GradientRenderLayer` tracks a `gradientReferenceBounds`
|
|
18
|
+
/// that `startPoint` / `endPoint` are calculated relative to.
|
|
19
|
+
/// The _actual_ `bounds` of this layer is padded by a large amount so that
|
|
20
|
+
/// the gradient can be drawn outside of the `gradientReferenceBounds`.
|
|
21
|
+
///
|
|
22
|
+
final class GradientRenderLayer: CAGradientLayer {
|
|
23
|
+
|
|
24
|
+
// MARK: Internal
|
|
25
|
+
|
|
26
|
+
/// The reference bounds within this layer that the gradient's
|
|
27
|
+
/// `startPoint` and `endPoint` should be calculated relative to
|
|
28
|
+
var gradientReferenceBounds = CGRect.zero {
|
|
29
|
+
didSet {
|
|
30
|
+
if oldValue != gradientReferenceBounds {
|
|
31
|
+
updateLayout()
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/// Converts the given `CGPoint` within `gradientReferenceBounds`
|
|
37
|
+
/// to a percentage value relative to the full `bounds` of this layer
|
|
38
|
+
/// - This converts absolute `startPoint` and `endPoint` values into
|
|
39
|
+
/// the percent-based values expected by Core Animation,
|
|
40
|
+
/// with respect to the custom bounds geometry used by this layer type.
|
|
41
|
+
func percentBasedPointInBounds(from referencePoint: CGPoint) -> CGPoint {
|
|
42
|
+
guard bounds.width > 0, bounds.height > 0 else {
|
|
43
|
+
LottieLogger.shared.assertionFailure("Size must be non-zero before an animation can be played")
|
|
44
|
+
return .zero
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
let pointInBounds = CGPoint(
|
|
48
|
+
x: referencePoint.x + CALayer.veryLargeLayerPadding,
|
|
49
|
+
y: referencePoint.y + CALayer.veryLargeLayerPadding
|
|
50
|
+
)
|
|
51
|
+
|
|
52
|
+
return CGPoint(
|
|
53
|
+
x: CGFloat(pointInBounds.x) / bounds.width,
|
|
54
|
+
y: CGFloat(pointInBounds.y) / bounds.height
|
|
55
|
+
)
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// MARK: Private
|
|
59
|
+
|
|
60
|
+
private func updateLayout() {
|
|
61
|
+
anchorPoint = .zero
|
|
62
|
+
|
|
63
|
+
bounds = CGRect(
|
|
64
|
+
x: gradientReferenceBounds.origin.x,
|
|
65
|
+
y: gradientReferenceBounds.origin.y,
|
|
66
|
+
width: CALayer.veryLargeLayerPadding + gradientReferenceBounds.width + CALayer.veryLargeLayerPadding,
|
|
67
|
+
height: CALayer.veryLargeLayerPadding + gradientReferenceBounds.height + CALayer.veryLargeLayerPadding
|
|
68
|
+
)
|
|
69
|
+
|
|
70
|
+
// Align the center of this layer to be at the center point of its parent layer
|
|
71
|
+
let superlayerSize = superlayer?.frame.size ?? gradientReferenceBounds.size
|
|
72
|
+
|
|
73
|
+
transform = CATransform3DMakeTranslation(
|
|
74
|
+
(superlayerSize.width - bounds.width) / 2,
|
|
75
|
+
(superlayerSize.height - bounds.height) / 2,
|
|
76
|
+
0
|
|
77
|
+
)
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// MARK: CustomLayoutLayer
|
|
83
|
+
|
|
84
|
+
extension GradientRenderLayer: CustomLayoutLayer {
|
|
85
|
+
func layout(superlayerBounds: CGRect) {
|
|
86
|
+
gradientReferenceBounds = superlayerBounds
|
|
87
|
+
|
|
88
|
+
if let gradientMask = mask as? GradientRenderLayer {
|
|
89
|
+
gradientMask.layout(superlayerBounds: superlayerBounds)
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
extension CALayer {
|
|
95
|
+
/// Extra padding to add around layers that should be very large or "infinite" in size.
|
|
96
|
+
/// Examples include `GradientRenderLayer` and `InfiniteOpaqueAnimationLayer`.
|
|
97
|
+
/// - This specific value is arbitrary and can be increased if necessary.
|
|
98
|
+
/// - Theoretically this should be "infinite", to match the behavior of
|
|
99
|
+
/// `CGContext.drawLinearGradient` with `[.drawsAfterEndLocation, .drawsBeforeStartLocation]` etc.
|
|
100
|
+
static let veryLargeLayerPadding: CGFloat = 10_000
|
|
101
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
// Created by Cal Stephens on 1/10/22.
|
|
2
|
+
// Copyright © 2022 Airbnb Inc. All rights reserved.
|
|
3
|
+
|
|
4
|
+
import QuartzCore
|
|
5
|
+
|
|
6
|
+
// MARK: - ImageLayer
|
|
7
|
+
|
|
8
|
+
/// The `CALayer` type responsible for rendering `ImageLayerModel`s
|
|
9
|
+
final class ImageLayer: BaseCompositionLayer {
|
|
10
|
+
|
|
11
|
+
// MARK: Lifecycle
|
|
12
|
+
|
|
13
|
+
init(
|
|
14
|
+
imageLayer: ImageLayerModel,
|
|
15
|
+
context: LayerContext
|
|
16
|
+
) {
|
|
17
|
+
self.imageLayer = imageLayer
|
|
18
|
+
super.init(layerModel: imageLayer)
|
|
19
|
+
setupImage(context: context)
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
required init?(coder _: NSCoder) {
|
|
23
|
+
fatalError("init(coder:) has not been implemented")
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/// Called by CoreAnimation to create a shadow copy of this layer
|
|
27
|
+
/// More details: https://developer.apple.com/documentation/quartzcore/calayer/1410842-init
|
|
28
|
+
override init(layer: Any) {
|
|
29
|
+
guard let typedLayer = layer as? Self else {
|
|
30
|
+
fatalError("\(Self.self).init(layer:) incorrectly called with \(type(of: layer))")
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
imageLayer = typedLayer.imageLayer
|
|
34
|
+
super.init(layer: typedLayer)
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// MARK: Internal
|
|
38
|
+
|
|
39
|
+
func setupImage(context: LayerContext) {
|
|
40
|
+
guard
|
|
41
|
+
let imageAsset = context.animation.assetLibrary?.imageAssets[imageLayer.referenceID],
|
|
42
|
+
let image = context.imageProvider.imageForAsset(asset: imageAsset)
|
|
43
|
+
else {
|
|
44
|
+
self.imageAsset = nil
|
|
45
|
+
contentsLayer.contents = nil
|
|
46
|
+
return
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
self.imageAsset = imageAsset
|
|
50
|
+
contentsLayer.contents = image
|
|
51
|
+
contentsLayer.contentsGravity = context.imageProvider.contentsGravity(for: imageAsset)
|
|
52
|
+
setNeedsLayout()
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// MARK: Private
|
|
56
|
+
|
|
57
|
+
private let imageLayer: ImageLayerModel
|
|
58
|
+
private var imageAsset: ImageAsset?
|
|
59
|
+
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// MARK: CustomLayoutLayer
|
|
63
|
+
|
|
64
|
+
extension ImageLayer: CustomLayoutLayer {
|
|
65
|
+
func layout(superlayerBounds: CGRect) {
|
|
66
|
+
anchorPoint = .zero
|
|
67
|
+
|
|
68
|
+
guard let imageAsset else {
|
|
69
|
+
bounds = superlayerBounds
|
|
70
|
+
return
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// Image layers specifically need to use the size of the image itself
|
|
74
|
+
bounds = CGRect(
|
|
75
|
+
x: superlayerBounds.origin.x,
|
|
76
|
+
y: superlayerBounds.origin.y,
|
|
77
|
+
width: CGFloat(imageAsset.width),
|
|
78
|
+
height: CGFloat(imageAsset.height)
|
|
79
|
+
)
|
|
80
|
+
}
|
|
81
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
// Created by Cal Stephens on 10/10/22.
|
|
2
|
+
// Copyright © 2022 Airbnb Inc. All rights reserved.
|
|
3
|
+
|
|
4
|
+
import QuartzCore
|
|
5
|
+
|
|
6
|
+
// MARK: - ExpandedAnimationLayer
|
|
7
|
+
|
|
8
|
+
/// A `BaseAnimationLayer` subclass that renders its background color
|
|
9
|
+
/// as if the layer is infinitely large, without affecting its bounds
|
|
10
|
+
/// or the bounds of its sublayers
|
|
11
|
+
final class InfiniteOpaqueAnimationLayer: BaseAnimationLayer {
|
|
12
|
+
|
|
13
|
+
// MARK: Lifecycle
|
|
14
|
+
|
|
15
|
+
override init() {
|
|
16
|
+
super.init()
|
|
17
|
+
addSublayer(additionalPaddingLayer)
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
required init?(coder _: NSCoder) {
|
|
21
|
+
fatalError("init(coder:) has not been implemented")
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/// Called by CoreAnimation to create a shadow copy of this layer
|
|
25
|
+
/// More details: https://developer.apple.com/documentation/quartzcore/calayer/1410842-init
|
|
26
|
+
override init(layer: Any) {
|
|
27
|
+
super.init(layer: layer)
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// MARK: Internal
|
|
31
|
+
|
|
32
|
+
override func layoutSublayers() {
|
|
33
|
+
super.layoutSublayers()
|
|
34
|
+
|
|
35
|
+
masksToBounds = false
|
|
36
|
+
additionalPaddingLayer.backgroundColor = backgroundColor
|
|
37
|
+
|
|
38
|
+
// Scale `additionalPaddingLayer` to be larger than this layer
|
|
39
|
+
// by `additionalPadding` at each size, and centered at the center
|
|
40
|
+
// of this layer. Since `additionalPadding` is very large, this has
|
|
41
|
+
// the affect of making `additionalPaddingLayer` appear infinite.
|
|
42
|
+
let scaleRatioX = (bounds.width + (CALayer.veryLargeLayerPadding * 2)) / bounds.width
|
|
43
|
+
let scaleRatioY = (bounds.height + (CALayer.veryLargeLayerPadding * 2)) / bounds.height
|
|
44
|
+
|
|
45
|
+
additionalPaddingLayer.transform = CATransform3DScale(
|
|
46
|
+
CATransform3DMakeTranslation(-CALayer.veryLargeLayerPadding, -CALayer.veryLargeLayerPadding, 0),
|
|
47
|
+
scaleRatioX,
|
|
48
|
+
scaleRatioY,
|
|
49
|
+
1
|
|
50
|
+
)
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// MARK: Private
|
|
54
|
+
|
|
55
|
+
private let additionalPaddingLayer = CALayer()
|
|
56
|
+
|
|
57
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
// Created by Cal Stephens on 12/20/21.
|
|
2
|
+
// Copyright © 2021 Airbnb Inc. All rights reserved.
|
|
3
|
+
|
|
4
|
+
// MARK: - LayerContext
|
|
5
|
+
|
|
6
|
+
/// Context available when constructing an `AnimationLayer`
|
|
7
|
+
struct LayerContext {
|
|
8
|
+
let animation: LottieAnimation
|
|
9
|
+
let imageProvider: AnimationImageProvider
|
|
10
|
+
let textProvider: AnimationKeypathTextProvider
|
|
11
|
+
let fontProvider: AnimationFontProvider
|
|
12
|
+
let compatibilityTracker: CompatibilityTracker
|
|
13
|
+
var layerName: String
|
|
14
|
+
|
|
15
|
+
func forLayer(_ layer: LayerModel) -> LayerContext {
|
|
16
|
+
var context = self
|
|
17
|
+
context.layerName = layer.name
|
|
18
|
+
return context
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
// MARK: - LayerModel + makeAnimationLayer
|
|
23
|
+
|
|
24
|
+
extension LayerModel {
|
|
25
|
+
/// Constructs an `AnimationLayer` / `CALayer` that represents this `LayerModel`
|
|
26
|
+
func makeAnimationLayer(context: LayerContext) throws -> BaseCompositionLayer? {
|
|
27
|
+
let context = context.forLayer(self)
|
|
28
|
+
|
|
29
|
+
if hidden {
|
|
30
|
+
return TransformLayer(layerModel: self)
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
switch (type, self) {
|
|
34
|
+
case (.precomp, let preCompLayerModel as PreCompLayerModel):
|
|
35
|
+
let preCompLayer = PreCompLayer(preCompLayer: preCompLayerModel)
|
|
36
|
+
try preCompLayer.setup(context: context)
|
|
37
|
+
return preCompLayer
|
|
38
|
+
|
|
39
|
+
case (.solid, let solidLayerModel as SolidLayerModel):
|
|
40
|
+
return SolidLayer(solidLayerModel)
|
|
41
|
+
|
|
42
|
+
case (.shape, let shapeLayerModel as ShapeLayerModel):
|
|
43
|
+
return try ShapeLayer(shapeLayer: shapeLayerModel, context: context)
|
|
44
|
+
|
|
45
|
+
case (.image, let imageLayerModel as ImageLayerModel):
|
|
46
|
+
return ImageLayer(imageLayer: imageLayerModel, context: context)
|
|
47
|
+
|
|
48
|
+
case (.text, let textLayerModel as TextLayerModel):
|
|
49
|
+
return try TextLayer(textLayerModel: textLayerModel, context: context)
|
|
50
|
+
|
|
51
|
+
case (.null, _):
|
|
52
|
+
return TransformLayer(layerModel: self)
|
|
53
|
+
|
|
54
|
+
case (.unknown, _), (.precomp, _), (.solid, _), (.image, _), (.shape, _), (.text, _):
|
|
55
|
+
return nil
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
}
|