lottie-ios 3.4.3 → 3.5.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/FUNDING.yml +0 -11
- package/Lottie.xcodeproj/project.pbxproj +58 -58
- package/Lottie.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +22 -0
- package/Lottie.xcworkspace/xcshareddata/swiftpm/Package.resolved +2 -2
- package/Lottie.xcworkspace/xcuserdata/calstephens.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- package/Sources/Private/CoreAnimation/Animations/CALayer+addAnimation.swift +1 -1
- package/Sources/Private/CoreAnimation/Animations/CombinedShapeAnimation.swift +10 -7
- package/Sources/Private/CoreAnimation/Animations/EllipseAnimation.swift +2 -2
- package/Sources/Private/CoreAnimation/Animations/GradientAnimations.swift +2 -2
- package/Sources/Private/CoreAnimation/Animations/LayerProperty.swift +2 -2
- package/Sources/Private/CoreAnimation/Animations/OpacityAnimation.swift +1 -1
- package/Sources/Private/CoreAnimation/Animations/RectangleAnimation.swift +3 -3
- package/Sources/Private/CoreAnimation/Animations/ShapeAnimation.swift +16 -16
- package/Sources/Private/CoreAnimation/Animations/StarAnimation.swift +11 -11
- package/Sources/Private/CoreAnimation/Animations/StrokeAnimation.swift +4 -4
- package/Sources/Private/CoreAnimation/Animations/TransformAnimations.swift +13 -13
- package/Sources/Private/CoreAnimation/CoreAnimationLayer.swift +3 -3
- package/Sources/Private/CoreAnimation/Layers/AnimationLayer.swift +1 -1
- package/Sources/Private/CoreAnimation/Layers/CALayer+setupLayerHierarchy.swift +1 -1
- package/Sources/Private/CoreAnimation/Layers/LayerModel+makeAnimationLayer.swift +1 -1
- package/Sources/Private/CoreAnimation/Layers/PreCompLayer.swift +1 -1
- package/Sources/Private/CoreAnimation/Layers/RepeaterLayer.swift +9 -9
- package/Sources/Private/CoreAnimation/Layers/ShapeLayer.swift +1 -1
- package/Sources/Private/CoreAnimation/ValueProviderStore.swift +1 -1
- package/Sources/Private/MainThread/LayerContainers/CompLayers/MaskContainerLayer.swift +2 -2
- package/Sources/Private/MainThread/LayerContainers/CompLayers/PreCompositionLayer.swift +1 -1
- package/Sources/Private/MainThread/LayerContainers/CompLayers/SolidCompositionLayer.swift +2 -2
- package/Sources/Private/MainThread/LayerContainers/MainThreadAnimationLayer.swift +3 -3
- package/Sources/Private/MainThread/LayerContainers/Utility/LayerTransformNode.swift +10 -10
- package/Sources/Private/MainThread/NodeRenderSystem/Extensions/ItemsExtension.swift +1 -1
- package/Sources/Private/MainThread/NodeRenderSystem/Nodes/ModifierNodes/TrimPathNode.swift +3 -3
- package/Sources/Private/MainThread/NodeRenderSystem/Nodes/PathNodes/EllipseNode.swift +2 -2
- package/Sources/Private/MainThread/NodeRenderSystem/Nodes/PathNodes/PolygonNode.swift +5 -5
- package/Sources/Private/MainThread/NodeRenderSystem/Nodes/PathNodes/RectNode.swift +3 -3
- package/Sources/Private/MainThread/NodeRenderSystem/Nodes/PathNodes/StarNode.swift +9 -9
- package/Sources/Private/MainThread/NodeRenderSystem/Nodes/RenderContainers/GroupNode.swift +14 -14
- package/Sources/Private/MainThread/NodeRenderSystem/Nodes/RenderNodes/FillNode.swift +2 -2
- package/Sources/Private/MainThread/NodeRenderSystem/Nodes/RenderNodes/GradientFillNode.swift +3 -3
- package/Sources/Private/MainThread/NodeRenderSystem/Nodes/RenderNodes/GradientStrokeNode.swift +10 -10
- package/Sources/Private/MainThread/NodeRenderSystem/Nodes/RenderNodes/StrokeNode.swift +14 -14
- package/Sources/Private/MainThread/NodeRenderSystem/Nodes/Text/TextAnimatorNode.swift +11 -11
- package/Sources/Private/Model/Keyframes/KeyframeData.swift +12 -12
- package/Sources/Private/Model/Layers/PreCompLayerModel.swift +3 -3
- package/Sources/Private/Model/Objects/DashPattern.swift +2 -2
- package/Sources/Private/Model/Objects/Marker.swift +4 -0
- package/Sources/Private/Model/Objects/Mask.swift +10 -8
- package/Sources/Private/Model/Objects/Transform.swift +39 -35
- package/Sources/Private/Model/ShapeItems/Ellipse.swift +6 -6
- package/Sources/Private/Model/ShapeItems/Fill.swift +6 -6
- package/Sources/Private/Model/ShapeItems/GradientFill.swift +15 -15
- package/Sources/Private/Model/ShapeItems/GradientStroke.swift +18 -18
- package/Sources/Private/Model/ShapeItems/Rectangle.swift +9 -9
- package/Sources/Private/Model/ShapeItems/Repeater.swift +37 -32
- package/Sources/Private/Model/ShapeItems/ShapeTransform.swift +34 -28
- package/Sources/Private/Model/ShapeItems/Star.swift +21 -21
- package/Sources/Private/Model/ShapeItems/Stroke.swift +9 -9
- package/Sources/Private/Model/ShapeItems/Trim.swift +9 -9
- package/Sources/Private/Model/Text/TextAnimator.swift +33 -33
- package/Sources/Private/Model/Text/TextDocument.swift +8 -8
- package/Sources/Private/RootAnimationLayer.swift +4 -4
- package/Sources/Private/Utility/Interpolatable/InterpolatableExtensions.swift +1 -1
- package/Sources/Private/Utility/Interpolatable/KeyframeGroup+Extensions.swift +4 -4
- package/Sources/Private/Utility/Primitives/ColorExtension.swift +7 -7
- package/Sources/Private/Utility/Primitives/VectorsExtensions.swift +29 -21
- package/Sources/{Private/Model/Animation.swift → Public/Animation/LottieAnimation.swift} +13 -5
- package/Sources/Public/Animation/{AnimationPublic.swift → LottieAnimationHelpers.swift} +32 -17
- package/Sources/Public/Animation/{AnimationView.swift → LottieAnimationView.swift} +68 -19
- package/Sources/Public/Animation/{AnimationViewInitializers.swift → LottieAnimationViewInitializers.swift} +6 -6
- package/Sources/Public/AnimationCache/AnimationCacheProvider.swift +3 -3
- package/Sources/Public/AnimationCache/LRUAnimationCache.swift +3 -3
- package/Sources/Public/DynamicProperties/AnimationKeypath.swift +3 -3
- package/Sources/Public/DynamicProperties/AnyValueProvider.swift +2 -2
- package/Sources/Public/DynamicProperties/ValueProviders/ColorValueProvider.swift +10 -10
- package/Sources/Public/DynamicProperties/ValueProviders/FloatValueProvider.swift +4 -4
- package/Sources/Public/DynamicProperties/ValueProviders/GradientValueProvider.swift +5 -5
- package/Sources/Public/DynamicProperties/ValueProviders/PointValueProvider.swift +2 -2
- package/Sources/Public/DynamicProperties/ValueProviders/SizeValueProvider.swift +2 -2
- package/Sources/Public/FontProvider/AnimationFontProvider.swift +1 -1
- package/Sources/Public/ImageProvider/AnimationImageProvider.swift +2 -2
- package/Sources/Public/Keyframes/Interpolatable.swift +17 -17
- package/Sources/Public/Keyframes/Keyframe.swift +10 -10
- package/Sources/Public/LottieConfiguration.swift +1 -1
- package/Sources/Public/Primitives/{Color.swift → LottieColor.swift} +10 -2
- package/Sources/Public/Primitives/Vectors.swift +18 -2
- package/Sources/Public/TextProvider/AnimationTextProvider.swift +1 -1
- package/Sources/Public/iOS/AnimatedButton.swift +26 -24
- package/Sources/Public/iOS/AnimatedControl.swift +6 -6
- package/Sources/Public/iOS/AnimatedSwitch.swift +16 -11
- package/Sources/Public/iOS/Compatibility/CompatibleAnimationView.swift +23 -8
- package/Sources/Public/iOS/{AnimationViewBase.swift → LottieAnimationViewBase.swift} +4 -4
- package/Sources/Public/iOS/UIColorExtension.swift +2 -2
- package/Sources/Public/macOS/{AnimationViewBase.macOS.swift → LottieAnimationViewBase.macOS.swift} +4 -4
- package/Tests/AnimationKeypathTests.swift +1 -1
- package/Tests/Artifacts/LottieTests.xcresult/Data/data.0~22UHuHHSTYh5NFeueXXSDdev_8VAbw8H8yl2ICssaC0vaCLj2G2CGZCjUMEyki9c-k-CecFJRyspvzJLiQTjUw== +0 -0
- package/Tests/Artifacts/LottieTests.xcresult/Data/data.0~4VqMqsI5lOfxRppnud6-VDWcNsU8J7VgFCJfW2dXPwOcAkvU-I8Um5yp9n0Zv6nr3VmcxYggaVMDFfR0U_vjKw== +1 -0
- package/Tests/Artifacts/LottieTests.xcresult/Data/data.0~6DmZhylL-XQx-O08NugyWINI0ugrLVgVOpbrdp0sT2tEqw-jVD2vvBWYRnYHALkM2_qP2yy-VoovSMzfYALY8A== +0 -0
- package/Tests/Artifacts/LottieTests.xcresult/Data/data.0~9dj3E5foFK2l_1CEpoRxToU1N6jCdhRVc5vhR10fHS938L9w8HxbiVCPGxYy5981O6M1yZsD4tHFbqBMbER4bQ== +0 -0
- package/Tests/Artifacts/LottieTests.xcresult/Data/data.0~Bys36bGK_YkCjRNoPMkq3R0OcyPNrVNka1Gz45ilbXJTqp9xAJexx6qKBh86_fm7OgBCO0WS2gJBy77DUUnOOA== +1 -0
- package/Tests/Artifacts/LottieTests.xcresult/Data/data.0~QJMKb50ZfaWLSHxBSGPlrzULLCqTlb_6W-X0N1-e5PfwCKjpYKOElImsOwgZKVK0cdyf-6u4Zp3mm3BfGQVQ9Q== +0 -0
- package/Tests/Artifacts/LottieTests.xcresult/Data/data.0~YyEdK1WNFTPo-R3Og2OWduKSikuFYneXurEZbyNLZeDmJLJkd7Ew8jNxy4mvgZw4f4Sikp4swEjJgVzXqhev5g== +1 -0
- package/Tests/Artifacts/LottieTests.xcresult/Data/data.0~bZd73QR3pWGndrn46_NXJw2dUT7WdBjkH5fdPZ7EnzlcZ9Ifv6WR14RKeWI9diiEjcRJE7ZOWqZ9fzf2vvTnLw== +0 -0
- package/Tests/Artifacts/LottieTests.xcresult/Data/data.0~baCaLsz8Sq-r6sHhJcZeowVdrnrIxKwDps5Q1Aq38G2AQ3HaopZ9m3A8IXtTFSiZGNiO2qnM9yH7iJfuzC5K0A== +0 -0
- package/Tests/Artifacts/LottieTests.xcresult/Data/data.0~iZXYCVJLYHKtR7eFHwefLiejC9CkRbBBSkkZmwfkiDEIdUKE4GgVkdDrcHry91RF7d9y7AuYovfGVp1-fuNg0g== +0 -0
- package/Tests/Artifacts/LottieTests.xcresult/Data/data.0~pTTJImrF4EktmVXGCigWBn7v6YlbH5eFCXIW35CW-iyypvzFMXXYYbQO1ly6Bf3u6CdaepZko-L9obC1mjigMA== +0 -0
- package/Tests/Artifacts/LottieTests.xcresult/Data/data.0~sVXLeN9UCp6IsOPeuoY76nF-bP-w2rBm61UYvs5XE3o5XhbM7itN2s1XD5i9COIaVMytmUFB-mvCLCqHfHWwpw== +0 -0
- package/Tests/Artifacts/LottieTests.xcresult/Data/data.0~t8Vsjx3tjPBGQIElMCvqzxLS0hDmBGuLa_CEiB64N2Vxp3qoUfNF0Sar84QnEDOKfyVF6c1KTn1QYg7fRJrk8g== +0 -0
- package/Tests/Artifacts/LottieTests.xcresult/Data/data.0~zUmPx8nRHLa8-g1WWSYYzveS_6qmBf-y4xyS-dHzD7c_xWwPZlsfKg8UngImNdn0gxGOBSRmCeXbYwWpLfj_Rg== +0 -0
- package/Tests/Artifacts/LottieTests.xcresult/Data/refs.0~22UHuHHSTYh5NFeueXXSDdev_8VAbw8H8yl2ICssaC0vaCLj2G2CGZCjUMEyki9c-k-CecFJRyspvzJLiQTjUw== +0 -0
- package/Tests/Artifacts/LottieTests.xcresult/Data/refs.0~4VqMqsI5lOfxRppnud6-VDWcNsU8J7VgFCJfW2dXPwOcAkvU-I8Um5yp9n0Zv6nr3VmcxYggaVMDFfR0U_vjKw== +0 -0
- package/Tests/Artifacts/LottieTests.xcresult/Data/refs.0~6DmZhylL-XQx-O08NugyWINI0ugrLVgVOpbrdp0sT2tEqw-jVD2vvBWYRnYHALkM2_qP2yy-VoovSMzfYALY8A== +0 -0
- package/Tests/Artifacts/LottieTests.xcresult/Data/refs.0~9dj3E5foFK2l_1CEpoRxToU1N6jCdhRVc5vhR10fHS938L9w8HxbiVCPGxYy5981O6M1yZsD4tHFbqBMbER4bQ== +0 -0
- package/Tests/Artifacts/LottieTests.xcresult/Data/refs.0~Bys36bGK_YkCjRNoPMkq3R0OcyPNrVNka1Gz45ilbXJTqp9xAJexx6qKBh86_fm7OgBCO0WS2gJBy77DUUnOOA== +0 -0
- package/Tests/Artifacts/LottieTests.xcresult/Data/refs.0~QJMKb50ZfaWLSHxBSGPlrzULLCqTlb_6W-X0N1-e5PfwCKjpYKOElImsOwgZKVK0cdyf-6u4Zp3mm3BfGQVQ9Q== +0 -0
- package/Tests/Artifacts/LottieTests.xcresult/Data/refs.0~YyEdK1WNFTPo-R3Og2OWduKSikuFYneXurEZbyNLZeDmJLJkd7Ew8jNxy4mvgZw4f4Sikp4swEjJgVzXqhev5g== +0 -0
- package/Tests/Artifacts/LottieTests.xcresult/Data/refs.0~bZd73QR3pWGndrn46_NXJw2dUT7WdBjkH5fdPZ7EnzlcZ9Ifv6WR14RKeWI9diiEjcRJE7ZOWqZ9fzf2vvTnLw== +0 -0
- package/Tests/Artifacts/LottieTests.xcresult/Data/refs.0~baCaLsz8Sq-r6sHhJcZeowVdrnrIxKwDps5Q1Aq38G2AQ3HaopZ9m3A8IXtTFSiZGNiO2qnM9yH7iJfuzC5K0A== +0 -0
- package/Tests/Artifacts/LottieTests.xcresult/Data/refs.0~iZXYCVJLYHKtR7eFHwefLiejC9CkRbBBSkkZmwfkiDEIdUKE4GgVkdDrcHry91RF7d9y7AuYovfGVp1-fuNg0g== +0 -0
- package/Tests/Artifacts/LottieTests.xcresult/Data/refs.0~pTTJImrF4EktmVXGCigWBn7v6YlbH5eFCXIW35CW-iyypvzFMXXYYbQO1ly6Bf3u6CdaepZko-L9obC1mjigMA== +0 -0
- package/Tests/Artifacts/LottieTests.xcresult/Data/refs.0~sVXLeN9UCp6IsOPeuoY76nF-bP-w2rBm61UYvs5XE3o5XhbM7itN2s1XD5i9COIaVMytmUFB-mvCLCqHfHWwpw== +0 -0
- package/Tests/Artifacts/LottieTests.xcresult/Data/refs.0~t8Vsjx3tjPBGQIElMCvqzxLS0hDmBGuLa_CEiB64N2Vxp3qoUfNF0Sar84QnEDOKfyVF6c1KTn1QYg7fRJrk8g== +0 -0
- package/Tests/Artifacts/LottieTests.xcresult/Data/refs.0~zUmPx8nRHLa8-g1WWSYYzveS_6qmBf-y4xyS-dHzD7c_xWwPZlsfKg8UngImNdn0gxGOBSRmCeXbYwWpLfj_Rg== +0 -0
- package/Tests/Artifacts/LottieTests.xcresult/Info.plist +29 -0
- package/Tests/ParsingTests.swift +2 -2
- package/Tests/PerformanceTests.swift +9 -9
- package/Tests/SnapshotConfiguration.swift +4 -4
- package/Tests/SnapshotTests.swift +6 -6
- package/lottie-ios.podspec +1 -1
- package/package.json +1 -1
package/Sources/Private/MainThread/NodeRenderSystem/Nodes/RenderNodes/GradientStrokeNode.swift
CHANGED
|
@@ -28,8 +28,8 @@ final class GradientStrokeProperties: NodePropertyMap, KeypathSearchable {
|
|
|
28
28
|
lineJoin = gradientStroke.lineJoin
|
|
29
29
|
|
|
30
30
|
if let dashes = gradientStroke.dashPattern {
|
|
31
|
-
var dashPatterns = ContiguousArray<ContiguousArray<Keyframe<
|
|
32
|
-
var dashPhase = ContiguousArray<Keyframe<
|
|
31
|
+
var dashPatterns = ContiguousArray<ContiguousArray<Keyframe<LottieVector1D>>>()
|
|
32
|
+
var dashPhase = ContiguousArray<Keyframe<LottieVector1D>>()
|
|
33
33
|
for dash in dashes {
|
|
34
34
|
if dash.type == .offset {
|
|
35
35
|
dashPhase = dash.value.keyframes
|
|
@@ -40,8 +40,8 @@ final class GradientStrokeProperties: NodePropertyMap, KeypathSearchable {
|
|
|
40
40
|
dashPattern = NodeProperty(provider: GroupInterpolator(keyframeGroups: dashPatterns))
|
|
41
41
|
self.dashPhase = NodeProperty(provider: KeyframeInterpolator(keyframes: dashPhase))
|
|
42
42
|
} else {
|
|
43
|
-
dashPattern = NodeProperty(provider: SingleValueProvider([
|
|
44
|
-
dashPhase = NodeProperty(provider: SingleValueProvider(
|
|
43
|
+
dashPattern = NodeProperty(provider: SingleValueProvider([LottieVector1D]()))
|
|
44
|
+
dashPhase = NodeProperty(provider: SingleValueProvider(LottieVector1D(0)))
|
|
45
45
|
}
|
|
46
46
|
keypathProperties = [
|
|
47
47
|
"Opacity" : opacity,
|
|
@@ -59,14 +59,14 @@ final class GradientStrokeProperties: NodePropertyMap, KeypathSearchable {
|
|
|
59
59
|
|
|
60
60
|
var keypathName: String
|
|
61
61
|
|
|
62
|
-
let opacity: NodeProperty<
|
|
63
|
-
let startPoint: NodeProperty<
|
|
64
|
-
let endPoint: NodeProperty<
|
|
62
|
+
let opacity: NodeProperty<LottieVector1D>
|
|
63
|
+
let startPoint: NodeProperty<LottieVector3D>
|
|
64
|
+
let endPoint: NodeProperty<LottieVector3D>
|
|
65
65
|
let colors: NodeProperty<[Double]>
|
|
66
|
-
let width: NodeProperty<
|
|
66
|
+
let width: NodeProperty<LottieVector1D>
|
|
67
67
|
|
|
68
|
-
let dashPattern: NodeProperty<[
|
|
69
|
-
let dashPhase: NodeProperty<
|
|
68
|
+
let dashPattern: NodeProperty<[LottieVector1D]>
|
|
69
|
+
let dashPhase: NodeProperty<LottieVector1D>
|
|
70
70
|
|
|
71
71
|
let lineCap: LineCap
|
|
72
72
|
let lineJoin: LineJoin
|
|
@@ -27,13 +27,13 @@ final class StrokeNodeProperties: NodePropertyMap, KeypathSearchable {
|
|
|
27
27
|
let (dashPatterns, dashPhase) = dashes.shapeLayerConfiguration
|
|
28
28
|
dashPattern = NodeProperty(provider: GroupInterpolator(keyframeGroups: dashPatterns))
|
|
29
29
|
if dashPhase.count == 0 {
|
|
30
|
-
self.dashPhase = NodeProperty(provider: SingleValueProvider(
|
|
30
|
+
self.dashPhase = NodeProperty(provider: SingleValueProvider(LottieVector1D(0)))
|
|
31
31
|
} else {
|
|
32
32
|
self.dashPhase = NodeProperty(provider: KeyframeInterpolator(keyframes: dashPhase))
|
|
33
33
|
}
|
|
34
34
|
} else {
|
|
35
|
-
dashPattern = NodeProperty(provider: SingleValueProvider([
|
|
36
|
-
dashPhase = NodeProperty(provider: SingleValueProvider(
|
|
35
|
+
dashPattern = NodeProperty(provider: SingleValueProvider([LottieVector1D]()))
|
|
36
|
+
dashPhase = NodeProperty(provider: SingleValueProvider(LottieVector1D(0)))
|
|
37
37
|
}
|
|
38
38
|
keypathProperties = [
|
|
39
39
|
"Opacity" : opacity,
|
|
@@ -51,12 +51,12 @@ final class StrokeNodeProperties: NodePropertyMap, KeypathSearchable {
|
|
|
51
51
|
let keypathProperties: [String: AnyNodeProperty]
|
|
52
52
|
let properties: [AnyNodeProperty]
|
|
53
53
|
|
|
54
|
-
let opacity: NodeProperty<
|
|
55
|
-
let color: NodeProperty<
|
|
56
|
-
let width: NodeProperty<
|
|
54
|
+
let opacity: NodeProperty<LottieVector1D>
|
|
55
|
+
let color: NodeProperty<LottieColor>
|
|
56
|
+
let width: NodeProperty<LottieVector1D>
|
|
57
57
|
|
|
58
|
-
let dashPattern: NodeProperty<[
|
|
59
|
-
let dashPhase: NodeProperty<
|
|
58
|
+
let dashPattern: NodeProperty<[LottieVector1D]>
|
|
59
|
+
let dashPhase: NodeProperty<LottieVector1D>
|
|
60
60
|
|
|
61
61
|
let lineCap: LineCap
|
|
62
62
|
let lineJoin: LineJoin
|
|
@@ -133,14 +133,14 @@ final class StrokeNode: AnimatorNode, RenderNode {
|
|
|
133
133
|
|
|
134
134
|
extension Array where Element == DashElement {
|
|
135
135
|
typealias ShapeLayerConfiguration = (
|
|
136
|
-
dashPatterns: ContiguousArray<ContiguousArray<Keyframe<
|
|
137
|
-
dashPhase: ContiguousArray<Keyframe<
|
|
136
|
+
dashPatterns: ContiguousArray<ContiguousArray<Keyframe<LottieVector1D>>>,
|
|
137
|
+
dashPhase: ContiguousArray<Keyframe<LottieVector1D>>)
|
|
138
138
|
|
|
139
139
|
/// Converts the `[DashElement]` data model into `lineDashPattern` and `lineDashPhase`
|
|
140
140
|
/// representations usable in a `CAShapeLayer`
|
|
141
141
|
var shapeLayerConfiguration: ShapeLayerConfiguration {
|
|
142
|
-
var dashPatterns = ContiguousArray<ContiguousArray<Keyframe<
|
|
143
|
-
var dashPhase = ContiguousArray<Keyframe<
|
|
142
|
+
var dashPatterns = ContiguousArray<ContiguousArray<Keyframe<LottieVector1D>>>()
|
|
143
|
+
var dashPhase = ContiguousArray<Keyframe<LottieVector1D>>()
|
|
144
144
|
for dash in self {
|
|
145
145
|
if dash.type == .offset {
|
|
146
146
|
dashPhase = dash.value.keyframes
|
|
@@ -150,14 +150,14 @@ extension Array where Element == DashElement {
|
|
|
150
150
|
}
|
|
151
151
|
|
|
152
152
|
dashPatterns = ContiguousArray(dashPatterns.map { pattern in
|
|
153
|
-
ContiguousArray(pattern.map { keyframe -> Keyframe<
|
|
153
|
+
ContiguousArray(pattern.map { keyframe -> Keyframe<LottieVector1D> in
|
|
154
154
|
// The recommended way to create a stroke of round dots, in theory,
|
|
155
155
|
// is to use a value of 0 followed by the stroke width, but for
|
|
156
156
|
// some reason Core Animation incorrectly (?) renders these as pills
|
|
157
157
|
// instead of circles. As a workaround, for parity with Lottie on other
|
|
158
158
|
// platforms, we can change `0`s to `0.01`: https://stackoverflow.com/a/38036486
|
|
159
159
|
if keyframe.value.cgFloatValue == 0 {
|
|
160
|
-
return keyframe.withValue(
|
|
160
|
+
return keyframe.withValue(LottieVector1D(0.01))
|
|
161
161
|
} else {
|
|
162
162
|
return keyframe
|
|
163
163
|
}
|
|
@@ -105,17 +105,17 @@ final class TextAnimatorNodeProperties: NodePropertyMap, KeypathSearchable {
|
|
|
105
105
|
|
|
106
106
|
let keypathName: String
|
|
107
107
|
|
|
108
|
-
let anchor: NodeProperty<
|
|
109
|
-
let position: NodeProperty<
|
|
110
|
-
let scale: NodeProperty<
|
|
111
|
-
let skew: NodeProperty<
|
|
112
|
-
let skewAxis: NodeProperty<
|
|
113
|
-
let rotation: NodeProperty<
|
|
114
|
-
let opacity: NodeProperty<
|
|
115
|
-
let strokeColor: NodeProperty<
|
|
116
|
-
let fillColor: NodeProperty<
|
|
117
|
-
let strokeWidth: NodeProperty<
|
|
118
|
-
let tracking: NodeProperty<
|
|
108
|
+
let anchor: NodeProperty<LottieVector3D>?
|
|
109
|
+
let position: NodeProperty<LottieVector3D>?
|
|
110
|
+
let scale: NodeProperty<LottieVector3D>?
|
|
111
|
+
let skew: NodeProperty<LottieVector1D>?
|
|
112
|
+
let skewAxis: NodeProperty<LottieVector1D>?
|
|
113
|
+
let rotation: NodeProperty<LottieVector1D>?
|
|
114
|
+
let opacity: NodeProperty<LottieVector1D>?
|
|
115
|
+
let strokeColor: NodeProperty<LottieColor>?
|
|
116
|
+
let fillColor: NodeProperty<LottieColor>?
|
|
117
|
+
let strokeWidth: NodeProperty<LottieVector1D>?
|
|
118
|
+
let tracking: NodeProperty<LottieVector1D>?
|
|
119
119
|
|
|
120
120
|
let keypathProperties: [String: AnyNodeProperty]
|
|
121
121
|
let properties: [AnyNodeProperty]
|
|
@@ -24,10 +24,10 @@ final class KeyframeData<T> {
|
|
|
24
24
|
endValue: T?,
|
|
25
25
|
time: AnimationFrameTime?,
|
|
26
26
|
hold: Int?,
|
|
27
|
-
inTangent:
|
|
28
|
-
outTangent:
|
|
29
|
-
spatialInTangent:
|
|
30
|
-
spatialOutTangent:
|
|
27
|
+
inTangent: LottieVector2D?,
|
|
28
|
+
outTangent: LottieVector2D?,
|
|
29
|
+
spatialInTangent: LottieVector3D?,
|
|
30
|
+
spatialOutTangent: LottieVector3D?)
|
|
31
31
|
{
|
|
32
32
|
self.startValue = startValue
|
|
33
33
|
self.endValue = endValue
|
|
@@ -62,14 +62,14 @@ final class KeyframeData<T> {
|
|
|
62
62
|
let hold: Int?
|
|
63
63
|
|
|
64
64
|
/// The in tangent for the time interpolation curve.
|
|
65
|
-
let inTangent:
|
|
65
|
+
let inTangent: LottieVector2D?
|
|
66
66
|
/// The out tangent for the time interpolation curve.
|
|
67
|
-
let outTangent:
|
|
67
|
+
let outTangent: LottieVector2D?
|
|
68
68
|
|
|
69
69
|
/// The spacial in tangent of the vector.
|
|
70
|
-
let spatialInTangent:
|
|
70
|
+
let spatialInTangent: LottieVector3D?
|
|
71
71
|
/// The spacial out tangent of the vector.
|
|
72
|
-
let spatialOutTangent:
|
|
72
|
+
let spatialOutTangent: LottieVector3D?
|
|
73
73
|
|
|
74
74
|
var isHold: Bool {
|
|
75
75
|
if let hold = hold {
|
|
@@ -95,10 +95,10 @@ extension KeyframeData: DictionaryInitializable where T: AnyInitializable {
|
|
|
95
95
|
let endValue = try? dictionary[CodingKeys.endValue.rawValue].flatMap(T.init)
|
|
96
96
|
let time: AnimationFrameTime? = try? dictionary.value(for: CodingKeys.time)
|
|
97
97
|
let hold: Int? = try? dictionary.value(for: CodingKeys.hold)
|
|
98
|
-
let inTangent:
|
|
99
|
-
let outTangent:
|
|
100
|
-
let spatialInTangent:
|
|
101
|
-
let spatialOutTangent:
|
|
98
|
+
let inTangent: LottieVector2D? = try? dictionary.value(for: CodingKeys.inTangent)
|
|
99
|
+
let outTangent: LottieVector2D? = try? dictionary.value(for: CodingKeys.outTangent)
|
|
100
|
+
let spatialInTangent: LottieVector3D? = try? dictionary.value(for: CodingKeys.spatialInTangent)
|
|
101
|
+
let spatialOutTangent: LottieVector3D? = try? dictionary.value(for: CodingKeys.spatialOutTangent)
|
|
102
102
|
|
|
103
103
|
self.init(
|
|
104
104
|
startValue: startValue,
|
|
@@ -15,7 +15,7 @@ final class PreCompLayerModel: LayerModel {
|
|
|
15
15
|
required init(from decoder: Decoder) throws {
|
|
16
16
|
let container = try decoder.container(keyedBy: PreCompLayerModel.CodingKeys.self)
|
|
17
17
|
referenceID = try container.decode(String.self, forKey: .referenceID)
|
|
18
|
-
timeRemapping = try container.decodeIfPresent(KeyframeGroup<
|
|
18
|
+
timeRemapping = try container.decodeIfPresent(KeyframeGroup<LottieVector1D>.self, forKey: .timeRemapping)
|
|
19
19
|
width = try container.decode(Double.self, forKey: .width)
|
|
20
20
|
height = try container.decode(Double.self, forKey: .height)
|
|
21
21
|
try super.init(from: decoder)
|
|
@@ -24,7 +24,7 @@ final class PreCompLayerModel: LayerModel {
|
|
|
24
24
|
required init(dictionary: [String: Any]) throws {
|
|
25
25
|
referenceID = try dictionary.value(for: CodingKeys.referenceID)
|
|
26
26
|
if let timeRemappingDictionary = dictionary[CodingKeys.timeRemapping.rawValue] as? [String: Any] {
|
|
27
|
-
timeRemapping = try KeyframeGroup<
|
|
27
|
+
timeRemapping = try KeyframeGroup<LottieVector1D>(dictionary: timeRemappingDictionary)
|
|
28
28
|
} else {
|
|
29
29
|
timeRemapping = nil
|
|
30
30
|
}
|
|
@@ -39,7 +39,7 @@ final class PreCompLayerModel: LayerModel {
|
|
|
39
39
|
let referenceID: String
|
|
40
40
|
|
|
41
41
|
/// A value that remaps time over time.
|
|
42
|
-
let timeRemapping: KeyframeGroup<
|
|
42
|
+
let timeRemapping: KeyframeGroup<LottieVector1D>?
|
|
43
43
|
|
|
44
44
|
/// Precomp Width
|
|
45
45
|
let width: Double
|
|
@@ -28,7 +28,7 @@ final class DashElement: Codable, DictionaryInitializable {
|
|
|
28
28
|
}
|
|
29
29
|
self.type = type
|
|
30
30
|
let valueDictionary: [String: Any] = try dictionary.value(for: CodingKeys.value)
|
|
31
|
-
value = try KeyframeGroup<
|
|
31
|
+
value = try KeyframeGroup<LottieVector1D>(dictionary: valueDictionary)
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
// MARK: Internal
|
|
@@ -39,6 +39,6 @@ final class DashElement: Codable, DictionaryInitializable {
|
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
let type: DashElementType
|
|
42
|
-
let value: KeyframeGroup<
|
|
42
|
+
let value: KeyframeGroup<LottieVector1D>
|
|
43
43
|
|
|
44
44
|
}
|
|
@@ -15,6 +15,7 @@ final class Marker: Codable, DictionaryInitializable {
|
|
|
15
15
|
init(dictionary: [String: Any]) throws {
|
|
16
16
|
name = try dictionary.value(for: CodingKeys.name)
|
|
17
17
|
frameTime = try dictionary.value(for: CodingKeys.frameTime)
|
|
18
|
+
durationFrameTime = try dictionary.value(for: CodingKeys.durationFrameTime)
|
|
18
19
|
}
|
|
19
20
|
|
|
20
21
|
// MARK: Internal
|
|
@@ -22,6 +23,7 @@ final class Marker: Codable, DictionaryInitializable {
|
|
|
22
23
|
enum CodingKeys: String, CodingKey {
|
|
23
24
|
case name = "cm"
|
|
24
25
|
case frameTime = "tm"
|
|
26
|
+
case durationFrameTime = "dr"
|
|
25
27
|
}
|
|
26
28
|
|
|
27
29
|
/// The Marker Name
|
|
@@ -30,4 +32,6 @@ final class Marker: Codable, DictionaryInitializable {
|
|
|
30
32
|
/// The Frame time of the marker
|
|
31
33
|
let frameTime: AnimationFrameTime
|
|
32
34
|
|
|
35
|
+
/// The duration of the marker, in frames.
|
|
36
|
+
let durationFrameTime: AnimationFrameTime
|
|
33
37
|
}
|
|
@@ -28,10 +28,12 @@ final class Mask: Codable, DictionaryInitializable {
|
|
|
28
28
|
required init(from decoder: Decoder) throws {
|
|
29
29
|
let container = try decoder.container(keyedBy: Mask.CodingKeys.self)
|
|
30
30
|
mode = try container.decodeIfPresent(MaskMode.self, forKey: .mode) ?? .add
|
|
31
|
-
opacity = try container
|
|
31
|
+
opacity = try container
|
|
32
|
+
.decodeIfPresent(KeyframeGroup<LottieVector1D>.self, forKey: .opacity) ?? KeyframeGroup(LottieVector1D(100))
|
|
32
33
|
shape = try container.decode(KeyframeGroup<BezierPath>.self, forKey: .shape)
|
|
33
34
|
inverted = try container.decodeIfPresent(Bool.self, forKey: .inverted) ?? false
|
|
34
|
-
expansion = try container
|
|
35
|
+
expansion = try container
|
|
36
|
+
.decodeIfPresent(KeyframeGroup<LottieVector1D>.self, forKey: .expansion) ?? KeyframeGroup(LottieVector1D(0))
|
|
35
37
|
}
|
|
36
38
|
|
|
37
39
|
init(dictionary: [String: Any]) throws {
|
|
@@ -44,17 +46,17 @@ final class Mask: Codable, DictionaryInitializable {
|
|
|
44
46
|
mode = .add
|
|
45
47
|
}
|
|
46
48
|
if let opacityDictionary = dictionary[CodingKeys.opacity.rawValue] as? [String: Any] {
|
|
47
|
-
opacity = try KeyframeGroup<
|
|
49
|
+
opacity = try KeyframeGroup<LottieVector1D>(dictionary: opacityDictionary)
|
|
48
50
|
} else {
|
|
49
|
-
opacity = KeyframeGroup(
|
|
51
|
+
opacity = KeyframeGroup(LottieVector1D(100))
|
|
50
52
|
}
|
|
51
53
|
let shapeDictionary: [String: Any] = try dictionary.value(for: CodingKeys.shape)
|
|
52
54
|
shape = try KeyframeGroup<BezierPath>(dictionary: shapeDictionary)
|
|
53
55
|
inverted = (try? dictionary.value(for: CodingKeys.inverted)) ?? false
|
|
54
56
|
if let expansionDictionary = dictionary[CodingKeys.expansion.rawValue] as? [String: Any] {
|
|
55
|
-
expansion = try KeyframeGroup<
|
|
57
|
+
expansion = try KeyframeGroup<LottieVector1D>(dictionary: expansionDictionary)
|
|
56
58
|
} else {
|
|
57
|
-
expansion = KeyframeGroup(
|
|
59
|
+
expansion = KeyframeGroup(LottieVector1D(0))
|
|
58
60
|
}
|
|
59
61
|
}
|
|
60
62
|
|
|
@@ -70,11 +72,11 @@ final class Mask: Codable, DictionaryInitializable {
|
|
|
70
72
|
|
|
71
73
|
let mode: MaskMode
|
|
72
74
|
|
|
73
|
-
let opacity: KeyframeGroup<
|
|
75
|
+
let opacity: KeyframeGroup<LottieVector1D>
|
|
74
76
|
|
|
75
77
|
let shape: KeyframeGroup<BezierPath>
|
|
76
78
|
|
|
77
79
|
let inverted: Bool
|
|
78
80
|
|
|
79
|
-
let expansion: KeyframeGroup<
|
|
81
|
+
let expansion: KeyframeGroup<LottieVector1D>
|
|
80
82
|
}
|
|
@@ -19,23 +19,24 @@ final class Transform: Codable, DictionaryInitializable {
|
|
|
19
19
|
|
|
20
20
|
// AnchorPoint
|
|
21
21
|
anchorPoint = try container
|
|
22
|
-
.decodeIfPresent(KeyframeGroup<
|
|
22
|
+
.decodeIfPresent(KeyframeGroup<LottieVector3D>.self, forKey: .anchorPoint) ??
|
|
23
|
+
KeyframeGroup(LottieVector3D(x: Double(0), y: 0, z: 0))
|
|
23
24
|
|
|
24
25
|
// Position
|
|
25
26
|
if container.contains(.positionX), container.contains(.positionY) {
|
|
26
27
|
// Position dimensions are split into two keyframe groups
|
|
27
|
-
positionX = try container.decode(KeyframeGroup<
|
|
28
|
-
positionY = try container.decode(KeyframeGroup<
|
|
28
|
+
positionX = try container.decode(KeyframeGroup<LottieVector1D>.self, forKey: .positionX)
|
|
29
|
+
positionY = try container.decode(KeyframeGroup<LottieVector1D>.self, forKey: .positionY)
|
|
29
30
|
position = nil
|
|
30
|
-
} else if let positionKeyframes = try? container.decode(KeyframeGroup<
|
|
31
|
+
} else if let positionKeyframes = try? container.decode(KeyframeGroup<LottieVector3D>.self, forKey: .position) {
|
|
31
32
|
// Position dimensions are a single keyframe group.
|
|
32
33
|
position = positionKeyframes
|
|
33
34
|
positionX = nil
|
|
34
35
|
positionY = nil
|
|
35
36
|
} else if
|
|
36
37
|
let positionContainer = try? container.nestedContainer(keyedBy: PositionCodingKeys.self, forKey: .position),
|
|
37
|
-
let positionX = try? positionContainer.decode(KeyframeGroup<
|
|
38
|
-
let positionY = try? positionContainer.decode(KeyframeGroup<
|
|
38
|
+
let positionX = try? positionContainer.decode(KeyframeGroup<LottieVector1D>.self, forKey: .positionX),
|
|
39
|
+
let positionY = try? positionContainer.decode(KeyframeGroup<LottieVector1D>.self, forKey: .positionY)
|
|
39
40
|
{
|
|
40
41
|
/// Position keyframes are split and nested.
|
|
41
42
|
self.positionX = positionX
|
|
@@ -43,49 +44,52 @@ final class Transform: Codable, DictionaryInitializable {
|
|
|
43
44
|
position = nil
|
|
44
45
|
} else {
|
|
45
46
|
/// Default value.
|
|
46
|
-
position = KeyframeGroup(
|
|
47
|
+
position = KeyframeGroup(LottieVector3D(x: Double(0), y: 0, z: 0))
|
|
47
48
|
positionX = nil
|
|
48
49
|
positionY = nil
|
|
49
50
|
}
|
|
50
51
|
|
|
51
52
|
// Scale
|
|
52
53
|
scale = try container
|
|
53
|
-
.decodeIfPresent(KeyframeGroup<
|
|
54
|
+
.decodeIfPresent(KeyframeGroup<LottieVector3D>.self, forKey: .scale) ??
|
|
55
|
+
KeyframeGroup(LottieVector3D(x: Double(100), y: 100, z: 100))
|
|
54
56
|
|
|
55
57
|
// Rotation
|
|
56
|
-
if let rotationZ = try container.decodeIfPresent(KeyframeGroup<
|
|
58
|
+
if let rotationZ = try container.decodeIfPresent(KeyframeGroup<LottieVector1D>.self, forKey: .rotationZ) {
|
|
57
59
|
rotation = rotationZ
|
|
58
60
|
} else {
|
|
59
|
-
rotation = try container
|
|
61
|
+
rotation = try container
|
|
62
|
+
.decodeIfPresent(KeyframeGroup<LottieVector1D>.self, forKey: .rotation) ?? KeyframeGroup(LottieVector1D(0))
|
|
60
63
|
}
|
|
61
64
|
rotationZ = nil
|
|
62
65
|
|
|
63
66
|
// Opacity
|
|
64
|
-
opacity = try container
|
|
67
|
+
opacity = try container
|
|
68
|
+
.decodeIfPresent(KeyframeGroup<LottieVector1D>.self, forKey: .opacity) ?? KeyframeGroup(LottieVector1D(100))
|
|
65
69
|
}
|
|
66
70
|
|
|
67
71
|
init(dictionary: [String: Any]) throws {
|
|
68
72
|
if
|
|
69
73
|
let anchorPointDictionary = dictionary[CodingKeys.anchorPoint.rawValue] as? [String: Any],
|
|
70
|
-
let anchorPoint = try? KeyframeGroup<
|
|
74
|
+
let anchorPoint = try? KeyframeGroup<LottieVector3D>(dictionary: anchorPointDictionary)
|
|
71
75
|
{
|
|
72
76
|
self.anchorPoint = anchorPoint
|
|
73
77
|
} else {
|
|
74
|
-
anchorPoint = KeyframeGroup(
|
|
78
|
+
anchorPoint = KeyframeGroup(LottieVector3D(x: Double(0), y: 0, z: 0))
|
|
75
79
|
}
|
|
76
80
|
|
|
77
81
|
if
|
|
78
82
|
let xDictionary = dictionary[CodingKeys.positionX.rawValue] as? [String: Any],
|
|
79
83
|
let yDictionary = dictionary[CodingKeys.positionY.rawValue] as? [String: Any]
|
|
80
84
|
{
|
|
81
|
-
positionX = try KeyframeGroup<
|
|
82
|
-
positionY = try KeyframeGroup<
|
|
85
|
+
positionX = try KeyframeGroup<LottieVector1D>(dictionary: xDictionary)
|
|
86
|
+
positionY = try KeyframeGroup<LottieVector1D>(dictionary: yDictionary)
|
|
83
87
|
position = nil
|
|
84
88
|
} else if
|
|
85
89
|
let positionDictionary = dictionary[CodingKeys.position.rawValue] as? [String: Any],
|
|
86
|
-
positionDictionary[KeyframeGroup<
|
|
90
|
+
positionDictionary[KeyframeGroup<LottieVector3D>.KeyframeWrapperKey.keyframeData.rawValue] != nil
|
|
87
91
|
{
|
|
88
|
-
position = try KeyframeGroup<
|
|
92
|
+
position = try KeyframeGroup<LottieVector3D>(dictionary: positionDictionary)
|
|
89
93
|
positionX = nil
|
|
90
94
|
positionY = nil
|
|
91
95
|
} else if
|
|
@@ -93,44 +97,44 @@ final class Transform: Codable, DictionaryInitializable {
|
|
|
93
97
|
let xDictionary = positionDictionary[PositionCodingKeys.positionX.rawValue] as? [String: Any],
|
|
94
98
|
let yDictionary = positionDictionary[PositionCodingKeys.positionY.rawValue] as? [String: Any]
|
|
95
99
|
{
|
|
96
|
-
positionX = try KeyframeGroup<
|
|
97
|
-
positionY = try KeyframeGroup<
|
|
100
|
+
positionX = try KeyframeGroup<LottieVector1D>(dictionary: xDictionary)
|
|
101
|
+
positionY = try KeyframeGroup<LottieVector1D>(dictionary: yDictionary)
|
|
98
102
|
position = nil
|
|
99
103
|
} else {
|
|
100
|
-
position = KeyframeGroup(
|
|
104
|
+
position = KeyframeGroup(LottieVector3D(x: Double(0), y: 0, z: 0))
|
|
101
105
|
positionX = nil
|
|
102
106
|
positionY = nil
|
|
103
107
|
}
|
|
104
108
|
|
|
105
109
|
if
|
|
106
110
|
let scaleDictionary = dictionary[CodingKeys.scale.rawValue] as? [String: Any],
|
|
107
|
-
let scale = try? KeyframeGroup<
|
|
111
|
+
let scale = try? KeyframeGroup<LottieVector3D>(dictionary: scaleDictionary)
|
|
108
112
|
{
|
|
109
113
|
self.scale = scale
|
|
110
114
|
} else {
|
|
111
|
-
scale = KeyframeGroup(
|
|
115
|
+
scale = KeyframeGroup(LottieVector3D(x: Double(100), y: 100, z: 100))
|
|
112
116
|
}
|
|
113
117
|
if
|
|
114
118
|
let rotationDictionary = dictionary[CodingKeys.rotationZ.rawValue] as? [String: Any],
|
|
115
|
-
let rotation = try? KeyframeGroup<
|
|
119
|
+
let rotation = try? KeyframeGroup<LottieVector1D>(dictionary: rotationDictionary)
|
|
116
120
|
{
|
|
117
121
|
self.rotation = rotation
|
|
118
122
|
} else if
|
|
119
123
|
let rotationDictionary = dictionary[CodingKeys.rotation.rawValue] as? [String: Any],
|
|
120
|
-
let rotation = try? KeyframeGroup<
|
|
124
|
+
let rotation = try? KeyframeGroup<LottieVector1D>(dictionary: rotationDictionary)
|
|
121
125
|
{
|
|
122
126
|
self.rotation = rotation
|
|
123
127
|
} else {
|
|
124
|
-
rotation = KeyframeGroup(
|
|
128
|
+
rotation = KeyframeGroup(LottieVector1D(0))
|
|
125
129
|
}
|
|
126
130
|
rotationZ = nil
|
|
127
131
|
if
|
|
128
132
|
let opacityDictionary = dictionary[CodingKeys.opacity.rawValue] as? [String: Any],
|
|
129
|
-
let opacity = try? KeyframeGroup<
|
|
133
|
+
let opacity = try? KeyframeGroup<LottieVector1D>(dictionary: opacityDictionary)
|
|
130
134
|
{
|
|
131
135
|
self.opacity = opacity
|
|
132
136
|
} else {
|
|
133
|
-
opacity = KeyframeGroup(
|
|
137
|
+
opacity = KeyframeGroup(LottieVector1D(100))
|
|
134
138
|
}
|
|
135
139
|
}
|
|
136
140
|
|
|
@@ -154,26 +158,26 @@ final class Transform: Codable, DictionaryInitializable {
|
|
|
154
158
|
}
|
|
155
159
|
|
|
156
160
|
/// The anchor point of the transform.
|
|
157
|
-
let anchorPoint: KeyframeGroup<
|
|
161
|
+
let anchorPoint: KeyframeGroup<LottieVector3D>
|
|
158
162
|
|
|
159
163
|
/// The position of the transform. This is nil if the position data was split.
|
|
160
|
-
let position: KeyframeGroup<
|
|
164
|
+
let position: KeyframeGroup<LottieVector3D>?
|
|
161
165
|
|
|
162
166
|
/// The positionX of the transform. This is nil if the position property is set.
|
|
163
|
-
let positionX: KeyframeGroup<
|
|
167
|
+
let positionX: KeyframeGroup<LottieVector1D>?
|
|
164
168
|
|
|
165
169
|
/// The positionY of the transform. This is nil if the position property is set.
|
|
166
|
-
let positionY: KeyframeGroup<
|
|
170
|
+
let positionY: KeyframeGroup<LottieVector1D>?
|
|
167
171
|
|
|
168
172
|
/// The scale of the transform
|
|
169
|
-
let scale: KeyframeGroup<
|
|
173
|
+
let scale: KeyframeGroup<LottieVector3D>
|
|
170
174
|
|
|
171
175
|
/// The rotation of the transform. Note: This is single dimensional rotation.
|
|
172
|
-
let rotation: KeyframeGroup<
|
|
176
|
+
let rotation: KeyframeGroup<LottieVector1D>
|
|
173
177
|
|
|
174
178
|
/// The opacity of the transform.
|
|
175
|
-
let opacity: KeyframeGroup<
|
|
179
|
+
let opacity: KeyframeGroup<LottieVector1D>
|
|
176
180
|
|
|
177
181
|
/// Should always be nil.
|
|
178
|
-
let rotationZ: KeyframeGroup<
|
|
182
|
+
let rotationZ: KeyframeGroup<LottieVector1D>?
|
|
179
183
|
}
|
|
@@ -24,8 +24,8 @@ final class Ellipse: ShapeItem {
|
|
|
24
24
|
required init(from decoder: Decoder) throws {
|
|
25
25
|
let container = try decoder.container(keyedBy: Ellipse.CodingKeys.self)
|
|
26
26
|
direction = try container.decodeIfPresent(PathDirection.self, forKey: .direction) ?? .clockwise
|
|
27
|
-
position = try container.decode(KeyframeGroup<
|
|
28
|
-
size = try container.decode(KeyframeGroup<
|
|
27
|
+
position = try container.decode(KeyframeGroup<LottieVector3D>.self, forKey: .position)
|
|
28
|
+
size = try container.decode(KeyframeGroup<LottieVector3D>.self, forKey: .size)
|
|
29
29
|
try super.init(from: decoder)
|
|
30
30
|
}
|
|
31
31
|
|
|
@@ -39,9 +39,9 @@ final class Ellipse: ShapeItem {
|
|
|
39
39
|
direction = .clockwise
|
|
40
40
|
}
|
|
41
41
|
let positionDictionary: [String: Any] = try dictionary.value(for: CodingKeys.position)
|
|
42
|
-
position = try KeyframeGroup<
|
|
42
|
+
position = try KeyframeGroup<LottieVector3D>(dictionary: positionDictionary)
|
|
43
43
|
let sizeDictionary: [String: Any] = try dictionary.value(for: CodingKeys.size)
|
|
44
|
-
size = try KeyframeGroup<
|
|
44
|
+
size = try KeyframeGroup<LottieVector3D>(dictionary: sizeDictionary)
|
|
45
45
|
try super.init(dictionary: dictionary)
|
|
46
46
|
}
|
|
47
47
|
|
|
@@ -51,10 +51,10 @@ final class Ellipse: ShapeItem {
|
|
|
51
51
|
let direction: PathDirection
|
|
52
52
|
|
|
53
53
|
/// The position of the ellipse
|
|
54
|
-
let position: KeyframeGroup<
|
|
54
|
+
let position: KeyframeGroup<LottieVector3D>
|
|
55
55
|
|
|
56
56
|
/// The size of the ellipse
|
|
57
|
-
let size: KeyframeGroup<
|
|
57
|
+
let size: KeyframeGroup<LottieVector3D>
|
|
58
58
|
|
|
59
59
|
override func encode(to encoder: Encoder) throws {
|
|
60
60
|
try super.encode(to: encoder)
|
|
@@ -23,17 +23,17 @@ final class Fill: ShapeItem {
|
|
|
23
23
|
|
|
24
24
|
required init(from decoder: Decoder) throws {
|
|
25
25
|
let container = try decoder.container(keyedBy: Fill.CodingKeys.self)
|
|
26
|
-
opacity = try container.decode(KeyframeGroup<
|
|
27
|
-
color = try container.decode(KeyframeGroup<
|
|
26
|
+
opacity = try container.decode(KeyframeGroup<LottieVector1D>.self, forKey: .opacity)
|
|
27
|
+
color = try container.decode(KeyframeGroup<LottieColor>.self, forKey: .color)
|
|
28
28
|
fillRule = try container.decodeIfPresent(FillRule.self, forKey: .fillRule) ?? .nonZeroWinding
|
|
29
29
|
try super.init(from: decoder)
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
required init(dictionary: [String: Any]) throws {
|
|
33
33
|
let opacityDictionary: [String: Any] = try dictionary.value(for: CodingKeys.opacity)
|
|
34
|
-
opacity = try KeyframeGroup<
|
|
34
|
+
opacity = try KeyframeGroup<LottieVector1D>(dictionary: opacityDictionary)
|
|
35
35
|
let colorDictionary: [String: Any] = try dictionary.value(for: CodingKeys.color)
|
|
36
|
-
color = try KeyframeGroup<
|
|
36
|
+
color = try KeyframeGroup<LottieColor>(dictionary: colorDictionary)
|
|
37
37
|
if
|
|
38
38
|
let fillRuleRawValue = dictionary[CodingKeys.fillRule.rawValue] as? Int,
|
|
39
39
|
let fillRule = FillRule(rawValue: fillRuleRawValue)
|
|
@@ -48,10 +48,10 @@ final class Fill: ShapeItem {
|
|
|
48
48
|
// MARK: Internal
|
|
49
49
|
|
|
50
50
|
/// The opacity of the fill
|
|
51
|
-
let opacity: KeyframeGroup<
|
|
51
|
+
let opacity: KeyframeGroup<LottieVector1D>
|
|
52
52
|
|
|
53
53
|
/// The color keyframes for the fill
|
|
54
|
-
let color: KeyframeGroup<
|
|
54
|
+
let color: KeyframeGroup<LottieColor>
|
|
55
55
|
|
|
56
56
|
/// The fill rule to use when filling a path
|
|
57
57
|
let fillRule: FillRule
|
|
@@ -23,12 +23,12 @@ final class GradientFill: ShapeItem {
|
|
|
23
23
|
|
|
24
24
|
required init(from decoder: Decoder) throws {
|
|
25
25
|
let container = try decoder.container(keyedBy: GradientFill.CodingKeys.self)
|
|
26
|
-
opacity = try container.decode(KeyframeGroup<
|
|
27
|
-
startPoint = try container.decode(KeyframeGroup<
|
|
28
|
-
endPoint = try container.decode(KeyframeGroup<
|
|
26
|
+
opacity = try container.decode(KeyframeGroup<LottieVector1D>.self, forKey: .opacity)
|
|
27
|
+
startPoint = try container.decode(KeyframeGroup<LottieVector3D>.self, forKey: .startPoint)
|
|
28
|
+
endPoint = try container.decode(KeyframeGroup<LottieVector3D>.self, forKey: .endPoint)
|
|
29
29
|
gradientType = try container.decode(GradientType.self, forKey: .gradientType)
|
|
30
|
-
highlightLength = try container.decodeIfPresent(KeyframeGroup<
|
|
31
|
-
highlightAngle = try container.decodeIfPresent(KeyframeGroup<
|
|
30
|
+
highlightLength = try container.decodeIfPresent(KeyframeGroup<LottieVector1D>.self, forKey: .highlightLength)
|
|
31
|
+
highlightAngle = try container.decodeIfPresent(KeyframeGroup<LottieVector1D>.self, forKey: .highlightAngle)
|
|
32
32
|
fillRule = try container.decodeIfPresent(FillRule.self, forKey: .fillRule) ?? .nonZeroWinding
|
|
33
33
|
let colorsContainer = try container.nestedContainer(keyedBy: GradientDataKeys.self, forKey: .colors)
|
|
34
34
|
colors = try colorsContainer.decode(KeyframeGroup<[Double]>.self, forKey: .colors)
|
|
@@ -38,23 +38,23 @@ final class GradientFill: ShapeItem {
|
|
|
38
38
|
|
|
39
39
|
required init(dictionary: [String: Any]) throws {
|
|
40
40
|
let opacityDictionary: [String: Any] = try dictionary.value(for: CodingKeys.opacity)
|
|
41
|
-
opacity = try KeyframeGroup<
|
|
41
|
+
opacity = try KeyframeGroup<LottieVector1D>(dictionary: opacityDictionary)
|
|
42
42
|
let startPointDictionary: [String: Any] = try dictionary.value(for: CodingKeys.startPoint)
|
|
43
|
-
startPoint = try KeyframeGroup<
|
|
43
|
+
startPoint = try KeyframeGroup<LottieVector3D>(dictionary: startPointDictionary)
|
|
44
44
|
let endPointDictionary: [String: Any] = try dictionary.value(for: CodingKeys.endPoint)
|
|
45
|
-
endPoint = try KeyframeGroup<
|
|
45
|
+
endPoint = try KeyframeGroup<LottieVector3D>(dictionary: endPointDictionary)
|
|
46
46
|
let gradientRawType: Int = try dictionary.value(for: CodingKeys.gradientType)
|
|
47
47
|
guard let gradient = GradientType(rawValue: gradientRawType) else {
|
|
48
48
|
throw InitializableError.invalidInput
|
|
49
49
|
}
|
|
50
50
|
gradientType = gradient
|
|
51
51
|
if let highlightLengthDictionary = dictionary[CodingKeys.highlightLength.rawValue] as? [String: Any] {
|
|
52
|
-
highlightLength = try? KeyframeGroup<
|
|
52
|
+
highlightLength = try? KeyframeGroup<LottieVector1D>(dictionary: highlightLengthDictionary)
|
|
53
53
|
} else {
|
|
54
54
|
highlightLength = nil
|
|
55
55
|
}
|
|
56
56
|
if let highlightAngleDictionary = dictionary[CodingKeys.highlightAngle.rawValue] as? [String: Any] {
|
|
57
|
-
highlightAngle = try? KeyframeGroup<
|
|
57
|
+
highlightAngle = try? KeyframeGroup<LottieVector1D>(dictionary: highlightAngleDictionary)
|
|
58
58
|
} else {
|
|
59
59
|
highlightAngle = nil
|
|
60
60
|
}
|
|
@@ -76,22 +76,22 @@ final class GradientFill: ShapeItem {
|
|
|
76
76
|
// MARK: Internal
|
|
77
77
|
|
|
78
78
|
/// The opacity of the fill
|
|
79
|
-
let opacity: KeyframeGroup<
|
|
79
|
+
let opacity: KeyframeGroup<LottieVector1D>
|
|
80
80
|
|
|
81
81
|
/// The start of the gradient
|
|
82
|
-
let startPoint: KeyframeGroup<
|
|
82
|
+
let startPoint: KeyframeGroup<LottieVector3D>
|
|
83
83
|
|
|
84
84
|
/// The end of the gradient
|
|
85
|
-
let endPoint: KeyframeGroup<
|
|
85
|
+
let endPoint: KeyframeGroup<LottieVector3D>
|
|
86
86
|
|
|
87
87
|
/// The type of gradient
|
|
88
88
|
let gradientType: GradientType
|
|
89
89
|
|
|
90
90
|
/// Gradient Highlight Length. Only if type is Radial
|
|
91
|
-
let highlightLength: KeyframeGroup<
|
|
91
|
+
let highlightLength: KeyframeGroup<LottieVector1D>?
|
|
92
92
|
|
|
93
93
|
/// Highlight Angle. Only if type is Radial
|
|
94
|
-
let highlightAngle: KeyframeGroup<
|
|
94
|
+
let highlightAngle: KeyframeGroup<LottieVector1D>?
|
|
95
95
|
|
|
96
96
|
/// The number of color points in the gradient
|
|
97
97
|
let numberOfColors: Int
|