diff --git a/Sources/Private/CoreAnimation/Layers/BaseCompositionLayer.swift b/Sources/Private/CoreAnimation/Layers/BaseCompositionLayer.swift index 67b6bab151..7359c8e58e 100644 --- a/Sources/Private/CoreAnimation/Layers/BaseCompositionLayer.swift +++ b/Sources/Private/CoreAnimation/Layers/BaseCompositionLayer.swift @@ -78,7 +78,8 @@ class BaseCompositionLayer: BaseAnimationLayer { private func setupSublayers() { if renderLayerContents, - let masks = baseLayerModel.masks + let masks = baseLayerModel.masks?.filter({ $0.mode != .none }), + !masks.isEmpty { mask = MaskCompositionLayer(masks: masks) } diff --git a/Sources/Private/MainThread/LayerContainers/CompLayers/CompositionLayer.swift b/Sources/Private/MainThread/LayerContainers/CompLayers/CompositionLayer.swift index 38c27093b4..455d236688 100644 --- a/Sources/Private/MainThread/LayerContainers/CompLayers/CompositionLayer.swift +++ b/Sources/Private/MainThread/LayerContainers/CompLayers/CompositionLayer.swift @@ -17,7 +17,7 @@ class CompositionLayer: CALayer, KeypathSearchable { init(layer: LayerModel, size: CGSize) { transformNode = LayerTransformNode(transform: layer.transform) - if let masks = layer.masks { + if let masks = layer.masks?.filter({ $0.mode != .none }), !masks.isEmpty { maskLayer = MaskContainerLayer(masks: masks) } else { maskLayer = nil diff --git a/Tests/Samples/Issues/issue_1603.json b/Tests/Samples/Issues/issue_1603.json new file mode 100644 index 0000000000..320df9e035 --- /dev/null +++ b/Tests/Samples/Issues/issue_1603.json @@ -0,0 +1 @@ +{"v":"4.8.0","meta":{"g":"LottieFiles AE ","a":"","k":"","d":"","tc":""},"fr":30,"ip":0,"op":33,"w":320,"h":568,"nm":"Second-Loss-Pulse","ddd":0,"assets":[{"id":"comp_0","layers":[{"ddd":0,"ind":3,"ty":4,"nm":"Shape Layer 4","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":45,"ix":10},"p":{"a":0,"k":[160.13,283.14,0],"ix":2},"a":{"a":0,"k":[0,0,0],"ix":1},"s":{"a":0,"k":[79,79,100],"ix":6}},"ao":0,"hasMask":true,"masksProperties":[{"inv":false,"mode":"n","pt":{"a":0,"k":{"i":[[0,0],[0,0],[0,0],[0,0]],"o":[[0,0],[0,0],[0,0],[0,0]],"v":[[-184.706,-189.133],[-184.706,2.903],[191.886,2.903],[191.886,-189.133]],"c":true},"ix":1},"o":{"a":0,"k":100,"ix":3},"x":{"a":0,"k":0,"ix":4},"nm":"Mask 1"}],"shapes":[{"ty":"gr","it":[{"ty":"rc","d":1,"s":{"a":1,"k":[{"i":{"x":[0,0],"y":[1,1]},"o":{"x":[0.167,0.167],"y":[0.167,0.167]},"t":0,"s":[100,209.333]},{"t":30,"s":[213,324.613]}],"ix":2},"p":{"a":0,"k":[0,0],"ix":3},"r":{"a":1,"k":[{"i":{"x":[0],"y":[1]},"o":{"x":[0.167],"y":[0.167]},"t":0,"s":[20]},{"t":30,"s":[58]}],"ix":4},"nm":"Rectangle Path 1","mn":"ADBE Vector Shape - Rect","hd":false},{"ty":"st","c":{"a":0,"k":[0,0,0,1],"ix":3},"o":{"a":1,"k":[{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"t":0,"s":[0]},{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"t":15.254,"s":[50]},{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"t":19.83,"s":[34.483]},{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"t":22.373,"s":[25.862]},{"t":30,"s":[0]}],"ix":4},"w":{"a":1,"k":[{"i":{"x":[0],"y":[1]},"o":{"x":[0.167],"y":[0.167]},"t":0,"s":[0]},{"t":15,"s":[80]}],"ix":5},"lc":2,"lj":2,"bm":0,"nm":"Stroke 1","mn":"ADBE Vector Graphic - Stroke","hd":false},{"ty":"tr","p":{"a":0,"k":[0.886,-1.133],"ix":2},"a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[100,100],"ix":3},"r":{"a":0,"k":0,"ix":6},"o":{"a":0,"k":100,"ix":7},"sk":{"a":0,"k":0,"ix":4},"sa":{"a":0,"k":0,"ix":5},"nm":"Transform"}],"nm":"Rectangle 1","np":3,"cix":2,"bm":0,"ix":1,"mn":"ADBE Vector Group","hd":false}],"ip":0,"op":60,"st":0,"bm":0}]}],"layers":[{"ddd":0,"ind":1,"ty":0,"nm":"SecondPulse Mismatch","refId":"comp_0","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[158.5,236.50000000000003,0],"ix":2},"a":{"a":0,"k":[160,284,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"w":320,"h":568,"ip":0,"op":60,"st":0,"bm":0}],"markers":[]} diff --git a/Tests/__Snapshots__/AutomaticEngineTests/testAutomaticEngineDetection.Issues-issue_1603.txt b/Tests/__Snapshots__/AutomaticEngineTests/testAutomaticEngineDetection.Issues-issue_1603.txt new file mode 100644 index 0000000000..4b816d7353 --- /dev/null +++ b/Tests/__Snapshots__/AutomaticEngineTests/testAutomaticEngineDetection.Issues-issue_1603.txt @@ -0,0 +1 @@ +Supports Core Animation engine \ No newline at end of file diff --git a/Tests/__Snapshots__/SnapshotTests/testCoreAnimationRenderingEngine.Issues-issue_1603-0.png b/Tests/__Snapshots__/SnapshotTests/testCoreAnimationRenderingEngine.Issues-issue_1603-0.png new file mode 100644 index 0000000000..c5b14a4437 Binary files /dev/null and b/Tests/__Snapshots__/SnapshotTests/testCoreAnimationRenderingEngine.Issues-issue_1603-0.png differ diff --git a/Tests/__Snapshots__/SnapshotTests/testCoreAnimationRenderingEngine.Issues-issue_1603-100.png b/Tests/__Snapshots__/SnapshotTests/testCoreAnimationRenderingEngine.Issues-issue_1603-100.png new file mode 100644 index 0000000000..c5b14a4437 Binary files /dev/null and b/Tests/__Snapshots__/SnapshotTests/testCoreAnimationRenderingEngine.Issues-issue_1603-100.png differ diff --git a/Tests/__Snapshots__/SnapshotTests/testCoreAnimationRenderingEngine.Issues-issue_1603-25.png b/Tests/__Snapshots__/SnapshotTests/testCoreAnimationRenderingEngine.Issues-issue_1603-25.png new file mode 100644 index 0000000000..37b06240a3 Binary files /dev/null and b/Tests/__Snapshots__/SnapshotTests/testCoreAnimationRenderingEngine.Issues-issue_1603-25.png differ diff --git a/Tests/__Snapshots__/SnapshotTests/testCoreAnimationRenderingEngine.Issues-issue_1603-50.png b/Tests/__Snapshots__/SnapshotTests/testCoreAnimationRenderingEngine.Issues-issue_1603-50.png new file mode 100644 index 0000000000..34eb57bbe2 Binary files /dev/null and b/Tests/__Snapshots__/SnapshotTests/testCoreAnimationRenderingEngine.Issues-issue_1603-50.png differ diff --git a/Tests/__Snapshots__/SnapshotTests/testCoreAnimationRenderingEngine.Issues-issue_1603-75.png b/Tests/__Snapshots__/SnapshotTests/testCoreAnimationRenderingEngine.Issues-issue_1603-75.png new file mode 100644 index 0000000000..437c85f31a Binary files /dev/null and b/Tests/__Snapshots__/SnapshotTests/testCoreAnimationRenderingEngine.Issues-issue_1603-75.png differ diff --git a/Tests/__Snapshots__/SnapshotTests/testMainThreadRenderingEngine.Issues-issue_1603-0.png b/Tests/__Snapshots__/SnapshotTests/testMainThreadRenderingEngine.Issues-issue_1603-0.png new file mode 100644 index 0000000000..c5b14a4437 Binary files /dev/null and b/Tests/__Snapshots__/SnapshotTests/testMainThreadRenderingEngine.Issues-issue_1603-0.png differ diff --git a/Tests/__Snapshots__/SnapshotTests/testMainThreadRenderingEngine.Issues-issue_1603-100.png b/Tests/__Snapshots__/SnapshotTests/testMainThreadRenderingEngine.Issues-issue_1603-100.png new file mode 100644 index 0000000000..c5b14a4437 Binary files /dev/null and b/Tests/__Snapshots__/SnapshotTests/testMainThreadRenderingEngine.Issues-issue_1603-100.png differ diff --git a/Tests/__Snapshots__/SnapshotTests/testMainThreadRenderingEngine.Issues-issue_1603-25.png b/Tests/__Snapshots__/SnapshotTests/testMainThreadRenderingEngine.Issues-issue_1603-25.png new file mode 100644 index 0000000000..05e68f0e95 Binary files /dev/null and b/Tests/__Snapshots__/SnapshotTests/testMainThreadRenderingEngine.Issues-issue_1603-25.png differ diff --git a/Tests/__Snapshots__/SnapshotTests/testMainThreadRenderingEngine.Issues-issue_1603-50.png b/Tests/__Snapshots__/SnapshotTests/testMainThreadRenderingEngine.Issues-issue_1603-50.png new file mode 100644 index 0000000000..27dd2fd718 Binary files /dev/null and b/Tests/__Snapshots__/SnapshotTests/testMainThreadRenderingEngine.Issues-issue_1603-50.png differ diff --git a/Tests/__Snapshots__/SnapshotTests/testMainThreadRenderingEngine.Issues-issue_1603-75.png b/Tests/__Snapshots__/SnapshotTests/testMainThreadRenderingEngine.Issues-issue_1603-75.png new file mode 100644 index 0000000000..437c85f31a Binary files /dev/null and b/Tests/__Snapshots__/SnapshotTests/testMainThreadRenderingEngine.Issues-issue_1603-75.png differ