diff --git a/Sources/Private/Utility/Extensions/MathKit.swift b/Sources/Private/Utility/Extensions/MathKit.swift index f7ca635efc..e512cfa9aa 100644 --- a/Sources/Private/Utility/Extensions/MathKit.swift +++ b/Sources/Private/Utility/Extensions/MathKit.swift @@ -369,7 +369,7 @@ extension CGPoint { while foundPoint == false { refineIterations = refineIterations + 1 /// First see if the next point is still less than the projected length. - let nextPoint = points[closestPoint + 1] + let nextPoint = points[min(closestPoint + 1, points.indices.last!)] if nextPoint.distance < accurateDistance { point = nextPoint closestPoint = closestPoint + 1 diff --git a/Tests/Samples/Issues/pr_2305.json b/Tests/Samples/Issues/pr_2305.json new file mode 100644 index 0000000000..2d3247fe93 --- /dev/null +++ b/Tests/Samples/Issues/pr_2305.json @@ -0,0 +1 @@ +{"v":"5.7.5","fr":100,"ip":0,"op":400,"w":800,"h":1000,"nm":"Comp 1","ddd":0,"assets":[],"layers":[{"ddd":0,"ind":0,"ty":4,"nm":"Bounce out curve","sr":1,"ks":{"o":{"a":0,"k":100,"ix":2},"r":{"a":0,"k":0,"ix":2},"p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":2},"s":{"a":0,"k":[100,100],"ix":2}},"ao":0,"hd":false,"shapes":[{"ty":"gr","hd":false,"it":[{"ty":"rc","hd":false,"d":1,"s":{"a":0,"k":[100,100],"ix":2},"p":{"a":0,"k":[0,0],"ix":2},"r":{"a":0,"k":0,"ix":2}},{"ty":"fl","c":{"a":0,"k":[0.21176470588235294,0.9176470588235294,1],"ix":2},"o":{"a":0,"k":100,"ix":2},"r":1,"bm":0,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tm","s":{"a":0,"k":0,"ix":2},"e":{"a":0,"k":100,"ix":2},"o":{"a":0,"k":0,"ix":2},"m":1,"hd":false},{"ty":"tr","hd":false,"p":{"a":1,"k":[{"t":0,"s":[510,100],"i":{"x":[0.2],"y":[1]},"o":{"x":[0.5],"y":[-0.5]},"ti":[-268.19047619047615,-294.42857142857247],"to":[-268.19047619047615,238.90476190476068]},{"t":400,"s":[510,900],"i":{"x":[1],"y":[1]},"o":{"x":[0],"y":[0]}}],"ix":2},"a":{"a":0,"k":[0,0],"ix":2},"s":{"a":0,"k":[100,100],"ix":2},"r":{"a":0,"k":0,"ix":2},"o":{"a":0,"k":100,"ix":2},"sk":{"a":0,"k":0,"ix":2},"sa":{"a":0,"k":0,"ix":2}}]}],"ip":0,"op":401,"st":0,"bm":0},{"ddd":0,"ind":1,"ty":4,"nm":"Bounce in curve","sr":1,"ks":{"o":{"a":0,"k":100,"ix":2},"r":{"a":0,"k":0,"ix":2},"p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":2},"s":{"a":0,"k":[100,100],"ix":2}},"ao":0,"hd":false,"shapes":[{"ty":"gr","hd":false,"it":[{"ty":"rc","hd":false,"d":1,"s":{"a":0,"k":[100,100],"ix":2},"p":{"a":0,"k":[0,0],"ix":2},"r":{"a":0,"k":0,"ix":2}},{"ty":"fl","c":{"a":0,"k":[1,0.3411764705882353,0.21176470588235294],"ix":2},"o":{"a":0,"k":100,"ix":2},"r":1,"bm":0,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tm","s":{"a":0,"k":0,"ix":2},"e":{"a":0,"k":100,"ix":2},"o":{"a":0,"k":0,"ix":2},"m":1,"hd":false},{"ty":"tr","hd":false,"p":{"a":1,"k":[{"t":0,"s":[360,100],"i":{"x":[0.5],"y":[1.5]},"o":{"x":[0.8],"y":[0]},"ti":[-268.19047619047615,-294.42857142857247],"to":[-268.19047619047615,238.90476190476068]},{"t":400,"s":[360,900],"i":{"x":[1],"y":[1]},"o":{"x":[0],"y":[0]}}],"ix":2},"a":{"a":0,"k":[0,0],"ix":2},"s":{"a":0,"k":[100,100],"ix":2},"r":{"a":0,"k":0,"ix":2},"o":{"a":0,"k":100,"ix":2},"sk":{"a":0,"k":0,"ix":2},"sa":{"a":0,"k":0,"ix":2}}]}],"ip":0,"op":401,"st":0,"bm":0},{"ddd":0,"ind":2,"ty":4,"nm":"Bounce in","sr":1,"ks":{"o":{"a":0,"k":100,"ix":2},"r":{"a":0,"k":0,"ix":2},"p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":2},"s":{"a":0,"k":[100,100],"ix":2}},"ao":0,"hd":false,"shapes":[{"ty":"gr","hd":false,"it":[{"ty":"rc","hd":false,"d":1,"s":{"a":0,"k":[100,100],"ix":2},"p":{"a":0,"k":[0,0],"ix":2},"r":{"a":0,"k":0,"ix":2}},{"ty":"fl","c":{"a":0,"k":[1,0.7254901960784313,0.5764705882352941],"ix":2},"o":{"a":0,"k":100,"ix":2},"r":1,"bm":0,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tm","s":{"a":0,"k":0,"ix":2},"e":{"a":0,"k":100,"ix":2},"o":{"a":0,"k":0,"ix":2},"m":1,"hd":false},{"ty":"tr","hd":false,"p":{"a":1,"k":[{"t":0,"s":[650,100],"i":{"x":[0.5],"y":[1.5]},"o":{"x":[0.8],"y":[0]}},{"t":400,"s":[650,900],"i":{"x":[1],"y":[1]},"o":{"x":[0],"y":[0]}}],"ix":2},"a":{"a":0,"k":[0,0],"ix":2},"s":{"a":0,"k":[100,100],"ix":2},"r":{"a":0,"k":0,"ix":2},"o":{"a":0,"k":100,"ix":2},"sk":{"a":0,"k":0,"ix":2},"sa":{"a":0,"k":0,"ix":2}}]}],"ip":0,"op":401,"st":0,"bm":0},{"ddd":0,"ind":3,"ty":4,"nm":"Bounce out","sr":1,"ks":{"o":{"a":0,"k":100,"ix":2},"r":{"a":0,"k":0,"ix":2},"p":{"a":0,"k":[0,0],"ix":2},"a":{"a":0,"k":[0,0],"ix":2},"s":{"a":0,"k":[100,100],"ix":2}},"ao":0,"hd":false,"shapes":[{"ty":"gr","hd":false,"it":[{"ty":"rc","hd":false,"d":1,"s":{"a":0,"k":[100,100],"ix":2},"p":{"a":0,"k":[0,0],"ix":2},"r":{"a":0,"k":0,"ix":2}},{"ty":"fl","c":{"a":0,"k":[1,0.8392156862745098,0.25098039215686274],"ix":2},"o":{"a":0,"k":100,"ix":2},"r":1,"bm":0,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"tm","s":{"a":0,"k":0,"ix":2},"e":{"a":0,"k":100,"ix":2},"o":{"a":0,"k":0,"ix":2},"m":1,"hd":false},{"ty":"tr","hd":false,"p":{"a":1,"k":[{"t":0,"s":[150,100],"i":{"x":[0.2],"y":[1]},"o":{"x":[0.5],"y":[-0.5]}},{"t":400,"s":[150,900],"i":{"x":[1],"y":[1]},"o":{"x":[0],"y":[0]}}],"ix":2},"a":{"a":0,"k":[0,0],"ix":2},"s":{"a":0,"k":[100,100],"ix":2},"r":{"a":0,"k":0,"ix":2},"o":{"a":0,"k":100,"ix":2},"sk":{"a":0,"k":0,"ix":2},"sa":{"a":0,"k":0,"ix":2}}]}],"ip":0,"op":401,"st":0,"bm":0}],"markers":[]} \ No newline at end of file diff --git a/Tests/__Snapshots__/AutomaticEngineTests/testAutomaticEngineDetection.Issues-pr_2305.txt b/Tests/__Snapshots__/AutomaticEngineTests/testAutomaticEngineDetection.Issues-pr_2305.txt new file mode 100644 index 0000000000..4b816d7353 --- /dev/null +++ b/Tests/__Snapshots__/AutomaticEngineTests/testAutomaticEngineDetection.Issues-pr_2305.txt @@ -0,0 +1 @@ +Supports Core Animation engine \ No newline at end of file diff --git a/Tests/__Snapshots__/SnapshotTests/testCoreAnimationRenderingEngine.Issues-pr_2305-0.png b/Tests/__Snapshots__/SnapshotTests/testCoreAnimationRenderingEngine.Issues-pr_2305-0.png new file mode 100644 index 0000000000..9d99fdbc40 Binary files /dev/null and b/Tests/__Snapshots__/SnapshotTests/testCoreAnimationRenderingEngine.Issues-pr_2305-0.png differ diff --git a/Tests/__Snapshots__/SnapshotTests/testCoreAnimationRenderingEngine.Issues-pr_2305-100.png b/Tests/__Snapshots__/SnapshotTests/testCoreAnimationRenderingEngine.Issues-pr_2305-100.png new file mode 100644 index 0000000000..b68abdaa3d Binary files /dev/null and b/Tests/__Snapshots__/SnapshotTests/testCoreAnimationRenderingEngine.Issues-pr_2305-100.png differ diff --git a/Tests/__Snapshots__/SnapshotTests/testCoreAnimationRenderingEngine.Issues-pr_2305-25.png b/Tests/__Snapshots__/SnapshotTests/testCoreAnimationRenderingEngine.Issues-pr_2305-25.png new file mode 100644 index 0000000000..9c121c21bf Binary files /dev/null and b/Tests/__Snapshots__/SnapshotTests/testCoreAnimationRenderingEngine.Issues-pr_2305-25.png differ diff --git a/Tests/__Snapshots__/SnapshotTests/testCoreAnimationRenderingEngine.Issues-pr_2305-50.png b/Tests/__Snapshots__/SnapshotTests/testCoreAnimationRenderingEngine.Issues-pr_2305-50.png new file mode 100644 index 0000000000..37477e6524 Binary files /dev/null and b/Tests/__Snapshots__/SnapshotTests/testCoreAnimationRenderingEngine.Issues-pr_2305-50.png differ diff --git a/Tests/__Snapshots__/SnapshotTests/testCoreAnimationRenderingEngine.Issues-pr_2305-75.png b/Tests/__Snapshots__/SnapshotTests/testCoreAnimationRenderingEngine.Issues-pr_2305-75.png new file mode 100644 index 0000000000..5e63e61540 Binary files /dev/null and b/Tests/__Snapshots__/SnapshotTests/testCoreAnimationRenderingEngine.Issues-pr_2305-75.png differ diff --git a/Tests/__Snapshots__/SnapshotTests/testMainThreadRenderingEngine.Issues-pr_2305-0.png b/Tests/__Snapshots__/SnapshotTests/testMainThreadRenderingEngine.Issues-pr_2305-0.png new file mode 100644 index 0000000000..9d99fdbc40 Binary files /dev/null and b/Tests/__Snapshots__/SnapshotTests/testMainThreadRenderingEngine.Issues-pr_2305-0.png differ diff --git a/Tests/__Snapshots__/SnapshotTests/testMainThreadRenderingEngine.Issues-pr_2305-100.png b/Tests/__Snapshots__/SnapshotTests/testMainThreadRenderingEngine.Issues-pr_2305-100.png new file mode 100644 index 0000000000..b68abdaa3d Binary files /dev/null and b/Tests/__Snapshots__/SnapshotTests/testMainThreadRenderingEngine.Issues-pr_2305-100.png differ diff --git a/Tests/__Snapshots__/SnapshotTests/testMainThreadRenderingEngine.Issues-pr_2305-25.png b/Tests/__Snapshots__/SnapshotTests/testMainThreadRenderingEngine.Issues-pr_2305-25.png new file mode 100644 index 0000000000..15df762437 Binary files /dev/null and b/Tests/__Snapshots__/SnapshotTests/testMainThreadRenderingEngine.Issues-pr_2305-25.png differ diff --git a/Tests/__Snapshots__/SnapshotTests/testMainThreadRenderingEngine.Issues-pr_2305-50.png b/Tests/__Snapshots__/SnapshotTests/testMainThreadRenderingEngine.Issues-pr_2305-50.png new file mode 100644 index 0000000000..b86fea79d1 Binary files /dev/null and b/Tests/__Snapshots__/SnapshotTests/testMainThreadRenderingEngine.Issues-pr_2305-50.png differ diff --git a/Tests/__Snapshots__/SnapshotTests/testMainThreadRenderingEngine.Issues-pr_2305-75.png b/Tests/__Snapshots__/SnapshotTests/testMainThreadRenderingEngine.Issues-pr_2305-75.png new file mode 100644 index 0000000000..47e25ce1a0 Binary files /dev/null and b/Tests/__Snapshots__/SnapshotTests/testMainThreadRenderingEngine.Issues-pr_2305-75.png differ