@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,248 @@
|
|
|
1
|
+
//
|
|
2
|
+
// AnimatedControl.swift
|
|
3
|
+
// lottie-swift
|
|
4
|
+
//
|
|
5
|
+
// Created by Brandon Withrow on 2/4/19.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
#if canImport(UIKit)
|
|
9
|
+
import UIKit
|
|
10
|
+
#elseif canImport(AppKit)
|
|
11
|
+
import AppKit
|
|
12
|
+
#endif
|
|
13
|
+
|
|
14
|
+
// MARK: - AnimatedControl
|
|
15
|
+
|
|
16
|
+
/// Lottie comes prepacked with a two Animated Controls, `AnimatedSwitch` and
|
|
17
|
+
/// `AnimatedButton`. Both of these controls are built on top of `AnimatedControl`
|
|
18
|
+
///
|
|
19
|
+
/// `AnimatedControl` is a subclass of `UIControl` that provides an interactive
|
|
20
|
+
/// mechanism for controlling the visual state of an animation in response to
|
|
21
|
+
/// user actions.
|
|
22
|
+
///
|
|
23
|
+
/// The `AnimatedControl` will show and hide layers depending on the current
|
|
24
|
+
/// `UIControl.State` of the control.
|
|
25
|
+
///
|
|
26
|
+
/// Users of `AnimationControl` can set a Layer Name for each `UIControl.State`.
|
|
27
|
+
/// When the state is change the `AnimationControl` will change the visibility
|
|
28
|
+
/// of its layers.
|
|
29
|
+
///
|
|
30
|
+
/// NOTE: Do not initialize directly. This is intended to be subclassed.
|
|
31
|
+
open class AnimatedControl: LottieControlType {
|
|
32
|
+
|
|
33
|
+
// MARK: Lifecycle
|
|
34
|
+
|
|
35
|
+
public init(
|
|
36
|
+
animation: LottieAnimation?,
|
|
37
|
+
configuration: LottieConfiguration = .shared
|
|
38
|
+
) {
|
|
39
|
+
animationView = LottieAnimationView(
|
|
40
|
+
animation: animation,
|
|
41
|
+
configuration: configuration
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
super.init(frame: animation?.bounds ?? .zero)
|
|
45
|
+
commonInit()
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
public init() {
|
|
49
|
+
animationView = LottieAnimationView()
|
|
50
|
+
super.init(frame: .zero)
|
|
51
|
+
commonInit()
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
required public init?(coder aDecoder: NSCoder) {
|
|
55
|
+
animationView = LottieAnimationView()
|
|
56
|
+
super.init(coder: aDecoder)
|
|
57
|
+
commonInit()
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// MARK: Open
|
|
61
|
+
|
|
62
|
+
open override var isEnabled: Bool {
|
|
63
|
+
didSet {
|
|
64
|
+
updateForState()
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
#if canImport(UIKit)
|
|
69
|
+
open override var isSelected: Bool {
|
|
70
|
+
didSet {
|
|
71
|
+
updateForState()
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
#endif
|
|
75
|
+
|
|
76
|
+
open override var isHighlighted: Bool {
|
|
77
|
+
didSet {
|
|
78
|
+
updateForState()
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
open override var intrinsicContentSize: CGSize {
|
|
83
|
+
animationView.intrinsicContentSize
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
#if canImport(UIKit)
|
|
87
|
+
open override func beginTracking(_ touch: UITouch, with event: UIEvent?) -> Bool {
|
|
88
|
+
updateForState()
|
|
89
|
+
return super.beginTracking(touch, with: event)
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
open override func continueTracking(_ touch: UITouch, with event: UIEvent?) -> Bool {
|
|
93
|
+
updateForState()
|
|
94
|
+
return super.continueTracking(touch, with: event)
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
open override func endTracking(_ touch: UITouch?, with event: UIEvent?) {
|
|
98
|
+
updateForState()
|
|
99
|
+
return super.endTracking(touch, with: event)
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
open override func cancelTracking(with event: UIEvent?) {
|
|
103
|
+
updateForState()
|
|
104
|
+
super.cancelTracking(with: event)
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
#elseif canImport(AppKit)
|
|
108
|
+
open override func mouseDown(with mouseDownEvent: NSEvent) {
|
|
109
|
+
guard let window else { return }
|
|
110
|
+
|
|
111
|
+
currentState = .highlighted
|
|
112
|
+
updateForState()
|
|
113
|
+
handle(LottieControlEvent(mouseDownEvent.type, inside: eventIsInside(mouseDownEvent)))
|
|
114
|
+
|
|
115
|
+
// AppKit mouse-tracking loop from:
|
|
116
|
+
// https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/EventOverview/HandlingMouseEvents/HandlingMouseEvents.html#//apple_ref/doc/uid/10000060i-CH6-SW4
|
|
117
|
+
var keepOn = true
|
|
118
|
+
while
|
|
119
|
+
keepOn,
|
|
120
|
+
let event = window.nextEvent(
|
|
121
|
+
matching: .any,
|
|
122
|
+
until: .distantFuture,
|
|
123
|
+
inMode: .eventTracking,
|
|
124
|
+
dequeue: true
|
|
125
|
+
)
|
|
126
|
+
{
|
|
127
|
+
if event.type == .leftMouseUp {
|
|
128
|
+
keepOn = false
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
let isInside = eventIsInside(event)
|
|
132
|
+
handle(LottieControlEvent(event.type, inside: isInside))
|
|
133
|
+
|
|
134
|
+
let expectedState = (isInside && keepOn) ? LottieNSControlState.highlighted : .normal
|
|
135
|
+
if currentState != expectedState {
|
|
136
|
+
currentState = expectedState
|
|
137
|
+
updateForState()
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
func handle(_: LottieNSControlEvent) {
|
|
143
|
+
// To be overridden in subclasses
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
private func eventIsInside(_ event: NSEvent) -> Bool {
|
|
147
|
+
let mouseLocation = convert(event.locationInWindow, from: nil)
|
|
148
|
+
return isMousePoint(mouseLocation, in: bounds)
|
|
149
|
+
}
|
|
150
|
+
#endif
|
|
151
|
+
|
|
152
|
+
open func animationDidSet() { }
|
|
153
|
+
|
|
154
|
+
// MARK: Public
|
|
155
|
+
|
|
156
|
+
/// The animation view in which the animation is rendered.
|
|
157
|
+
public let animationView: LottieAnimationView
|
|
158
|
+
|
|
159
|
+
/// The animation backing the animated control.
|
|
160
|
+
public var animation: LottieAnimation? {
|
|
161
|
+
didSet {
|
|
162
|
+
animationView.animation = animation
|
|
163
|
+
animationView.bounds = animation?.bounds ?? .zero
|
|
164
|
+
#if canImport(UIKit)
|
|
165
|
+
setNeedsLayout()
|
|
166
|
+
#elseif canImport(AppKit)
|
|
167
|
+
needsLayout = true
|
|
168
|
+
#endif
|
|
169
|
+
updateForState()
|
|
170
|
+
animationDidSet()
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
/// The speed of the animation playback. Defaults to 1
|
|
175
|
+
public var animationSpeed: CGFloat {
|
|
176
|
+
set { animationView.animationSpeed = newValue }
|
|
177
|
+
get { animationView.animationSpeed }
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
/// Sets which Animation Layer should be visible for the given state.
|
|
181
|
+
public func setLayer(named: String, forState: LottieControlState) {
|
|
182
|
+
stateMap[forState.rawValue] = named
|
|
183
|
+
updateForState()
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
/// Sets a ValueProvider for the specified keypath
|
|
187
|
+
public func setValueProvider(_ valueProvider: AnyValueProvider, keypath: AnimationKeypath) {
|
|
188
|
+
animationView.setValueProvider(valueProvider, keypath: keypath)
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
/// Removes a ValueProvider for the specified keypath
|
|
192
|
+
public func removeValueProvider(for keypath: AnimationKeypath) {
|
|
193
|
+
animationView.removeValueProvider(for: keypath)
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
// MARK: Internal
|
|
197
|
+
|
|
198
|
+
var stateMap = [UInt: String]()
|
|
199
|
+
|
|
200
|
+
#if canImport(UIKit)
|
|
201
|
+
var currentState: LottieControlState {
|
|
202
|
+
state
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
#elseif canImport(AppKit)
|
|
206
|
+
var currentState = LottieControlState.normal
|
|
207
|
+
#endif
|
|
208
|
+
|
|
209
|
+
func updateForState() {
|
|
210
|
+
guard let animationLayer = animationView.animationLayer else { return }
|
|
211
|
+
if
|
|
212
|
+
let layerName = stateMap[currentState.rawValue],
|
|
213
|
+
let stateLayer = animationLayer.layer(for: AnimationKeypath(keypath: layerName))
|
|
214
|
+
{
|
|
215
|
+
for layer in animationLayer._animationLayers {
|
|
216
|
+
layer.isHidden = true
|
|
217
|
+
}
|
|
218
|
+
stateLayer.isHidden = false
|
|
219
|
+
} else {
|
|
220
|
+
for layer in animationLayer._animationLayers {
|
|
221
|
+
layer.isHidden = false
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
// MARK: Private
|
|
227
|
+
|
|
228
|
+
private func commonInit() {
|
|
229
|
+
#if canImport(UIKit)
|
|
230
|
+
animationView.clipsToBounds = false
|
|
231
|
+
clipsToBounds = true
|
|
232
|
+
#endif
|
|
233
|
+
|
|
234
|
+
animationView.translatesAutoresizingMaskIntoConstraints = false
|
|
235
|
+
animationView.backgroundBehavior = .forceFinish
|
|
236
|
+
addSubview(animationView)
|
|
237
|
+
animationView.contentMode = .scaleAspectFit
|
|
238
|
+
|
|
239
|
+
#if canImport(UIKit)
|
|
240
|
+
animationView.isUserInteractionEnabled = false
|
|
241
|
+
#endif
|
|
242
|
+
|
|
243
|
+
animationView.leadingAnchor.constraint(equalTo: leadingAnchor).isActive = true
|
|
244
|
+
animationView.trailingAnchor.constraint(equalTo: trailingAnchor).isActive = true
|
|
245
|
+
animationView.topAnchor.constraint(equalTo: topAnchor).isActive = true
|
|
246
|
+
animationView.bottomAnchor.constraint(equalTo: bottomAnchor).isActive = true
|
|
247
|
+
}
|
|
248
|
+
}
|
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
//
|
|
2
|
+
// AnimatedSwitch.swift
|
|
3
|
+
// lottie-swift
|
|
4
|
+
//
|
|
5
|
+
// Created by Brandon Withrow on 2/4/19.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
#if canImport(UIKit)
|
|
9
|
+
import UIKit
|
|
10
|
+
#elseif canImport(AppKit)
|
|
11
|
+
import AppKit
|
|
12
|
+
#endif
|
|
13
|
+
|
|
14
|
+
// MARK: - AnimatedSwitch
|
|
15
|
+
|
|
16
|
+
/// An interactive switch with an 'On' and 'Off' state. When the user taps on the
|
|
17
|
+
/// switch the state is toggled and the appropriate animation is played.
|
|
18
|
+
///
|
|
19
|
+
/// Both the 'On' and 'Off' have an animation play range associated with their state.
|
|
20
|
+
///
|
|
21
|
+
/// Also available as a SwiftUI view (`LottieSwitch`).
|
|
22
|
+
open class AnimatedSwitch: AnimatedControl {
|
|
23
|
+
|
|
24
|
+
// MARK: Lifecycle
|
|
25
|
+
|
|
26
|
+
public override init(
|
|
27
|
+
animation: LottieAnimation?,
|
|
28
|
+
configuration: LottieConfiguration = .shared
|
|
29
|
+
) {
|
|
30
|
+
/// Generate a haptic generator if available.
|
|
31
|
+
#if os(iOS)
|
|
32
|
+
hapticGenerator = HapticGenerator()
|
|
33
|
+
#else
|
|
34
|
+
hapticGenerator = NullHapticGenerator()
|
|
35
|
+
#endif
|
|
36
|
+
super.init(animation: animation, configuration: configuration)
|
|
37
|
+
|
|
38
|
+
#if canImport(UIKit)
|
|
39
|
+
isAccessibilityElement = true
|
|
40
|
+
#elseif canImport(AppKit)
|
|
41
|
+
setAccessibilityElement(true)
|
|
42
|
+
#endif
|
|
43
|
+
|
|
44
|
+
updateOnState(isOn: _isOn, animated: false, shouldFireHaptics: false)
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
public override init() {
|
|
48
|
+
/// Generate a haptic generator if available.
|
|
49
|
+
#if os(iOS)
|
|
50
|
+
hapticGenerator = HapticGenerator()
|
|
51
|
+
#else
|
|
52
|
+
hapticGenerator = NullHapticGenerator()
|
|
53
|
+
#endif
|
|
54
|
+
|
|
55
|
+
super.init()
|
|
56
|
+
|
|
57
|
+
#if canImport(UIKit)
|
|
58
|
+
isAccessibilityElement = true
|
|
59
|
+
#elseif canImport(AppKit)
|
|
60
|
+
setAccessibilityElement(true)
|
|
61
|
+
#endif
|
|
62
|
+
|
|
63
|
+
updateOnState(isOn: _isOn, animated: false, shouldFireHaptics: false)
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
required public init?(coder aDecoder: NSCoder) {
|
|
67
|
+
/// Generate a haptic generator if available.
|
|
68
|
+
#if os(iOS)
|
|
69
|
+
hapticGenerator = HapticGenerator()
|
|
70
|
+
#else
|
|
71
|
+
hapticGenerator = NullHapticGenerator()
|
|
72
|
+
#endif
|
|
73
|
+
super.init(coder: aDecoder)
|
|
74
|
+
|
|
75
|
+
#if canImport(UIKit)
|
|
76
|
+
isAccessibilityElement = true
|
|
77
|
+
#elseif canImport(AppKit)
|
|
78
|
+
setAccessibilityElement(true)
|
|
79
|
+
#endif
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// MARK: Open
|
|
83
|
+
|
|
84
|
+
open override func animationDidSet() {
|
|
85
|
+
updateOnState(isOn: _isOn, animated: animateUpdateWhenChangingAnimation, shouldFireHaptics: false)
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
#if canImport(UIKit)
|
|
89
|
+
open override func endTracking(_ touch: UITouch?, with event: UIEvent?) {
|
|
90
|
+
super.endTracking(touch, with: event)
|
|
91
|
+
updateOnState(isOn: !_isOn, animated: true, shouldFireHaptics: true)
|
|
92
|
+
sendActions(for: .valueChanged)
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
#elseif canImport(AppKit)
|
|
96
|
+
open override func handle(_ event: LottieNSControlEvent) {
|
|
97
|
+
super.handle(event)
|
|
98
|
+
|
|
99
|
+
if event == .touchUpInside {
|
|
100
|
+
updateOnState(isOn: !_isOn, animated: true, shouldFireHaptics: true)
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
#endif
|
|
104
|
+
|
|
105
|
+
// MARK: Public
|
|
106
|
+
|
|
107
|
+
/// Defines what happens when the user taps the switch while an
|
|
108
|
+
/// animation is still in flight
|
|
109
|
+
public enum CancelBehavior {
|
|
110
|
+
case reverse // default - plays the current animation in reverse
|
|
111
|
+
case none // does not update the animation when canceled
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/// The cancel behavior for the switch. See CancelBehavior for options
|
|
115
|
+
public var cancelBehavior = CancelBehavior.reverse
|
|
116
|
+
|
|
117
|
+
/// If `false` the switch will not play the animation when changing between animations.
|
|
118
|
+
public var animateUpdateWhenChangingAnimation = true
|
|
119
|
+
|
|
120
|
+
/// A closure that is called when the `isOn` state is updated
|
|
121
|
+
public var stateUpdated: ((_ isOn: Bool) -> Void)?
|
|
122
|
+
|
|
123
|
+
#if canImport(UIKit)
|
|
124
|
+
public override var accessibilityTraits: UIAccessibilityTraits {
|
|
125
|
+
set { super.accessibilityTraits = newValue }
|
|
126
|
+
get { super.accessibilityTraits.union(.button) }
|
|
127
|
+
}
|
|
128
|
+
#endif
|
|
129
|
+
|
|
130
|
+
/// The current state of the switch.
|
|
131
|
+
public var isOn: Bool {
|
|
132
|
+
set {
|
|
133
|
+
/// This is forwarded to a private variable because the animation needs to be updated without animation when set externally and with animation when set internally.
|
|
134
|
+
guard _isOn != newValue else { return }
|
|
135
|
+
updateOnState(isOn: newValue, animated: false, shouldFireHaptics: false)
|
|
136
|
+
}
|
|
137
|
+
get {
|
|
138
|
+
_isOn
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/// Set the state of the switch and specify animation and haptics
|
|
143
|
+
public func setIsOn(_ isOn: Bool, animated: Bool, shouldFireHaptics: Bool = true) {
|
|
144
|
+
guard isOn != _isOn else { return }
|
|
145
|
+
updateOnState(isOn: isOn, animated: animated, shouldFireHaptics: shouldFireHaptics)
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/// Sets the play range for the given state. When the switch is toggled, the animation range is played.
|
|
149
|
+
public func setProgressForState(
|
|
150
|
+
fromProgress: AnimationProgressTime,
|
|
151
|
+
toProgress: AnimationProgressTime,
|
|
152
|
+
forOnState: Bool
|
|
153
|
+
) {
|
|
154
|
+
if forOnState {
|
|
155
|
+
onStartProgress = fromProgress
|
|
156
|
+
onEndProgress = toProgress
|
|
157
|
+
} else {
|
|
158
|
+
offStartProgress = fromProgress
|
|
159
|
+
offEndProgress = toProgress
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
updateOnState(isOn: _isOn, animated: false, shouldFireHaptics: false)
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
// MARK: Internal
|
|
166
|
+
|
|
167
|
+
private(set) var onStartProgress: CGFloat = 0
|
|
168
|
+
private(set) var onEndProgress: CGFloat = 1
|
|
169
|
+
private(set) var offStartProgress: CGFloat = 1
|
|
170
|
+
private(set) var offEndProgress: CGFloat = 0
|
|
171
|
+
|
|
172
|
+
func updateOnState(isOn: Bool, animated: Bool, shouldFireHaptics: Bool) {
|
|
173
|
+
_isOn = isOn
|
|
174
|
+
var startProgress = isOn ? onStartProgress : offStartProgress
|
|
175
|
+
var endProgress = isOn ? onEndProgress : offEndProgress
|
|
176
|
+
let finalProgress = endProgress
|
|
177
|
+
|
|
178
|
+
if cancelBehavior == .reverse {
|
|
179
|
+
let realtimeProgress = animationView.realtimeAnimationProgress
|
|
180
|
+
|
|
181
|
+
let previousStateStart = isOn ? offStartProgress : onStartProgress
|
|
182
|
+
let previousStateEnd = isOn ? offEndProgress : onEndProgress
|
|
183
|
+
if
|
|
184
|
+
realtimeProgress.isInRange(
|
|
185
|
+
min(previousStateStart, previousStateEnd),
|
|
186
|
+
max(previousStateStart, previousStateEnd)
|
|
187
|
+
)
|
|
188
|
+
{
|
|
189
|
+
/// Animation is currently in the previous time range. Reverse the previous play.
|
|
190
|
+
startProgress = previousStateEnd
|
|
191
|
+
endProgress = previousStateStart
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
updateAccessibilityLabel()
|
|
196
|
+
|
|
197
|
+
guard animated == true else {
|
|
198
|
+
animationView.currentProgress = finalProgress
|
|
199
|
+
return
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
if shouldFireHaptics {
|
|
203
|
+
hapticGenerator.generateImpact()
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
animationView.play(
|
|
207
|
+
fromProgress: startProgress,
|
|
208
|
+
toProgress: endProgress,
|
|
209
|
+
loopMode: LottieLoopMode.playOnce,
|
|
210
|
+
completion: { [weak self] finished in
|
|
211
|
+
guard let self else { return }
|
|
212
|
+
|
|
213
|
+
// For the Main Thread rendering engine, we freeze the animation at the expected final progress
|
|
214
|
+
// once the animation is complete. This isn't necessary on the Core Animation engine.
|
|
215
|
+
if finished, !(animationView.animationLayer is CoreAnimationLayer) {
|
|
216
|
+
animationView.currentProgress = finalProgress
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
)
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
// MARK: Fileprivate
|
|
223
|
+
|
|
224
|
+
fileprivate var hapticGenerator: ImpactGenerator
|
|
225
|
+
|
|
226
|
+
fileprivate var _isOn = false {
|
|
227
|
+
didSet {
|
|
228
|
+
stateUpdated?(_isOn)
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
// MARK: Private
|
|
233
|
+
|
|
234
|
+
private func updateAccessibilityLabel() {
|
|
235
|
+
let value = _isOn ? NSLocalizedString("On", comment: "On") : NSLocalizedString("Off", comment: "Off")
|
|
236
|
+
|
|
237
|
+
#if canImport(UIKit)
|
|
238
|
+
accessibilityValue = value
|
|
239
|
+
#elseif canImport(AppKit)
|
|
240
|
+
setAccessibilityValue(value)
|
|
241
|
+
#endif
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
// MARK: - ImpactGenerator
|
|
247
|
+
|
|
248
|
+
protocol ImpactGenerator {
|
|
249
|
+
func generateImpact()
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
#if os(iOS)
|
|
253
|
+
final class HapticGenerator: ImpactGenerator {
|
|
254
|
+
|
|
255
|
+
// MARK: Internal
|
|
256
|
+
|
|
257
|
+
func generateImpact() {
|
|
258
|
+
impact.impactOccurred()
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
// MARK: Fileprivate
|
|
262
|
+
|
|
263
|
+
fileprivate let impact = UIImpactFeedbackGenerator(style: .light)
|
|
264
|
+
}
|
|
265
|
+
#else
|
|
266
|
+
// MARK: - NullHapticGenerator
|
|
267
|
+
|
|
268
|
+
final class NullHapticGenerator: ImpactGenerator {
|
|
269
|
+
func generateImpact() { }
|
|
270
|
+
}
|
|
271
|
+
#endif
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
// Created by Cal Stephens on 8/14/23.
|
|
2
|
+
// Copyright © 2023 Airbnb Inc. All rights reserved.
|
|
3
|
+
|
|
4
|
+
#if canImport(SwiftUI)
|
|
5
|
+
import SwiftUI
|
|
6
|
+
|
|
7
|
+
/// A wrapper which exposes Lottie's `AnimatedButton` to SwiftUI
|
|
8
|
+
public struct LottieButton: UIViewConfiguringSwiftUIView {
|
|
9
|
+
|
|
10
|
+
// MARK: Lifecycle
|
|
11
|
+
|
|
12
|
+
public init(animation: LottieAnimation?, action: @escaping () -> Void) {
|
|
13
|
+
self.animation = animation
|
|
14
|
+
self.action = action
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
// MARK: Public
|
|
18
|
+
|
|
19
|
+
public var body: some View {
|
|
20
|
+
AnimatedButton.swiftUIView {
|
|
21
|
+
let button = AnimatedButton(animation: animation, configuration: configuration)
|
|
22
|
+
button.performAction = action
|
|
23
|
+
return button
|
|
24
|
+
}
|
|
25
|
+
.configure { context in
|
|
26
|
+
// We check referential equality of the animation before updating as updating the
|
|
27
|
+
// animation has a side-effect of rebuilding the animation layer, and it would be
|
|
28
|
+
// prohibitive to do so on every state update.
|
|
29
|
+
if animation !== context.view.animationView.animation {
|
|
30
|
+
context.view.animationView.animation = animation
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
#if os(macOS)
|
|
34
|
+
// Disable the intrinsic content size constraint on the inner animation view,
|
|
35
|
+
// or the Epoxy `SwiftUIMeasurementContainer` won't size this view correctly.
|
|
36
|
+
context.view.animationView.isVerticalContentSizeConstraintActive = false
|
|
37
|
+
context.view.animationView.isHorizontalContentSizeConstraintActive = false
|
|
38
|
+
#endif
|
|
39
|
+
}
|
|
40
|
+
.configurations(configurations)
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/// Returns a copy of this `LottieView` updated to have the given closure applied to its
|
|
44
|
+
/// represented `LottieAnimationView` whenever it is updated via the `updateUIView(…)`
|
|
45
|
+
/// or `updateNSView(…)` method.
|
|
46
|
+
public func configure(_ configure: @escaping (AnimatedButton) -> Void) -> Self {
|
|
47
|
+
var copy = self
|
|
48
|
+
copy.configurations.append { context in
|
|
49
|
+
configure(context.view)
|
|
50
|
+
}
|
|
51
|
+
return copy
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/// Returns a copy of this view with its `LottieConfiguration` updated to the given value.
|
|
55
|
+
public func configuration(_ configuration: LottieConfiguration) -> Self {
|
|
56
|
+
var copy = self
|
|
57
|
+
copy.configuration = configuration
|
|
58
|
+
|
|
59
|
+
copy = copy.configure { view in
|
|
60
|
+
if view.animationView.configuration != configuration {
|
|
61
|
+
view.animationView.configuration = configuration
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
return copy
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/// Returns a copy of this view configured to animate between the
|
|
69
|
+
/// given progress values when the given event is triggered
|
|
70
|
+
public func animate(
|
|
71
|
+
fromProgress: AnimationProgressTime,
|
|
72
|
+
toProgress: AnimationProgressTime,
|
|
73
|
+
on event: LottieControlEvent
|
|
74
|
+
) -> Self {
|
|
75
|
+
configure { view in
|
|
76
|
+
// `setPlayRange` just modifies a dictionary,
|
|
77
|
+
// so we can just call it on every state update without diffing
|
|
78
|
+
view.setPlayRange(fromProgress: fromProgress, toProgress: toProgress, event: event)
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/// Returns a copy of this view configured to animate between the
|
|
83
|
+
/// given markers when the given event is triggered
|
|
84
|
+
public func animate(
|
|
85
|
+
fromMarker: String,
|
|
86
|
+
toMarker: String,
|
|
87
|
+
on event: LottieControlEvent
|
|
88
|
+
) -> Self {
|
|
89
|
+
configure { view in
|
|
90
|
+
// `setPlayRange` just modifies a dictionary,
|
|
91
|
+
// so we can just call it on every state update without diffing
|
|
92
|
+
view.setPlayRange(fromMarker: fromMarker, toMarker: toMarker, event: event)
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/// Returns a copy of this view using the given value provider for the given keypath.
|
|
97
|
+
/// The value provider must be `Equatable` to avoid unnecessary state updates / re-renders.
|
|
98
|
+
public func valueProvider<ValueProvider: AnyValueProvider & Equatable>(
|
|
99
|
+
_ valueProvider: ValueProvider,
|
|
100
|
+
for keypath: AnimationKeypath
|
|
101
|
+
) -> Self {
|
|
102
|
+
configure { view in
|
|
103
|
+
if (view.animationView.valueProviders[keypath] as? ValueProvider) != valueProvider {
|
|
104
|
+
view.animationView.setValueProvider(valueProvider, keypath: keypath)
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// MARK: Internal
|
|
110
|
+
|
|
111
|
+
var configurations = [SwiftUIView<AnimatedButton, Void>.Configuration]()
|
|
112
|
+
|
|
113
|
+
// MARK: Private
|
|
114
|
+
|
|
115
|
+
private let animation: LottieAnimation?
|
|
116
|
+
private let action: () -> Void
|
|
117
|
+
private var configuration = LottieConfiguration.shared
|
|
118
|
+
}
|
|
119
|
+
#endif
|