lottie-ios 4.3.4 → 4.4.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/.github/workflows/main.yml +51 -58
- package/Lottie.xcodeproj/project.pbxproj +20 -0
- package/Lottie.xcodeproj/xcuserdata/calstephens.xcuserdatad/xcschemes/xcschememanagement.plist +4 -17
- package/Lottie.xcworkspace/xcshareddata/swiftpm/Package.resolved +37 -40
- package/Lottie.xcworkspace/xcuserdata/calstephens.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- package/Lottie.xcworkspace/xcuserdata/calstephens.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist +9 -680
- package/Package.resolved +20 -22
- package/Package.swift +3 -2
- package/README.md +21 -3
- package/Rakefile +52 -28
- package/Sources/PrivacyInfo.xcprivacy +23 -0
- package/Sources/Private/CoreAnimation/Animations/CAAnimation+TimingConfiguration.swift +1 -1
- package/Sources/Private/CoreAnimation/Animations/CALayer+addAnimation.swift +23 -13
- package/Sources/Private/CoreAnimation/Animations/CustomPathAnimation.swift +8 -2
- package/Sources/Private/CoreAnimation/Animations/EllipseAnimation.swift +7 -1
- package/Sources/Private/CoreAnimation/Animations/GradientAnimations.swift +15 -2
- package/Sources/Private/CoreAnimation/Animations/LayerProperty.swift +8 -1
- package/Sources/Private/CoreAnimation/Animations/RectangleAnimation.swift +8 -1
- package/Sources/Private/CoreAnimation/Animations/StarAnimation.swift +12 -1
- package/Sources/Private/CoreAnimation/Animations/StrokeAnimation.swift +0 -1
- package/Sources/Private/CoreAnimation/Animations/TransformAnimations.swift +19 -11
- package/Sources/Private/CoreAnimation/Animations/VisibilityAnimation.swift +45 -19
- package/Sources/Private/CoreAnimation/CoreAnimationLayer.swift +38 -3
- package/Sources/Private/CoreAnimation/Extensions/CALayer+fillBounds.swift +1 -1
- package/Sources/Private/CoreAnimation/Extensions/Keyframes+combined.swift +9 -2
- package/Sources/Private/CoreAnimation/Extensions/Keyframes+timeRemapping.swift +46 -0
- package/Sources/Private/CoreAnimation/Layers/AnimationLayer.swift +77 -13
- package/Sources/Private/CoreAnimation/Layers/BaseCompositionLayer.swift +1 -1
- package/Sources/Private/CoreAnimation/Layers/CALayer+setupLayerHierarchy.swift +2 -2
- package/Sources/Private/CoreAnimation/Layers/ImageLayer.swift +1 -1
- package/Sources/Private/CoreAnimation/Layers/LayerModel+makeAnimationLayer.swift +1 -7
- package/Sources/Private/CoreAnimation/Layers/PreCompLayer.swift +19 -53
- package/Sources/Private/CoreAnimation/Layers/ShapeItemLayer.swift +2 -2
- package/Sources/Private/CoreAnimation/Layers/ShapeLayer.swift +2 -4
- package/Sources/Private/CoreAnimation/Layers/SolidLayer.swift +5 -2
- package/Sources/Private/EmbeddedLibraries/EpoxyCore/Model/EpoxyModelArrayBuilder.swift +1 -1
- package/Sources/Private/EmbeddedLibraries/EpoxyCore/Model/EpoxyModelProperty.swift +10 -10
- package/Sources/Private/EmbeddedLibraries/LRUCache/LRUCache.swift +3 -3
- package/Sources/Private/EmbeddedLibraries/README.md +2 -0
- package/Sources/Private/EmbeddedLibraries/ZipFoundation/Archive+Helpers.swift +2 -2
- package/Sources/Private/EmbeddedLibraries/ZipFoundation/Archive+MemoryFile.swift +7 -7
- package/Sources/Private/EmbeddedLibraries/ZipFoundation/Data+Compression.swift +2 -2
- package/Sources/Private/EmbeddedLibraries/ZipFoundation/FileManager+ZIP.swift +5 -5
- package/Sources/Private/MainThread/LayerContainers/CompLayers/CompositionLayer.swift +1 -2
- package/Sources/Private/MainThread/LayerContainers/CompLayers/ImageCompositionLayer.swift +1 -3
- package/Sources/Private/MainThread/LayerContainers/CompLayers/MaskContainerLayer.swift +1 -2
- package/Sources/Private/MainThread/LayerContainers/CompLayers/PreCompositionLayer.swift +2 -3
- package/Sources/Private/MainThread/LayerContainers/CompLayers/SolidCompositionLayer.swift +2 -3
- package/Sources/Private/MainThread/LayerContainers/CompLayers/TextCompositionLayer.swift +5 -12
- package/Sources/Private/MainThread/LayerContainers/MainThreadAnimationLayer.swift +0 -1
- package/Sources/Private/MainThread/LayerContainers/Utility/CachedImageProvider.swift +0 -2
- package/Sources/Private/MainThread/LayerContainers/Utility/CompositionLayersInitializer.swift +3 -3
- package/Sources/Private/MainThread/LayerContainers/Utility/CoreTextRenderLayer.swift +12 -12
- package/Sources/Private/MainThread/LayerContainers/Utility/InvertedMatteLayer.swift +1 -2
- package/Sources/Private/MainThread/LayerContainers/Utility/LayerFontProvider.swift +0 -2
- package/Sources/Private/MainThread/LayerContainers/Utility/LayerImageProvider.swift +1 -3
- package/Sources/Private/MainThread/LayerContainers/Utility/LayerTextProvider.swift +0 -2
- package/Sources/Private/MainThread/LayerContainers/Utility/LayerTransformNode.swift +0 -2
- package/Sources/Private/MainThread/NodeRenderSystem/Extensions/ItemsExtension.swift +1 -3
- package/Sources/Private/MainThread/NodeRenderSystem/NodeProperties/Protocols/KeypathSearchable.swift +0 -1
- package/Sources/Private/MainThread/NodeRenderSystem/NodeProperties/Protocols/NodePropertyMap.swift +0 -1
- package/Sources/Private/MainThread/NodeRenderSystem/Nodes/OutputNodes/GroupOutputNode.swift +1 -3
- package/Sources/Private/MainThread/NodeRenderSystem/Nodes/OutputNodes/PassThroughOutputNode.swift +1 -2
- package/Sources/Private/MainThread/NodeRenderSystem/Nodes/OutputNodes/PathOutputNode.swift +0 -1
- package/Sources/Private/MainThread/NodeRenderSystem/Nodes/OutputNodes/Renderables/FillRenderer.swift +0 -2
- package/Sources/Private/MainThread/NodeRenderSystem/Nodes/OutputNodes/Renderables/GradientFillRenderer.swift +0 -1
- package/Sources/Private/MainThread/NodeRenderSystem/Nodes/OutputNodes/Renderables/GradientStrokeRenderer.swift +0 -1
- package/Sources/Private/MainThread/NodeRenderSystem/Nodes/OutputNodes/Renderables/LegacyGradientFillRenderer.swift +0 -1
- package/Sources/Private/MainThread/NodeRenderSystem/Nodes/OutputNodes/Renderables/StrokeRenderer.swift +2 -3
- package/Sources/Private/MainThread/NodeRenderSystem/Nodes/RenderContainers/GroupNode.swift +1 -3
- package/Sources/Private/MainThread/NodeRenderSystem/Nodes/RenderNodes/StrokeNode.swift +2 -2
- package/Sources/Private/MainThread/NodeRenderSystem/Nodes/Text/TextAnimatorNode.swift +0 -2
- package/Sources/Private/MainThread/NodeRenderSystem/Protocols/AnimatorNode.swift +0 -1
- package/Sources/Private/MainThread/NodeRenderSystem/Protocols/PathNode.swift +0 -2
- package/Sources/Private/MainThread/NodeRenderSystem/Protocols/RenderNode.swift +0 -2
- package/Sources/Private/MainThread/NodeRenderSystem/RenderLayers/ShapeContainerLayer.swift +0 -1
- package/Sources/Private/MainThread/NodeRenderSystem/RenderLayers/ShapeRenderLayer.swift +0 -1
- package/Sources/Private/Model/Assets/Asset.swift +2 -3
- package/Sources/Private/Model/Assets/AssetLibrary.swift +11 -11
- package/Sources/Private/Model/Assets/ImageAsset.swift +20 -0
- package/Sources/Private/Model/Assets/PrecompAsset.swift +0 -2
- package/Sources/Private/Model/DictionaryInitializable.swift +18 -10
- package/Sources/Private/Model/DotLottie/DotLottieImageProvider.swift +9 -6
- package/Sources/Private/Model/DotLottie/DotLottieUtils.swift +1 -1
- package/Sources/Private/Model/Extensions/KeyedDecodingContainerExtensions.swift +0 -2
- package/Sources/Private/Model/Keyframes/KeyframeData.swift +1 -4
- package/Sources/Private/Model/Keyframes/KeyframeGroup.swift +1 -3
- package/Sources/Private/Model/LayerEffects/DropShadowEffect.swift +0 -2
- package/Sources/Private/Model/LayerEffects/EffectValues/ColorEffectValue.swift +0 -2
- package/Sources/Private/Model/LayerEffects/EffectValues/EffectValue.swift +2 -3
- package/Sources/Private/Model/LayerEffects/EffectValues/Vector1DEffectValue.swift +0 -2
- package/Sources/Private/Model/LayerEffects/LayerEffect.swift +2 -3
- package/Sources/Private/Model/LayerStyles/DropShadowStyle.swift +0 -2
- package/Sources/Private/Model/LayerStyles/LayerStyle.swift +2 -3
- package/Sources/Private/Model/Layers/ImageLayerModel.swift +0 -2
- package/Sources/Private/Model/Layers/LayerModel.swift +11 -5
- package/Sources/Private/Model/Layers/PreCompLayerModel.swift +0 -2
- package/Sources/Private/Model/Layers/ShapeLayerModel.swift +0 -2
- package/Sources/Private/Model/Layers/SolidLayerModel.swift +0 -2
- package/Sources/Private/Model/Layers/TextLayerModel.swift +0 -2
- package/Sources/Private/Model/Objects/DashPattern.swift +1 -3
- package/Sources/Private/Model/Objects/Marker.swift +0 -2
- package/Sources/Private/Model/Objects/Mask.swift +0 -2
- package/Sources/Private/Model/Objects/Transform.swift +46 -9
- package/Sources/Private/Model/ShapeItems/Ellipse.swift +0 -2
- package/Sources/Private/Model/ShapeItems/Fill.swift +0 -2
- package/Sources/Private/Model/ShapeItems/GradientFill.swift +1 -3
- package/Sources/Private/Model/ShapeItems/GradientStroke.swift +1 -3
- package/Sources/Private/Model/ShapeItems/Group.swift +0 -2
- package/Sources/Private/Model/ShapeItems/Merge.swift +1 -3
- package/Sources/Private/Model/ShapeItems/Rectangle.swift +0 -2
- package/Sources/Private/Model/ShapeItems/Repeater.swift +0 -2
- package/Sources/Private/Model/ShapeItems/RoundedCorners.swift +0 -2
- package/Sources/Private/Model/ShapeItems/Shape.swift +0 -2
- package/Sources/Private/Model/ShapeItems/ShapeItem.swift +2 -3
- package/Sources/Private/Model/ShapeItems/ShapeTransform.swift +0 -2
- package/Sources/Private/Model/ShapeItems/Star.swift +1 -3
- package/Sources/Private/Model/ShapeItems/Stroke.swift +0 -2
- package/Sources/Private/Model/ShapeItems/Trim.swift +1 -3
- package/Sources/Private/Model/Text/Font.swift +0 -2
- package/Sources/Private/Model/Text/Glyph.swift +0 -2
- package/Sources/Private/Model/Text/TextAnimator.swift +0 -2
- package/Sources/Private/Model/Text/TextDocument.swift +2 -4
- package/Sources/Private/Utility/Debugging/AnimatorNodeDebugging.swift +0 -2
- package/Sources/Private/Utility/Debugging/LayerDebugging.swift +4 -5
- package/Sources/Private/Utility/Extensions/AnimationKeypathExtension.swift +2 -3
- package/Sources/Private/Utility/Extensions/DataExtension.swift +0 -1
- package/Sources/Private/Utility/Extensions/StringExtensions.swift +5 -0
- package/Sources/Private/Utility/Helpers/AnimationContext.swift +2 -3
- package/Sources/Private/Utility/Helpers/AnyEquatable.swift +0 -2
- package/Sources/Private/Utility/LottieAnimationSource.swift +11 -1
- package/Sources/Private/Utility/Primitives/BezierPath.swift +2 -3
- package/Sources/Private/Utility/Primitives/CGPointExtension.swift +1 -1
- package/Sources/Private/Utility/Primitives/ColorExtension.swift +1 -2
- package/Sources/Private/Utility/Primitives/VectorsExtensions.swift +6 -6
- package/Sources/Public/Animation/LottieAnimation.swift +2 -2
- package/Sources/Public/Animation/LottieAnimationHelpers.swift +7 -5
- package/Sources/Public/Animation/LottieAnimationLayer.swift +29 -43
- package/Sources/Public/Animation/LottieAnimationView.swift +6 -7
- package/Sources/Public/Animation/LottieAnimationViewInitializers.swift +3 -3
- package/Sources/Public/Animation/LottiePlaybackMode.swift +53 -0
- package/Sources/Public/Animation/LottieView.swift +143 -48
- package/Sources/Public/AnimationCache/AnimationCacheProvider.swift +0 -2
- package/Sources/Public/AnimationCache/DefaultAnimationCache.swift +11 -1
- package/Sources/Public/AnimationCache/LRUAnimationCache.swift +0 -2
- package/Sources/Public/Controls/AnimatedButton.swift +4 -6
- package/Sources/Public/Controls/AnimatedControl.swift +1 -3
- package/Sources/Public/Controls/AnimatedSwitch.swift +1 -3
- package/Sources/Public/DotLottie/Cache/DotLottieCache.swift +9 -0
- package/Sources/Public/DotLottie/Cache/DotLottieCacheProvider.swift +1 -3
- package/Sources/Public/DotLottie/DotLottieConfiguration.swift +53 -5
- package/Sources/Public/DotLottie/DotLottieFile.swift +4 -3
- package/Sources/Public/DotLottie/DotLottieFileHelpers.swift +6 -6
- package/Sources/Public/DynamicProperties/AnimationKeypath.swift +0 -2
- package/Sources/Public/DynamicProperties/AnyValueProvider.swift +0 -1
- package/Sources/Public/DynamicProperties/ValueProviders/ColorValueProvider.swift +2 -2
- package/Sources/Public/DynamicProperties/ValueProviders/FloatValueProvider.swift +1 -1
- package/Sources/Public/DynamicProperties/ValueProviders/GradientValueProvider.swift +1 -1
- package/Sources/Public/DynamicProperties/ValueProviders/PointValueProvider.swift +1 -1
- package/Sources/Public/DynamicProperties/ValueProviders/SizeValueProvider.swift +1 -1
- package/Sources/Public/FontProvider/AnimationFontProvider.swift +0 -2
- package/Sources/Public/ImageProvider/AnimationImageProvider.swift +0 -2
- package/Sources/Public/Keyframes/Interpolatable.swift +26 -0
- package/Sources/Public/Primitives/LottieColor.swift +0 -2
- package/Sources/Public/Primitives/Vectors.swift +0 -2
- package/Sources/Public/TextProvider/AnimationTextProvider.swift +0 -2
- package/Sources/Public/iOS/AnimationSubview.swift +0 -1
- package/Sources/Public/iOS/BundleImageProvider.swift +3 -8
- package/Sources/Public/iOS/Compatibility/CompatibleAnimationView.swift +4 -8
- package/Sources/Public/iOS/UIColorExtension.swift +1 -2
- package/Sources/Public/macOS/BundleImageProvider.macOS.swift +3 -6
- package/lottie-ios.podspec +5 -2
- package/package.json +1 -1
- package/Lottie.xcodeproj/project.xcworkspace/xcuserdata/cal.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- package/Lottie.xcodeproj/project.xcworkspace/xcuserdata/calstephens.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- package/Lottie.xcodeproj/xcuserdata/cal.xcuserdatad/xcschemes/xcschememanagement.plist +0 -37
- package/Lottie.xcworkspace/xcuserdata/cal.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- package/Lottie.xcworkspace/xcuserdata/cal.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist +0 -6
- package/Lottie.xcworkspace/xcuserdata/cal.xcuserdatad/xcdebugger/Expressions.xcexplist +0 -153
- package/Lottie.xcworkspace/xcuserdata/calstephens.xcuserdatad/IDEFindNavigatorScopes.plist +0 -5
- package/Lottie.xcworkspace/xcuserdata/calstephens.xcuserdatad/xcdebugger/Expressions.xcexplist +0 -231
- package/Lottie.xcworkspace/xcuserdata/calstephens.xcuserdatad/xcschemes/xcschememanagement.plist +0 -37
|
@@ -5,8 +5,6 @@
|
|
|
5
5
|
// Created by Brandon Withrow on 1/7/19.
|
|
6
6
|
//
|
|
7
7
|
|
|
8
|
-
import Foundation
|
|
9
|
-
|
|
10
8
|
/// The animatable transform for a layer. Controls position, rotation, scale, and opacity.
|
|
11
9
|
final class Transform: Codable, DictionaryInitializable {
|
|
12
10
|
|
|
@@ -86,7 +84,7 @@ final class Transform: Codable, DictionaryInitializable {
|
|
|
86
84
|
{
|
|
87
85
|
self.anchorPoint = anchorPoint
|
|
88
86
|
} else {
|
|
89
|
-
anchorPoint =
|
|
87
|
+
anchorPoint = Transform.default.anchorPoint
|
|
90
88
|
}
|
|
91
89
|
|
|
92
90
|
if
|
|
@@ -112,7 +110,7 @@ final class Transform: Codable, DictionaryInitializable {
|
|
|
112
110
|
positionY = try KeyframeGroup<LottieVector1D>(dictionary: yDictionary)
|
|
113
111
|
position = nil
|
|
114
112
|
} else {
|
|
115
|
-
position =
|
|
113
|
+
position = Transform.default.position
|
|
116
114
|
positionX = nil
|
|
117
115
|
positionY = nil
|
|
118
116
|
}
|
|
@@ -123,7 +121,7 @@ final class Transform: Codable, DictionaryInitializable {
|
|
|
123
121
|
{
|
|
124
122
|
self.scale = scale
|
|
125
123
|
} else {
|
|
126
|
-
scale =
|
|
124
|
+
scale = Transform.default.scale
|
|
127
125
|
}
|
|
128
126
|
|
|
129
127
|
if
|
|
@@ -132,7 +130,7 @@ final class Transform: Codable, DictionaryInitializable {
|
|
|
132
130
|
{
|
|
133
131
|
rotationX = rotation
|
|
134
132
|
} else {
|
|
135
|
-
rotationX =
|
|
133
|
+
rotationX = Transform.default.rotationX
|
|
136
134
|
}
|
|
137
135
|
|
|
138
136
|
if
|
|
@@ -141,7 +139,7 @@ final class Transform: Codable, DictionaryInitializable {
|
|
|
141
139
|
{
|
|
142
140
|
rotationY = rotation
|
|
143
141
|
} else {
|
|
144
|
-
rotationY =
|
|
142
|
+
rotationY = Transform.default.rotationY
|
|
145
143
|
}
|
|
146
144
|
|
|
147
145
|
if
|
|
@@ -155,7 +153,7 @@ final class Transform: Codable, DictionaryInitializable {
|
|
|
155
153
|
{
|
|
156
154
|
rotationZ = rotation
|
|
157
155
|
} else {
|
|
158
|
-
rotationZ =
|
|
156
|
+
rotationZ = Transform.default.rotationZ
|
|
159
157
|
}
|
|
160
158
|
rotation = nil
|
|
161
159
|
if
|
|
@@ -164,10 +162,34 @@ final class Transform: Codable, DictionaryInitializable {
|
|
|
164
162
|
{
|
|
165
163
|
self.opacity = opacity
|
|
166
164
|
} else {
|
|
167
|
-
opacity =
|
|
165
|
+
opacity = Transform.default.opacity
|
|
168
166
|
}
|
|
169
167
|
}
|
|
170
168
|
|
|
169
|
+
init(
|
|
170
|
+
anchorPoint: KeyframeGroup<LottieVector3D>,
|
|
171
|
+
position: KeyframeGroup<LottieVector3D>?,
|
|
172
|
+
positionX: KeyframeGroup<LottieVector1D>?,
|
|
173
|
+
positionY: KeyframeGroup<LottieVector1D>?,
|
|
174
|
+
scale: KeyframeGroup<LottieVector3D>,
|
|
175
|
+
rotationX: KeyframeGroup<LottieVector1D>,
|
|
176
|
+
rotationY: KeyframeGroup<LottieVector1D>,
|
|
177
|
+
rotationZ: KeyframeGroup<LottieVector1D>,
|
|
178
|
+
opacity: KeyframeGroup<LottieVector1D>,
|
|
179
|
+
rotation: KeyframeGroup<LottieVector1D>?)
|
|
180
|
+
{
|
|
181
|
+
self.anchorPoint = anchorPoint
|
|
182
|
+
self.position = position
|
|
183
|
+
self.positionX = positionX
|
|
184
|
+
self.positionY = positionY
|
|
185
|
+
self.scale = scale
|
|
186
|
+
self.rotationX = rotationX
|
|
187
|
+
self.rotationY = rotationY
|
|
188
|
+
self.rotationZ = rotationZ
|
|
189
|
+
self.opacity = opacity
|
|
190
|
+
self.rotation = rotation
|
|
191
|
+
}
|
|
192
|
+
|
|
171
193
|
// MARK: Internal
|
|
172
194
|
|
|
173
195
|
enum CodingKeys: String, CodingKey {
|
|
@@ -189,6 +211,21 @@ final class Transform: Codable, DictionaryInitializable {
|
|
|
189
211
|
case positionY = "y"
|
|
190
212
|
}
|
|
191
213
|
|
|
214
|
+
/// Default transform values to use if no transform is provided
|
|
215
|
+
static var `default`: Transform {
|
|
216
|
+
Transform(
|
|
217
|
+
anchorPoint: KeyframeGroup(LottieVector3D(x: Double(0), y: 0, z: 0)),
|
|
218
|
+
position: KeyframeGroup(LottieVector3D(x: Double(0), y: 0, z: 0)),
|
|
219
|
+
positionX: nil,
|
|
220
|
+
positionY: nil,
|
|
221
|
+
scale: KeyframeGroup(LottieVector3D(x: Double(100), y: 100, z: 100)),
|
|
222
|
+
rotationX: KeyframeGroup(LottieVector1D(0)),
|
|
223
|
+
rotationY: KeyframeGroup(LottieVector1D(0)),
|
|
224
|
+
rotationZ: KeyframeGroup(LottieVector1D(0)),
|
|
225
|
+
opacity: KeyframeGroup(LottieVector1D(100)),
|
|
226
|
+
rotation: nil)
|
|
227
|
+
}
|
|
228
|
+
|
|
192
229
|
/// The anchor point of the transform.
|
|
193
230
|
let anchorPoint: KeyframeGroup<LottieVector3D>
|
|
194
231
|
|
|
@@ -5,8 +5,6 @@
|
|
|
5
5
|
// Created by Brandon Withrow on 1/8/19.
|
|
6
6
|
//
|
|
7
7
|
|
|
8
|
-
import Foundation
|
|
9
|
-
|
|
10
8
|
// MARK: - GradientType
|
|
11
9
|
|
|
12
10
|
enum GradientType: Int, Codable, Sendable {
|
|
@@ -45,7 +43,7 @@ final class GradientFill: ShapeItem {
|
|
|
45
43
|
endPoint = try KeyframeGroup<LottieVector3D>(dictionary: endPointDictionary)
|
|
46
44
|
let gradientRawType: Int = try dictionary.value(for: CodingKeys.gradientType)
|
|
47
45
|
guard let gradient = GradientType(rawValue: gradientRawType) else {
|
|
48
|
-
throw InitializableError.invalidInput
|
|
46
|
+
throw InitializableError.invalidInput()
|
|
49
47
|
}
|
|
50
48
|
gradientType = gradient
|
|
51
49
|
if let highlightLengthDictionary = dictionary[CodingKeys.highlightLength.rawValue] as? [String: Any] {
|
|
@@ -5,8 +5,6 @@
|
|
|
5
5
|
// Created by Brandon Withrow on 1/8/19.
|
|
6
6
|
//
|
|
7
7
|
|
|
8
|
-
import Foundation
|
|
9
|
-
|
|
10
8
|
// MARK: - LineCap
|
|
11
9
|
|
|
12
10
|
enum LineCap: Int, Codable, Sendable {
|
|
@@ -60,7 +58,7 @@ final class GradientStroke: ShapeItem {
|
|
|
60
58
|
endPoint = try KeyframeGroup<LottieVector3D>(dictionary: endPointDictionary)
|
|
61
59
|
let gradientRawType: Int = try dictionary.value(for: CodingKeys.gradientType)
|
|
62
60
|
guard let gradient = GradientType(rawValue: gradientRawType) else {
|
|
63
|
-
throw InitializableError.invalidInput
|
|
61
|
+
throw InitializableError.invalidInput()
|
|
64
62
|
}
|
|
65
63
|
gradientType = gradient
|
|
66
64
|
if let highlightLengthDictionary = dictionary[CodingKeys.highlightLength.rawValue] as? [String: Any] {
|
|
@@ -5,8 +5,6 @@
|
|
|
5
5
|
// Created by Brandon Withrow on 1/8/19.
|
|
6
6
|
//
|
|
7
7
|
|
|
8
|
-
import Foundation
|
|
9
|
-
|
|
10
8
|
// MARK: - MergeMode
|
|
11
9
|
|
|
12
10
|
enum MergeMode: Int, Codable, Sendable {
|
|
@@ -33,7 +31,7 @@ final class Merge: ShapeItem {
|
|
|
33
31
|
required init(dictionary: [String: Any]) throws {
|
|
34
32
|
let modeRawType: Int = try dictionary.value(for: CodingKeys.mode)
|
|
35
33
|
guard let mode = MergeMode(rawValue: modeRawType) else {
|
|
36
|
-
throw InitializableError.invalidInput
|
|
34
|
+
throw InitializableError.invalidInput()
|
|
37
35
|
}
|
|
38
36
|
self.mode = mode
|
|
39
37
|
try super.init(dictionary: dictionary)
|
|
@@ -5,8 +5,6 @@
|
|
|
5
5
|
// Created by Brandon Withrow on 1/8/19.
|
|
6
6
|
//
|
|
7
7
|
|
|
8
|
-
import Foundation
|
|
9
|
-
|
|
10
8
|
// MARK: - ShapeType
|
|
11
9
|
|
|
12
10
|
enum ShapeType: String, Codable, Sendable {
|
|
@@ -122,7 +120,7 @@ class ShapeItem: Codable, DictionaryInitializable {
|
|
|
122
120
|
}
|
|
123
121
|
}
|
|
124
122
|
|
|
125
|
-
extension
|
|
123
|
+
extension [ShapeItem] {
|
|
126
124
|
|
|
127
125
|
static func fromDictionaries(_ dictionaries: [[String: Any]]) throws -> [ShapeItem] {
|
|
128
126
|
try dictionaries.compactMap { dictionary in
|
|
@@ -169,4 +167,5 @@ extension Array where Element == ShapeItem {
|
|
|
169
167
|
|
|
170
168
|
/// Since `ShapeItem` isn't `final`, we have to use `@unchecked Sendable` instead of `Sendable.`
|
|
171
169
|
/// All `ShapeItem` subclasses are immutable `Sendable` values.
|
|
170
|
+
// swiftlint:disable:next no_unchecked_sendable
|
|
172
171
|
extension ShapeItem: @unchecked Sendable { }
|
|
@@ -5,8 +5,6 @@
|
|
|
5
5
|
// Created by Brandon Withrow on 1/8/19.
|
|
6
6
|
//
|
|
7
7
|
|
|
8
|
-
import Foundation
|
|
9
|
-
|
|
10
8
|
// MARK: - StarType
|
|
11
9
|
|
|
12
10
|
enum StarType: Int, Codable, Sendable {
|
|
@@ -66,7 +64,7 @@ final class Star: ShapeItem {
|
|
|
66
64
|
points = try KeyframeGroup<LottieVector1D>(dictionary: pointsDictionary)
|
|
67
65
|
let starTypeRawValue: Int = try dictionary.value(for: CodingKeys.starType)
|
|
68
66
|
guard let starType = StarType(rawValue: starTypeRawValue) else {
|
|
69
|
-
throw InitializableError.invalidInput
|
|
67
|
+
throw InitializableError.invalidInput()
|
|
70
68
|
}
|
|
71
69
|
self.starType = starType
|
|
72
70
|
try super.init(dictionary: dictionary)
|
|
@@ -5,8 +5,6 @@
|
|
|
5
5
|
// Created by Brandon Withrow on 1/8/19.
|
|
6
6
|
//
|
|
7
7
|
|
|
8
|
-
import Foundation
|
|
9
|
-
|
|
10
8
|
// MARK: - TrimType
|
|
11
9
|
|
|
12
10
|
enum TrimType: Int, Codable {
|
|
@@ -38,7 +36,7 @@ final class Trim: ShapeItem {
|
|
|
38
36
|
offset = try KeyframeGroup<LottieVector1D>(dictionary: offsetDictionary)
|
|
39
37
|
let trimTypeRawValue: Int = try dictionary.value(for: CodingKeys.trimType)
|
|
40
38
|
guard let trimType = TrimType(rawValue: trimTypeRawValue) else {
|
|
41
|
-
throw InitializableError.invalidInput
|
|
39
|
+
throw InitializableError.invalidInput()
|
|
42
40
|
}
|
|
43
41
|
self.trimType = trimType
|
|
44
42
|
try super.init(dictionary: dictionary)
|
|
@@ -5,8 +5,6 @@
|
|
|
5
5
|
// Created by Brandon Withrow on 1/9/19.
|
|
6
6
|
//
|
|
7
7
|
|
|
8
|
-
import Foundation
|
|
9
|
-
|
|
10
8
|
// MARK: - TextJustification
|
|
11
9
|
|
|
12
10
|
enum TextJustification: Int, Codable {
|
|
@@ -27,7 +25,7 @@ final class TextDocument: Codable, DictionaryInitializable, AnyInitializable {
|
|
|
27
25
|
fontFamily = try dictionary.value(for: CodingKeys.fontFamily)
|
|
28
26
|
let justificationValue: Int = try dictionary.value(for: CodingKeys.justification)
|
|
29
27
|
guard let justification = TextJustification(rawValue: justificationValue) else {
|
|
30
|
-
throw InitializableError.invalidInput
|
|
28
|
+
throw InitializableError.invalidInput()
|
|
31
29
|
}
|
|
32
30
|
self.justification = justification
|
|
33
31
|
tracking = try dictionary.value(for: CodingKeys.tracking)
|
|
@@ -59,7 +57,7 @@ final class TextDocument: Codable, DictionaryInitializable, AnyInitializable {
|
|
|
59
57
|
|
|
60
58
|
convenience init(value: Any) throws {
|
|
61
59
|
guard let dictionary = value as? [String: Any] else {
|
|
62
|
-
throw InitializableError.invalidInput
|
|
60
|
+
throw InitializableError.invalidInput()
|
|
63
61
|
}
|
|
64
62
|
try self.init(dictionary: dictionary)
|
|
65
63
|
}
|
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
// Created by Brandon Withrow on 1/24/19.
|
|
6
6
|
//
|
|
7
7
|
|
|
8
|
-
import Foundation
|
|
9
8
|
import QuartzCore
|
|
10
9
|
|
|
11
10
|
// MARK: - LayerDebugStyle
|
|
@@ -54,7 +53,7 @@ extension CALayer {
|
|
|
54
53
|
}
|
|
55
54
|
string = string + "|_" + String(describing: self)
|
|
56
55
|
LottieLogger.shared.info(string)
|
|
57
|
-
if let sublayers
|
|
56
|
+
if let sublayers {
|
|
58
57
|
for sublayer in sublayers {
|
|
59
58
|
sublayer.logLayerTree(withIndent: withIndent + 1)
|
|
60
59
|
}
|
|
@@ -80,7 +79,7 @@ extension CALayer {
|
|
|
80
79
|
sublayers = cust.layerForDebugging().sublayers
|
|
81
80
|
}
|
|
82
81
|
|
|
83
|
-
if let sublayers
|
|
82
|
+
if let sublayers {
|
|
84
83
|
for i in 0..<sublayers.count {
|
|
85
84
|
if let debugLayer = sublayers[i] as? DebugLayer {
|
|
86
85
|
debugLayer.removeFromSuperlayer()
|
|
@@ -89,7 +88,7 @@ extension CALayer {
|
|
|
89
88
|
}
|
|
90
89
|
}
|
|
91
90
|
|
|
92
|
-
if let sublayers
|
|
91
|
+
if let sublayers {
|
|
93
92
|
for sublayer in sublayers {
|
|
94
93
|
sublayer.setDebuggingState(visible: visible)
|
|
95
94
|
}
|
|
@@ -206,7 +205,7 @@ extension LayerDebugStyle {
|
|
|
206
205
|
}
|
|
207
206
|
}
|
|
208
207
|
|
|
209
|
-
extension
|
|
208
|
+
extension [LayerModel] {
|
|
210
209
|
|
|
211
210
|
var parents: [Int] {
|
|
212
211
|
var array = [Int]()
|
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
// Created by Brandon Withrow on 2/4/19.
|
|
6
6
|
//
|
|
7
7
|
|
|
8
|
-
import Foundation
|
|
9
8
|
import QuartzCore
|
|
10
9
|
|
|
11
10
|
extension KeypathSearchable {
|
|
@@ -201,7 +200,7 @@ extension AnimationKeypath {
|
|
|
201
200
|
// Pops the top keypath from the stack if the keyname matches.
|
|
202
201
|
func popKey(_ keyname: String) -> AnimationKeypath? {
|
|
203
202
|
guard
|
|
204
|
-
let currentKey
|
|
203
|
+
let currentKey,
|
|
205
204
|
currentKey.equalsKeypath(keyname),
|
|
206
205
|
keys.count > 1
|
|
207
206
|
else {
|
|
@@ -215,7 +214,7 @@ extension AnimationKeypath {
|
|
|
215
214
|
if currentKey.keyPathType == .fuzzyWildcard {
|
|
216
215
|
/// Dont remove if current key is a fuzzy wildcard, and if the next keypath doesnt equal keypathname
|
|
217
216
|
if
|
|
218
|
-
let nextKeypath
|
|
217
|
+
let nextKeypath,
|
|
219
218
|
nextKeypath.equalsKeypath(keyname)
|
|
220
219
|
{
|
|
221
220
|
/// Remove next two keypaths. This keypath breaks the wildcard.
|
|
@@ -15,6 +15,11 @@ extension String {
|
|
|
15
15
|
return .rgb(red, green, blue)
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
+
var lottieColor: LottieColor {
|
|
19
|
+
let (red, green, blue) = hexColorComponents()
|
|
20
|
+
return .init(r: red, g: green, b: blue, a: 1.0)
|
|
21
|
+
}
|
|
22
|
+
|
|
18
23
|
func hexColorComponents() -> (red: CGFloat, green: CGFloat, blue: CGFloat) {
|
|
19
24
|
var cString: String = trimmingCharacters(in: .whitespacesAndNewlines).uppercased()
|
|
20
25
|
|
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
// Created by Brandon Withrow on 2/1/19.
|
|
6
6
|
//
|
|
7
7
|
|
|
8
|
-
import CoreGraphics
|
|
9
8
|
import Foundation
|
|
10
9
|
import QuartzCore
|
|
11
10
|
|
|
@@ -71,13 +70,13 @@ class AnimationCompletionDelegate: NSObject, CAAnimationDelegate {
|
|
|
71
70
|
public func animationDidStop(_ anim: CAAnimation, finished flag: Bool) {
|
|
72
71
|
guard ignoreDelegate == false else { return }
|
|
73
72
|
animationState = flag ? .complete : .cancelled
|
|
74
|
-
if let animationLayer
|
|
73
|
+
if let animationLayer, let key = animationKey {
|
|
75
74
|
animationLayer.removeAnimation(forKey: key)
|
|
76
75
|
if flag {
|
|
77
76
|
animationLayer.currentFrame = (anim as! CABasicAnimation).toValue as! CGFloat
|
|
78
77
|
}
|
|
79
78
|
}
|
|
80
|
-
if let completionBlock
|
|
79
|
+
if let completionBlock {
|
|
81
80
|
completionBlock(flag)
|
|
82
81
|
}
|
|
83
82
|
}
|
|
@@ -20,8 +20,18 @@ extension LottieAnimationSource {
|
|
|
20
20
|
switch self {
|
|
21
21
|
case .lottieAnimation(let animation):
|
|
22
22
|
return animation
|
|
23
|
+
case .dotLottieFile:
|
|
24
|
+
return dotLottieAnimation?.animation
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/// The `DotLottieFile.Animation`, if this is a dotLottie animation
|
|
29
|
+
var dotLottieAnimation: DotLottieFile.Animation? {
|
|
30
|
+
switch self {
|
|
31
|
+
case .lottieAnimation:
|
|
32
|
+
return nil
|
|
23
33
|
case .dotLottieFile(let dotLottieFile):
|
|
24
|
-
return dotLottieFile.animation()
|
|
34
|
+
return dotLottieFile.animation()
|
|
25
35
|
}
|
|
26
36
|
}
|
|
27
37
|
}
|
|
@@ -6,7 +6,6 @@
|
|
|
6
6
|
//
|
|
7
7
|
|
|
8
8
|
import CoreGraphics
|
|
9
|
-
import Foundation
|
|
10
9
|
|
|
11
10
|
// MARK: - BezierPath
|
|
12
11
|
|
|
@@ -405,7 +404,7 @@ extension BezierPath: AnyInitializable {
|
|
|
405
404
|
} else if let dictionary = value as? [String: Any] {
|
|
406
405
|
pathDictionary = dictionary
|
|
407
406
|
} else {
|
|
408
|
-
throw InitializableError.invalidInput
|
|
407
|
+
throw InitializableError.invalidInput()
|
|
409
408
|
}
|
|
410
409
|
closed = (try? pathDictionary.value(for: CodingKeys.closed)) ?? true
|
|
411
410
|
var vertexDictionaries: [Any] = try pathDictionary.value(for: CodingKeys.vertices)
|
|
@@ -415,7 +414,7 @@ extension BezierPath: AnyInitializable {
|
|
|
415
414
|
vertexDictionaries.count == inPointsDictionaries.count,
|
|
416
415
|
inPointsDictionaries.count == outPointsDictionaries.count
|
|
417
416
|
else {
|
|
418
|
-
throw InitializableError.invalidInput
|
|
417
|
+
throw InitializableError.invalidInput()
|
|
419
418
|
}
|
|
420
419
|
guard vertexDictionaries.count > 0 else {
|
|
421
420
|
length = 0
|
|
@@ -6,7 +6,6 @@
|
|
|
6
6
|
//
|
|
7
7
|
|
|
8
8
|
import CoreGraphics
|
|
9
|
-
import Foundation
|
|
10
9
|
|
|
11
10
|
// MARK: - LottieColor + Codable
|
|
12
11
|
|
|
@@ -70,7 +69,7 @@ extension LottieColor: AnyInitializable {
|
|
|
70
69
|
|
|
71
70
|
init(value: Any) throws {
|
|
72
71
|
guard var array = value as? [Double] else {
|
|
73
|
-
throw InitializableError.invalidInput
|
|
72
|
+
throw InitializableError.invalidInput()
|
|
74
73
|
}
|
|
75
74
|
var r: Double = array.count > 0 ? array.removeFirst() : 0
|
|
76
75
|
var g: Double = array.count > 0 ? array.removeFirst() : 0
|
|
@@ -54,7 +54,7 @@ extension LottieVector1D: AnyInitializable {
|
|
|
54
54
|
} else if let double = value as? Double {
|
|
55
55
|
self.value = double
|
|
56
56
|
} else {
|
|
57
|
-
throw InitializableError.invalidInput
|
|
57
|
+
throw InitializableError.invalidInput()
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
60
|
|
|
@@ -127,7 +127,7 @@ extension LottieVector2D: AnyInitializable {
|
|
|
127
127
|
|
|
128
128
|
init(value: Any) throws {
|
|
129
129
|
guard let dictionary = value as? [String: Any] else {
|
|
130
|
-
throw InitializableError.invalidInput
|
|
130
|
+
throw InitializableError.invalidInput()
|
|
131
131
|
}
|
|
132
132
|
|
|
133
133
|
if
|
|
@@ -138,7 +138,7 @@ extension LottieVector2D: AnyInitializable {
|
|
|
138
138
|
} else if let double = dictionary[CodingKeys.x.rawValue] as? Double {
|
|
139
139
|
x = double
|
|
140
140
|
} else {
|
|
141
|
-
throw InitializableError.invalidInput
|
|
141
|
+
throw InitializableError.invalidInput()
|
|
142
142
|
}
|
|
143
143
|
if
|
|
144
144
|
let array = dictionary[CodingKeys.y.rawValue] as? [Double],
|
|
@@ -148,7 +148,7 @@ extension LottieVector2D: AnyInitializable {
|
|
|
148
148
|
} else if let double = dictionary[CodingKeys.y.rawValue] as? Double {
|
|
149
149
|
y = double
|
|
150
150
|
} else {
|
|
151
|
-
throw InitializableError.invalidInput
|
|
151
|
+
throw InitializableError.invalidInput()
|
|
152
152
|
}
|
|
153
153
|
}
|
|
154
154
|
}
|
|
@@ -213,7 +213,7 @@ extension LottieVector3D: AnyInitializable {
|
|
|
213
213
|
|
|
214
214
|
init(value: Any) throws {
|
|
215
215
|
guard var array = value as? [Double] else {
|
|
216
|
-
throw InitializableError.invalidInput
|
|
216
|
+
throw InitializableError.invalidInput()
|
|
217
217
|
}
|
|
218
218
|
x = array.count > 0 ? array.removeFirst() : 0
|
|
219
219
|
y = array.count > 0 ? array.removeFirst() : 0
|
|
@@ -322,7 +322,7 @@ extension CATransform3D {
|
|
|
322
322
|
skewAxis: CGFloat?)
|
|
323
323
|
-> CATransform3D
|
|
324
324
|
{
|
|
325
|
-
if let skew
|
|
325
|
+
if let skew, let skewAxis {
|
|
326
326
|
return CATransform3DMakeTranslation(position.x, position.y, 0)
|
|
327
327
|
.rotated(rotationX, axis: .x)
|
|
328
328
|
.rotated(rotationY, axis: .y)
|
|
@@ -39,7 +39,7 @@ public final class LottieAnimation: Codable, Sendable, DictionaryInitializable {
|
|
|
39
39
|
assetLibrary = try container.decodeIfPresent(AssetLibrary.self, forKey: .assetLibrary)
|
|
40
40
|
markers = try container.decodeIfPresent([Marker].self, forKey: .markers)
|
|
41
41
|
|
|
42
|
-
if let markers
|
|
42
|
+
if let markers {
|
|
43
43
|
var markerMap: [String: Marker] = [:]
|
|
44
44
|
for marker in markers {
|
|
45
45
|
markerMap[marker.name] = marker
|
|
@@ -109,7 +109,7 @@ public final class LottieAnimation: Codable, Sendable, DictionaryInitializable {
|
|
|
109
109
|
|
|
110
110
|
/// Return all marker names, in order, or an empty list if none are specified
|
|
111
111
|
public var markerNames: [String] {
|
|
112
|
-
guard let markers
|
|
112
|
+
guard let markers else { return [] }
|
|
113
113
|
return markers.map { $0.name }
|
|
114
114
|
}
|
|
115
115
|
|