@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
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// Created by Cal Stephens on 1/11/22.
|
|
2
|
+
// Copyright © 2022 Airbnb Inc. All rights reserved.
|
|
3
|
+
|
|
4
|
+
// MARK: - KeyframeGroup + exactlyOneKeyframe
|
|
5
|
+
|
|
6
|
+
extension KeyframeGroup {
|
|
7
|
+
/// Retrieves the first `Keyframe` from this group,
|
|
8
|
+
/// and asserts that there are not any extra keyframes that would be ignored
|
|
9
|
+
/// - This should only be used in cases where it's fundamentally not possible to
|
|
10
|
+
/// support animating a given property (e.g. if Core Animation itself doesn't
|
|
11
|
+
/// support the property).
|
|
12
|
+
func exactlyOneKeyframe(
|
|
13
|
+
context: CompatibilityTrackerProviding,
|
|
14
|
+
description: String,
|
|
15
|
+
fileID _: StaticString = #fileID,
|
|
16
|
+
line _: UInt = #line
|
|
17
|
+
) throws -> T {
|
|
18
|
+
try context.compatibilityAssert(
|
|
19
|
+
keyframes.count == 1,
|
|
20
|
+
"""
|
|
21
|
+
The Core Animation rendering engine does not support animating multiple keyframes
|
|
22
|
+
for \(description) values, due to limitations of Core Animation.
|
|
23
|
+
"""
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
return keyframes[0].value
|
|
27
|
+
}
|
|
28
|
+
}
|
package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Extensions/Keyframes+combined.swift
ADDED
|
@@ -0,0 +1,345 @@
|
|
|
1
|
+
// Created by Cal Stephens on 1/28/22.
|
|
2
|
+
// Copyright © 2022 Airbnb Inc. All rights reserved.
|
|
3
|
+
|
|
4
|
+
// MARK: - Keyframes
|
|
5
|
+
|
|
6
|
+
enum Keyframes {
|
|
7
|
+
|
|
8
|
+
// MARK: Internal
|
|
9
|
+
|
|
10
|
+
/// Combines the given keyframe groups of `Keyframe<T>`s into a single keyframe group of of `Keyframe<[T]>`s
|
|
11
|
+
/// - If all of the `KeyframeGroup`s have the exact same animation timing, the keyframes are merged
|
|
12
|
+
/// - Otherwise, the keyframes are manually interpolated at each frame in the animation
|
|
13
|
+
static func combined<T: AnyInterpolatable>(
|
|
14
|
+
_ allGroups: [KeyframeGroup<T>],
|
|
15
|
+
requiresManualInterpolation: Bool = false
|
|
16
|
+
) -> KeyframeGroup<[T]> {
|
|
17
|
+
Keyframes.combined(
|
|
18
|
+
allGroups,
|
|
19
|
+
requiresManualInterpolation: requiresManualInterpolation,
|
|
20
|
+
makeCombinedResult: { untypedValues in
|
|
21
|
+
untypedValues.compactMap { $0 as? T }
|
|
22
|
+
}
|
|
23
|
+
)
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/// Combines the given keyframe groups of `Keyframe<T>`s into a single keyframe group of of `Keyframe<[T]>`s
|
|
27
|
+
/// - If all of the `KeyframeGroup`s have the exact same animation timing, the keyframes are merged
|
|
28
|
+
/// - Otherwise, the keyframes are manually interpolated at each frame in the animation
|
|
29
|
+
static func combined<T1: AnyInterpolatable, T2: AnyInterpolatable, CombinedResult>(
|
|
30
|
+
_ k1: KeyframeGroup<T1>,
|
|
31
|
+
_ k2: KeyframeGroup<T2>,
|
|
32
|
+
requiresManualInterpolation: Bool = false,
|
|
33
|
+
makeCombinedResult: (T1, T2) throws -> CombinedResult
|
|
34
|
+
) rethrows -> KeyframeGroup<CombinedResult> {
|
|
35
|
+
try Keyframes.combined(
|
|
36
|
+
[k1, k2],
|
|
37
|
+
requiresManualInterpolation: requiresManualInterpolation,
|
|
38
|
+
makeCombinedResult: { untypedValues in
|
|
39
|
+
guard
|
|
40
|
+
let t1 = untypedValues[0] as? T1,
|
|
41
|
+
let t2 = untypedValues[1] as? T2
|
|
42
|
+
else { return nil }
|
|
43
|
+
|
|
44
|
+
return try makeCombinedResult(t1, t2)
|
|
45
|
+
}
|
|
46
|
+
)
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/// Combines the given keyframe groups of `Keyframe<T>`s into a single keyframe group of of `Keyframe<[T]>`s
|
|
50
|
+
/// - If all of the `KeyframeGroup`s have the exact same animation timing, the keyframes are merged
|
|
51
|
+
/// - Otherwise, the keyframes are manually interpolated at each frame in the animation
|
|
52
|
+
static func combined<T1: AnyInterpolatable, T2: AnyInterpolatable, T3: AnyInterpolatable, CombinedResult>(
|
|
53
|
+
_ k1: KeyframeGroup<T1>,
|
|
54
|
+
_ k2: KeyframeGroup<T2>,
|
|
55
|
+
_ k3: KeyframeGroup<T3>,
|
|
56
|
+
requiresManualInterpolation: Bool = false,
|
|
57
|
+
makeCombinedResult: (T1, T2, T3) -> CombinedResult
|
|
58
|
+
) -> KeyframeGroup<CombinedResult> {
|
|
59
|
+
Keyframes.combined(
|
|
60
|
+
[k1, k2, k3],
|
|
61
|
+
requiresManualInterpolation: requiresManualInterpolation,
|
|
62
|
+
makeCombinedResult: { untypedValues in
|
|
63
|
+
guard
|
|
64
|
+
let t1 = untypedValues[0] as? T1,
|
|
65
|
+
let t2 = untypedValues[1] as? T2,
|
|
66
|
+
let t3 = untypedValues[2] as? T3
|
|
67
|
+
else { return nil }
|
|
68
|
+
|
|
69
|
+
return makeCombinedResult(t1, t2, t3)
|
|
70
|
+
}
|
|
71
|
+
)
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/// Combines the given keyframe groups of `Keyframe<T>`s into a single keyframe group of of `Keyframe<[T]>`s
|
|
75
|
+
/// - If all of the `KeyframeGroup`s have the exact same animation timing, the keyframes are merged
|
|
76
|
+
/// - Otherwise, the keyframes are manually interpolated at each frame in the animation
|
|
77
|
+
static func combined<
|
|
78
|
+
T1: AnyInterpolatable,
|
|
79
|
+
T2: AnyInterpolatable,
|
|
80
|
+
T3: AnyInterpolatable,
|
|
81
|
+
T4: AnyInterpolatable,
|
|
82
|
+
T5: AnyInterpolatable,
|
|
83
|
+
T6: AnyInterpolatable,
|
|
84
|
+
T7: AnyInterpolatable,
|
|
85
|
+
CombinedResult
|
|
86
|
+
>(
|
|
87
|
+
_ k1: KeyframeGroup<T1>,
|
|
88
|
+
_ k2: KeyframeGroup<T2>,
|
|
89
|
+
_ k3: KeyframeGroup<T3>,
|
|
90
|
+
_ k4: KeyframeGroup<T4>,
|
|
91
|
+
_ k5: KeyframeGroup<T5>,
|
|
92
|
+
_ k6: KeyframeGroup<T6>,
|
|
93
|
+
_ k7: KeyframeGroup<T7>,
|
|
94
|
+
requiresManualInterpolation: Bool = false,
|
|
95
|
+
makeCombinedResult: (T1, T2, T3, T4, T5, T6, T7) -> CombinedResult
|
|
96
|
+
) -> KeyframeGroup<CombinedResult> {
|
|
97
|
+
Keyframes.combined(
|
|
98
|
+
[k1, k2, k3, k4, k5, k6, k7],
|
|
99
|
+
requiresManualInterpolation: requiresManualInterpolation,
|
|
100
|
+
makeCombinedResult: { untypedValues in
|
|
101
|
+
guard
|
|
102
|
+
let t1 = untypedValues[0] as? T1,
|
|
103
|
+
let t2 = untypedValues[1] as? T2,
|
|
104
|
+
let t3 = untypedValues[2] as? T3,
|
|
105
|
+
let t4 = untypedValues[3] as? T4,
|
|
106
|
+
let t5 = untypedValues[4] as? T5,
|
|
107
|
+
let t6 = untypedValues[5] as? T6,
|
|
108
|
+
let t7 = untypedValues[6] as? T7
|
|
109
|
+
else { return nil }
|
|
110
|
+
|
|
111
|
+
return makeCombinedResult(t1, t2, t3, t4, t5, t6, t7)
|
|
112
|
+
}
|
|
113
|
+
)
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/// Combines the given keyframe groups of `Keyframe<T>`s into a single keyframe group of of `Keyframe<[T]>`s
|
|
117
|
+
/// - If all of the `KeyframeGroup`s have the exact same animation timing, the keyframes are merged
|
|
118
|
+
/// - Otherwise, the keyframes are manually interpolated at each frame in the animation
|
|
119
|
+
static func combined<
|
|
120
|
+
T1: AnyInterpolatable,
|
|
121
|
+
T2: AnyInterpolatable,
|
|
122
|
+
T3: AnyInterpolatable,
|
|
123
|
+
T4: AnyInterpolatable,
|
|
124
|
+
T5: AnyInterpolatable,
|
|
125
|
+
T6: AnyInterpolatable,
|
|
126
|
+
T7: AnyInterpolatable,
|
|
127
|
+
T8: AnyInterpolatable,
|
|
128
|
+
CombinedResult
|
|
129
|
+
>(
|
|
130
|
+
_ k1: KeyframeGroup<T1>,
|
|
131
|
+
_ k2: KeyframeGroup<T2>,
|
|
132
|
+
_ k3: KeyframeGroup<T3>,
|
|
133
|
+
_ k4: KeyframeGroup<T4>,
|
|
134
|
+
_ k5: KeyframeGroup<T5>,
|
|
135
|
+
_ k6: KeyframeGroup<T6>,
|
|
136
|
+
_ k7: KeyframeGroup<T7>,
|
|
137
|
+
_ k8: KeyframeGroup<T8>,
|
|
138
|
+
requiresManualInterpolation: Bool = false,
|
|
139
|
+
makeCombinedResult: (T1, T2, T3, T4, T5, T6, T7, T8) -> CombinedResult
|
|
140
|
+
) -> KeyframeGroup<CombinedResult> {
|
|
141
|
+
Keyframes.combined(
|
|
142
|
+
[k1, k2, k3, k4, k5, k6, k7, k8],
|
|
143
|
+
requiresManualInterpolation: requiresManualInterpolation,
|
|
144
|
+
makeCombinedResult: { untypedValues in
|
|
145
|
+
guard
|
|
146
|
+
let t1 = untypedValues[0] as? T1,
|
|
147
|
+
let t2 = untypedValues[1] as? T2,
|
|
148
|
+
let t3 = untypedValues[2] as? T3,
|
|
149
|
+
let t4 = untypedValues[3] as? T4,
|
|
150
|
+
let t5 = untypedValues[4] as? T5,
|
|
151
|
+
let t6 = untypedValues[5] as? T6,
|
|
152
|
+
let t7 = untypedValues[6] as? T7,
|
|
153
|
+
let t8 = untypedValues[7] as? T8
|
|
154
|
+
else { return nil }
|
|
155
|
+
|
|
156
|
+
return makeCombinedResult(t1, t2, t3, t4, t5, t6, t7, t8)
|
|
157
|
+
}
|
|
158
|
+
)
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
/// Combines the given keyframe groups of `Keyframe<T>`s into a single keyframe group of of `Keyframe<[T]>`s
|
|
162
|
+
/// - If all of the `KeyframeGroup`s have the exact same animation timing, the keyframes are merged
|
|
163
|
+
/// - Otherwise, the keyframes are manually interpolated at each frame in the animation
|
|
164
|
+
static func combined<
|
|
165
|
+
T1: AnyInterpolatable,
|
|
166
|
+
T2: AnyInterpolatable,
|
|
167
|
+
T3: AnyInterpolatable,
|
|
168
|
+
T4: AnyInterpolatable,
|
|
169
|
+
T5: AnyInterpolatable,
|
|
170
|
+
T6: AnyInterpolatable,
|
|
171
|
+
T7: AnyInterpolatable,
|
|
172
|
+
T8: AnyInterpolatable,
|
|
173
|
+
T9: AnyInterpolatable,
|
|
174
|
+
T10: AnyInterpolatable,
|
|
175
|
+
CombinedResult
|
|
176
|
+
>(
|
|
177
|
+
_ k1: KeyframeGroup<T1>,
|
|
178
|
+
_ k2: KeyframeGroup<T2>,
|
|
179
|
+
_ k3: KeyframeGroup<T3>,
|
|
180
|
+
_ k4: KeyframeGroup<T4>,
|
|
181
|
+
_ k5: KeyframeGroup<T5>,
|
|
182
|
+
_ k6: KeyframeGroup<T6>,
|
|
183
|
+
_ k7: KeyframeGroup<T7>,
|
|
184
|
+
_ k8: KeyframeGroup<T8>,
|
|
185
|
+
_ k9: KeyframeGroup<T9>,
|
|
186
|
+
_ k10: KeyframeGroup<T10>,
|
|
187
|
+
requiresManualInterpolation: Bool = false,
|
|
188
|
+
makeCombinedResult: (T1, T2, T3, T4, T5, T6, T7, T8, T9, T10) -> CombinedResult
|
|
189
|
+
) -> KeyframeGroup<CombinedResult> {
|
|
190
|
+
Keyframes.combined(
|
|
191
|
+
[k1, k2, k3, k4, k5, k6, k7, k8, k9, k10],
|
|
192
|
+
requiresManualInterpolation: requiresManualInterpolation,
|
|
193
|
+
makeCombinedResult: { untypedValues in
|
|
194
|
+
guard
|
|
195
|
+
let t1 = untypedValues[0] as? T1,
|
|
196
|
+
let t2 = untypedValues[1] as? T2,
|
|
197
|
+
let t3 = untypedValues[2] as? T3,
|
|
198
|
+
let t4 = untypedValues[3] as? T4,
|
|
199
|
+
let t5 = untypedValues[4] as? T5,
|
|
200
|
+
let t6 = untypedValues[5] as? T6,
|
|
201
|
+
let t7 = untypedValues[6] as? T7,
|
|
202
|
+
let t8 = untypedValues[7] as? T8,
|
|
203
|
+
let t9 = untypedValues[8] as? T9,
|
|
204
|
+
let t10 = untypedValues[9] as? T10
|
|
205
|
+
else { return nil }
|
|
206
|
+
|
|
207
|
+
return makeCombinedResult(t1, t2, t3, t4, t5, t6, t7, t8, t9, t10)
|
|
208
|
+
}
|
|
209
|
+
)
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
// MARK: Private
|
|
213
|
+
|
|
214
|
+
/// Combines the given `[KeyframeGroup]` of `Keyframe<T>`s into a single `KeyframeGroup` of `Keyframe<CombinedResult>`s
|
|
215
|
+
/// - If all of the `KeyframeGroup`s have the exact same animation timing, the keyframes are merged
|
|
216
|
+
/// - Otherwise, the keyframes are manually interpolated at each frame in the animation
|
|
217
|
+
///
|
|
218
|
+
/// `makeCombinedResult` is a closure that takes an array of keyframe values (with the exact same length as `AnyKeyframeGroup`),
|
|
219
|
+
/// casts them to the expected type, and combined them into the final resulting keyframe.
|
|
220
|
+
///
|
|
221
|
+
/// `requiresManualInterpolation` determines whether the keyframes must be computed using `Keyframes.manuallyInterpolated`,
|
|
222
|
+
/// which interpolates the value at each frame, or if the keyframes can simply be combined.
|
|
223
|
+
private static func combined<CombinedResult>(
|
|
224
|
+
_ allGroups: [AnyKeyframeGroup],
|
|
225
|
+
requiresManualInterpolation: Bool,
|
|
226
|
+
makeCombinedResult: ([Any]) throws -> CombinedResult?
|
|
227
|
+
) rethrows -> KeyframeGroup<CombinedResult> {
|
|
228
|
+
let untypedGroups = allGroups.map { $0.untyped }
|
|
229
|
+
|
|
230
|
+
// Animations with no timing information (e.g. with just a single keyframe)
|
|
231
|
+
// can be trivially combined with any other set of keyframes, so we don't need
|
|
232
|
+
// to check those.
|
|
233
|
+
let animatingKeyframes = untypedGroups.filter { $0.keyframes.count > 1 }
|
|
234
|
+
|
|
235
|
+
guard
|
|
236
|
+
!requiresManualInterpolation,
|
|
237
|
+
!allGroups.isEmpty,
|
|
238
|
+
animatingKeyframes.allSatisfy({ $0.hasSameTimingParameters(as: animatingKeyframes[0]) })
|
|
239
|
+
else {
|
|
240
|
+
// If the keyframes don't all share the same timing information,
|
|
241
|
+
// we have to interpolate the value at each individual frame
|
|
242
|
+
return try Keyframes.manuallyInterpolated(allGroups, makeCombinedResult: makeCombinedResult)
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
var combinedKeyframes = ContiguousArray<Keyframe<CombinedResult>>()
|
|
246
|
+
let baseKeyframes = (animatingKeyframes.first ?? untypedGroups[0]).keyframes
|
|
247
|
+
|
|
248
|
+
for index in baseKeyframes.indices {
|
|
249
|
+
let baseKeyframe = baseKeyframes[index]
|
|
250
|
+
let untypedValues = untypedGroups.map { $0.valueForCombinedKeyframes(at: index) }
|
|
251
|
+
|
|
252
|
+
if let combinedValue = try makeCombinedResult(untypedValues) {
|
|
253
|
+
combinedKeyframes.append(baseKeyframe.withValue(combinedValue))
|
|
254
|
+
} else {
|
|
255
|
+
LottieLogger.shared.assertionFailure("""
|
|
256
|
+
Failed to cast untyped keyframe values to expected type. This is an internal error.
|
|
257
|
+
""")
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
return KeyframeGroup(keyframes: combinedKeyframes)
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
private static func manuallyInterpolated<CombinedResult>(
|
|
265
|
+
_ allGroups: [AnyKeyframeGroup],
|
|
266
|
+
makeCombinedResult: ([Any]) throws -> CombinedResult?
|
|
267
|
+
) rethrows -> KeyframeGroup<CombinedResult> {
|
|
268
|
+
let untypedGroups = allGroups.map { $0.untyped }
|
|
269
|
+
let untypedInterpolators = allGroups.map { $0.interpolator }
|
|
270
|
+
|
|
271
|
+
let times = untypedGroups.flatMap { $0.keyframes.map { $0.time } }
|
|
272
|
+
|
|
273
|
+
let minimumTime = times.min() ?? 0
|
|
274
|
+
let maximumTime = times.max() ?? 0
|
|
275
|
+
|
|
276
|
+
// We disable Core Animation interpolation when using manually interpolated keyframes,
|
|
277
|
+
// so we don't animate between these values. To prevent the animation from being choppy
|
|
278
|
+
// even at low playback speed, we have to interpolate at a very high fidelity.
|
|
279
|
+
let animationLocalTimeRange = stride(from: minimumTime, to: maximumTime, by: 0.1)
|
|
280
|
+
|
|
281
|
+
let interpolatedKeyframes = try animationLocalTimeRange.compactMap { localTime -> Keyframe<CombinedResult>? in
|
|
282
|
+
let interpolatedValues = untypedInterpolators.map { interpolator in
|
|
283
|
+
interpolator.value(frame: AnimationFrameTime(localTime))
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
guard let combinedResult = try makeCombinedResult(interpolatedValues) else {
|
|
287
|
+
LottieLogger.shared.assertionFailure("""
|
|
288
|
+
Failed to cast untyped keyframe values to expected type. This is an internal error.
|
|
289
|
+
""")
|
|
290
|
+
return nil
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
return Keyframe(
|
|
294
|
+
value: combinedResult,
|
|
295
|
+
time: AnimationFrameTime(localTime),
|
|
296
|
+
// Since we already manually interpolated the keyframes, have Core Animation display
|
|
297
|
+
// each value as a static keyframe rather than trying to interpolate between them.
|
|
298
|
+
isHold: true
|
|
299
|
+
)
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
return KeyframeGroup(keyframes: ContiguousArray(interpolatedKeyframes))
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
extension KeyframeGroup {
|
|
308
|
+
/// Whether or not all of the keyframes in this `KeyframeGroup` have the same
|
|
309
|
+
/// timing parameters as the corresponding keyframe in the other given `KeyframeGroup`
|
|
310
|
+
func hasSameTimingParameters<U>(as other: KeyframeGroup<U>) -> Bool {
|
|
311
|
+
guard keyframes.count == other.keyframes.count else {
|
|
312
|
+
return false
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
return zip(keyframes, other.keyframes).allSatisfy {
|
|
316
|
+
$0.hasSameTimingParameters(as: $1)
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
extension Keyframe {
|
|
322
|
+
/// Whether or not this keyframe has the same timing parameters as the given keyframe,
|
|
323
|
+
/// excluding `spatialInTangent` and `spatialOutTangent`.
|
|
324
|
+
fileprivate func hasSameTimingParameters<U>(as other: Keyframe<U>) -> Bool {
|
|
325
|
+
time == other.time
|
|
326
|
+
&& isHold == other.isHold
|
|
327
|
+
&& inTangent == other.inTangent
|
|
328
|
+
&& outTangent == other.outTangent
|
|
329
|
+
// We intentionally don't compare spatial in/out tangents,
|
|
330
|
+
// since those values are only used in very specific cases
|
|
331
|
+
// (animating the x/y position of a layer), which aren't ever
|
|
332
|
+
// combined in this way.
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
extension KeyframeGroup {
|
|
337
|
+
/// The value to use for a combined set of keyframes, for the given index
|
|
338
|
+
fileprivate func valueForCombinedKeyframes(at index: Int) -> T {
|
|
339
|
+
if keyframes.count == 1 {
|
|
340
|
+
keyframes[0].value
|
|
341
|
+
} else {
|
|
342
|
+
keyframes[index].value
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
// Created by Cal Stephens on 1/8/24.
|
|
2
|
+
// Copyright © 2024 Airbnb Inc. All rights reserved.
|
|
3
|
+
|
|
4
|
+
extension Keyframes {
|
|
5
|
+
/// Manually interpolates the given keyframes, and applies `context.complexTimeRemapping`.
|
|
6
|
+
/// - Since `complexTimeRemapping` is a mapping from "global time" to "local time",
|
|
7
|
+
/// we have to manually interpolate the keyframes at every frame in the animation.
|
|
8
|
+
static func manuallyInterpolatedWithTimeRemapping<T: AnyInterpolatable>(
|
|
9
|
+
_ keyframes: KeyframeGroup<T>,
|
|
10
|
+
context: LayerAnimationContext
|
|
11
|
+
) -> KeyframeGroup<T> {
|
|
12
|
+
let minimumTime = context.animation.startFrame
|
|
13
|
+
let maximumTime = context.animation.endFrame
|
|
14
|
+
let animationLocalTimeRange = stride(from: minimumTime, to: maximumTime, by: 1.0)
|
|
15
|
+
|
|
16
|
+
let interpolator = keyframes.interpolator
|
|
17
|
+
|
|
18
|
+
// Since potentially many global times can refer to the same local time,
|
|
19
|
+
// we can cache and reused these local-time values.
|
|
20
|
+
var localTimeCache = [AnimationFrameTime: T]()
|
|
21
|
+
|
|
22
|
+
let interpolatedRemappedKeyframes = animationLocalTimeRange.compactMap { globalTime -> Keyframe<T>? in
|
|
23
|
+
let remappedLocalTime = context.complexTimeRemapping(globalTime)
|
|
24
|
+
|
|
25
|
+
let valueAtRemappedTime: T
|
|
26
|
+
if let cachedValue = localTimeCache[remappedLocalTime] {
|
|
27
|
+
valueAtRemappedTime = cachedValue
|
|
28
|
+
} else if let interpolatedValue = interpolator.value(frame: remappedLocalTime) as? T {
|
|
29
|
+
valueAtRemappedTime = interpolatedValue
|
|
30
|
+
localTimeCache[remappedLocalTime] = interpolatedValue
|
|
31
|
+
} else {
|
|
32
|
+
LottieLogger.shared.assertionFailure("""
|
|
33
|
+
Failed to cast untyped keyframe values to expected type. This is an internal error.
|
|
34
|
+
""")
|
|
35
|
+
return nil
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
return Keyframe(
|
|
39
|
+
value: valueAtRemappedTime,
|
|
40
|
+
time: AnimationFrameTime(globalTime)
|
|
41
|
+
)
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
return KeyframeGroup(keyframes: ContiguousArray(interpolatedRemappedKeyframes))
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
// Created by Cal Stephens on 12/14/21.
|
|
2
|
+
// Copyright © 2021 Airbnb Inc. All rights reserved.
|
|
3
|
+
|
|
4
|
+
import QuartzCore
|
|
5
|
+
|
|
6
|
+
// MARK: - AnimationLayer
|
|
7
|
+
|
|
8
|
+
/// A type of `CALayer` that can be used in a Lottie animation
|
|
9
|
+
/// - Layers backed by a `LayerModel` subclass should subclass `BaseCompositionLayer`
|
|
10
|
+
protocol AnimationLayer: CALayer {
|
|
11
|
+
/// Instructs this layer to setup its `CAAnimation`s
|
|
12
|
+
/// using the given `LayerAnimationContext`
|
|
13
|
+
func setupAnimations(context: LayerAnimationContext) throws
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
// MARK: - LayerAnimationContext
|
|
17
|
+
|
|
18
|
+
/// Context describing the timing parameters of the current animation
|
|
19
|
+
struct LayerAnimationContext {
|
|
20
|
+
/// The animation being played
|
|
21
|
+
let animation: LottieAnimation
|
|
22
|
+
|
|
23
|
+
/// The timing configuration that should be applied to `CAAnimation`s
|
|
24
|
+
let timingConfiguration: CoreAnimationLayer.CAMediaTimingConfiguration
|
|
25
|
+
|
|
26
|
+
/// The absolute frame number that this animation begins at
|
|
27
|
+
let startFrame: AnimationFrameTime
|
|
28
|
+
|
|
29
|
+
/// The absolute frame number that this animation ends at
|
|
30
|
+
let endFrame: AnimationFrameTime
|
|
31
|
+
|
|
32
|
+
/// The set of custom Value Providers applied to this animation
|
|
33
|
+
let valueProviderStore: ValueProviderStore
|
|
34
|
+
|
|
35
|
+
/// Information about whether or not an animation is compatible with the Core Animation engine
|
|
36
|
+
let compatibilityTracker: CompatibilityTracker
|
|
37
|
+
|
|
38
|
+
/// The logger that should be used for assertions and warnings
|
|
39
|
+
let logger: LottieLogger
|
|
40
|
+
|
|
41
|
+
/// Mutable state related to log events, stored on the `CoreAnimationLayer`.
|
|
42
|
+
let loggingState: LoggingState
|
|
43
|
+
|
|
44
|
+
/// The AnimationKeypath represented by the current layer
|
|
45
|
+
var currentKeypath: AnimationKeypath
|
|
46
|
+
|
|
47
|
+
/// The `AnimationKeypathTextProvider`
|
|
48
|
+
var textProvider: AnimationKeypathTextProvider
|
|
49
|
+
|
|
50
|
+
/// Records the given animation keypath so it can be logged or collected into a list
|
|
51
|
+
/// - Used for `CoreAnimationLayer.logHierarchyKeypaths()` and `allHierarchyKeypaths()`
|
|
52
|
+
var recordHierarchyKeypath: ((String) -> Void)?
|
|
53
|
+
|
|
54
|
+
/// A closure that remaps the given frame in the child layer's local time to a frame
|
|
55
|
+
/// in the animation's overall global time.
|
|
56
|
+
/// - This time remapping is simple and only used `preCompLayer.timeStretch` and `preCompLayer.startTime`,
|
|
57
|
+
/// so is a trivial function and is invertible. This allows us to invert the time remapping from
|
|
58
|
+
/// "global time to local time" to instead be "local time to global time".
|
|
59
|
+
private(set) var simpleTimeRemapping: ((_ localTime: AnimationFrameTime) -> AnimationFrameTime) = { $0 }
|
|
60
|
+
|
|
61
|
+
/// A complex time remapping closure that remaps the given frame in the animation's overall global time
|
|
62
|
+
/// into the child layer's local time.
|
|
63
|
+
/// - This time remapping is arbitrarily complex because it includes the full `preCompLayer.timeRemapping`.
|
|
64
|
+
/// - Since it isn't possible to invert the time remapping function, this can only be applied by converting
|
|
65
|
+
/// from global time to local time. This requires using `Keyframes.manuallyInterpolatedWithTimeRemapping`.
|
|
66
|
+
private(set) var complexTimeRemapping: ((_ globalTime: AnimationFrameTime) -> AnimationFrameTime) = { $0 }
|
|
67
|
+
|
|
68
|
+
/// Whether or not this layer is required to use the `complexTimeRemapping` via
|
|
69
|
+
/// the more expensive `Keyframes.manuallyInterpolatedWithTimeRemapping` codepath.
|
|
70
|
+
var mustUseComplexTimeRemapping = false
|
|
71
|
+
|
|
72
|
+
/// The duration of the animation
|
|
73
|
+
var animationDuration: AnimationFrameTime {
|
|
74
|
+
// Normal animation playback (like when looping) skips the last frame.
|
|
75
|
+
// However when the animation is paused, we need to be able to render the final frame.
|
|
76
|
+
// To allow this we have to extend the length of the animation by one frame.
|
|
77
|
+
let animationEndFrame: AnimationFrameTime =
|
|
78
|
+
if timingConfiguration.speed == 0 {
|
|
79
|
+
animation.endFrame + 1
|
|
80
|
+
} else {
|
|
81
|
+
animation.endFrame
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
return Double(animationEndFrame - animation.startFrame) / animation.framerate
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/// Adds the given component string to the `AnimationKeypath` stored
|
|
88
|
+
/// that describes the current path being configured by this context value
|
|
89
|
+
func addingKeypathComponent(_ component: String) -> LayerAnimationContext {
|
|
90
|
+
var context = self
|
|
91
|
+
context.currentKeypath.keys.append(component)
|
|
92
|
+
return context
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/// The `AnimationProgressTime` for the given `AnimationFrameTime` within this layer,
|
|
96
|
+
/// accounting for the `simpleTimeRemapping` applied to this layer.
|
|
97
|
+
func progressTime(for frame: AnimationFrameTime) throws -> AnimationProgressTime {
|
|
98
|
+
try compatibilityAssert(
|
|
99
|
+
!mustUseComplexTimeRemapping,
|
|
100
|
+
"LayerAnimationContext.time(forFrame:) does not support complex time remapping"
|
|
101
|
+
)
|
|
102
|
+
|
|
103
|
+
let animationFrameCount = animationDuration * animation.framerate
|
|
104
|
+
return (simpleTimeRemapping(frame) - animation.startFrame) / animationFrameCount
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/// The real-time `TimeInterval` for the given `AnimationFrameTime` within this layer,
|
|
108
|
+
/// accounting for the `simpleTimeRemapping` applied to this layer.
|
|
109
|
+
func time(forFrame frame: AnimationFrameTime) throws -> TimeInterval {
|
|
110
|
+
try compatibilityAssert(
|
|
111
|
+
!mustUseComplexTimeRemapping,
|
|
112
|
+
"LayerAnimationContext.time(forFrame:) does not support complex time remapping"
|
|
113
|
+
)
|
|
114
|
+
|
|
115
|
+
return animation.time(forFrame: simpleTimeRemapping(frame))
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/// Chains an additional time remapping closure onto the `simpleTimeRemapping` closure
|
|
119
|
+
func withSimpleTimeRemapping(
|
|
120
|
+
_ additionalSimpleTimeRemapping: @escaping (_ localTime: AnimationFrameTime) -> AnimationFrameTime
|
|
121
|
+
) -> LayerAnimationContext {
|
|
122
|
+
var copy = self
|
|
123
|
+
copy.simpleTimeRemapping = { [existingSimpleTimeRemapping = simpleTimeRemapping] time in
|
|
124
|
+
existingSimpleTimeRemapping(additionalSimpleTimeRemapping(time))
|
|
125
|
+
}
|
|
126
|
+
return copy
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/// Chains an additional time remapping closure onto the `complexTimeRemapping` closure.
|
|
130
|
+
/// - If `required` is `true`, all subsequent child layers will be required to use the expensive
|
|
131
|
+
/// `complexTimeRemapping` / `Keyframes.manuallyInterpolatedWithTimeRemapping` codepath.
|
|
132
|
+
/// - `required: true` is necessary when this time remapping is not available via `simpleTimeRemapping`.
|
|
133
|
+
func withComplexTimeRemapping(
|
|
134
|
+
required: Bool,
|
|
135
|
+
_ additionalComplexTimeRemapping: @escaping (_ globalTime: AnimationFrameTime) -> AnimationFrameTime
|
|
136
|
+
) -> LayerAnimationContext {
|
|
137
|
+
var copy = self
|
|
138
|
+
copy.mustUseComplexTimeRemapping = copy.mustUseComplexTimeRemapping || required
|
|
139
|
+
copy.complexTimeRemapping = { [existingComplexTimeRemapping = complexTimeRemapping] time in
|
|
140
|
+
additionalComplexTimeRemapping(existingComplexTimeRemapping(time))
|
|
141
|
+
}
|
|
142
|
+
return copy
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/// Returns a copy of this context with time remapping removed
|
|
146
|
+
func withoutTimeRemapping() -> LayerAnimationContext {
|
|
147
|
+
var copy = self
|
|
148
|
+
copy.simpleTimeRemapping = { $0 }
|
|
149
|
+
copy.complexTimeRemapping = { $0 }
|
|
150
|
+
copy.mustUseComplexTimeRemapping = false
|
|
151
|
+
return copy
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
// MARK: - LoggingState
|
|
156
|
+
|
|
157
|
+
/// Mutable state related to log events, stored on the `CoreAnimationLayer`.
|
|
158
|
+
final class LoggingState {
|
|
159
|
+
|
|
160
|
+
// MARK: Lifecycle
|
|
161
|
+
|
|
162
|
+
init() { }
|
|
163
|
+
|
|
164
|
+
// MARK: Internal
|
|
165
|
+
|
|
166
|
+
/// Whether or not the warning about unsupported After Effects expressions
|
|
167
|
+
/// has been logged yet for this layer.
|
|
168
|
+
var hasLoggedAfterEffectsExpressionsWarning = false
|
|
169
|
+
}
|
package/platforms/macos/src/vendor/Lottie/Private/CoreAnimation/Layers/BaseAnimationLayer.swift
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
// Created by Cal Stephens on 1/27/22.
|
|
2
|
+
// Copyright © 2022 Airbnb Inc. All rights reserved.
|
|
3
|
+
|
|
4
|
+
import QuartzCore
|
|
5
|
+
|
|
6
|
+
/// A base `CALayer` that manages the frame and animations
|
|
7
|
+
/// of its `sublayers` and `mask`
|
|
8
|
+
class BaseAnimationLayer: CALayer, AnimationLayer {
|
|
9
|
+
|
|
10
|
+
// MARK: Internal
|
|
11
|
+
|
|
12
|
+
override func layoutSublayers() {
|
|
13
|
+
super.layoutSublayers()
|
|
14
|
+
|
|
15
|
+
for sublayer in managedSublayers {
|
|
16
|
+
sublayer.fillBoundsOfSuperlayer()
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
func setupAnimations(context: LayerAnimationContext) throws {
|
|
21
|
+
// Only set up animations for sublayers here, not MaskCompositionLayer masks.
|
|
22
|
+
// MaskCompositionLayer animations must be set up separately with the parent's context
|
|
23
|
+
// (without precomp time remapping), since mask keyframes are defined
|
|
24
|
+
// in the parent's global timeline. See BaseCompositionLayer.setupLayerAnimations.
|
|
25
|
+
for childAnimationLayer in sublayers ?? [] {
|
|
26
|
+
try (childAnimationLayer as? AnimationLayer)?.setupAnimations(context: context)
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// Set up animations for non-MaskCompositionLayer masks (e.g. alpha matte masks
|
|
30
|
+
// created in CALayer+setupLayerHierarchy.swift). These receive the same context
|
|
31
|
+
// as the layer they're masking. MaskCompositionLayer is excluded here because it
|
|
32
|
+
// is handled explicitly in BaseCompositionLayer.setupLayerAnimations with the
|
|
33
|
+
// parent's non-remapped context.
|
|
34
|
+
if let maskAnimationLayer = mask as? AnimationLayer, !(mask is MaskCompositionLayer) {
|
|
35
|
+
try maskAnimationLayer.setupAnimations(context: context)
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// MARK: Private
|
|
40
|
+
|
|
41
|
+
/// All of the sublayers managed by this container
|
|
42
|
+
private var managedSublayers: [CALayer] {
|
|
43
|
+
(sublayers ?? []) + [mask].compactMap { $0 }
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
}
|