diff --git a/Example/Example/AnimationPreviewView.swift b/Example/Example/AnimationPreviewView.swift index db5afc984a..8fc7f9bc63 100644 --- a/Example/Example/AnimationPreviewView.swift +++ b/Example/Example/AnimationPreviewView.swift @@ -60,6 +60,11 @@ struct AnimationPreviewView: View { animationPlaying = false } } + .configure { animationView in + DispatchQueue.main.async { + currentRenderingEngine = animationView.currentRenderingEngine + } + } .getRealtimeAnimationProgress(animationPlaying ? $sliderValue : nil) Spacer() @@ -94,6 +99,7 @@ struct AnimationPreviewView: View { updateIndex() } .toolbar { + Text((currentRenderingEngine ?? .coreAnimation).description) optionsMenu } } @@ -111,6 +117,7 @@ struct AnimationPreviewView: View { @State private var loopMode: LottieLoopMode = .loop @State private var playFromProgress: AnimationProgressTime = 0 @State private var playToProgress: AnimationProgressTime = 1 + @State private var currentRenderingEngine: RenderingEngine? private var playbackMode: LottiePlaybackMode { if animationPlaying { diff --git a/Sources/Public/Animation/LottieAnimationLayer.swift b/Sources/Public/Animation/LottieAnimationLayer.swift index 1e8a7579af..1c283724d7 100644 --- a/Sources/Public/Animation/LottieAnimationLayer.swift +++ b/Sources/Public/Animation/LottieAnimationLayer.swift @@ -1097,6 +1097,10 @@ public class LottieAnimationLayer: CALayer { animationLayer.lottieAnimationLayer = self + for (keypath, valueProvider) in valueProviders { + animationLayer.setValueProvider(valueProvider, keypath: keypath) + } + animationLayerDidLoad?(self, renderingEngine) animationLayer.renderScale = screenScale diff --git a/Tests/SnapshotConfiguration.swift b/Tests/SnapshotConfiguration.swift index 0b94cfb33f..9e107f279c 100644 --- a/Tests/SnapshotConfiguration.swift +++ b/Tests/SnapshotConfiguration.swift @@ -111,7 +111,15 @@ extension SnapshotConfiguration { // Test cases for `RenderingEngineOption.automatic` "9squares_AlBoardman": .useAutomaticRenderingEngine, // Supports the Core Animation engine "LottieFiles/shop": .useAutomaticRenderingEngine, // Throws a compatibility error in `init` - "TypeFace/G": .useAutomaticRenderingEngine, // Throws a compatibility error in `display()` + "TypeFace/G": { // Throws a compatibility error in `display()` + var configuration = SnapshotConfiguration.useAutomaticRenderingEngine + configuration.customValueProviders = [ + "G 2.Ellipse 1.Stroke 1.Color": ColorValueProvider(.red), + "G Outlines 3.G.Fill 1.Color": ColorValueProvider(.red), + "Shape Layer 18.Shape 1.Stroke 2.Color": ColorValueProvider(.red), + ] + return configuration + }(), ] } diff --git a/Tests/__Snapshots__/SnapshotTests/testAutomaticRenderingEngine.TypeFace-G-100.png b/Tests/__Snapshots__/SnapshotTests/testAutomaticRenderingEngine.TypeFace-G-100.png index 2b5d56e50d..0595e79072 100644 Binary files a/Tests/__Snapshots__/SnapshotTests/testAutomaticRenderingEngine.TypeFace-G-100.png and b/Tests/__Snapshots__/SnapshotTests/testAutomaticRenderingEngine.TypeFace-G-100.png differ diff --git a/Tests/__Snapshots__/SnapshotTests/testAutomaticRenderingEngine.TypeFace-G-75.png b/Tests/__Snapshots__/SnapshotTests/testAutomaticRenderingEngine.TypeFace-G-75.png index 32245c6e51..99ec08f8e7 100644 Binary files a/Tests/__Snapshots__/SnapshotTests/testAutomaticRenderingEngine.TypeFace-G-75.png and b/Tests/__Snapshots__/SnapshotTests/testAutomaticRenderingEngine.TypeFace-G-75.png differ diff --git a/Tests/__Snapshots__/SnapshotTests/testCoreAnimationRenderingEngine.TypeFace-G-100.png b/Tests/__Snapshots__/SnapshotTests/testCoreAnimationRenderingEngine.TypeFace-G-100.png index 2b5d56e50d..0595e79072 100644 Binary files a/Tests/__Snapshots__/SnapshotTests/testCoreAnimationRenderingEngine.TypeFace-G-100.png and b/Tests/__Snapshots__/SnapshotTests/testCoreAnimationRenderingEngine.TypeFace-G-100.png differ diff --git a/Tests/__Snapshots__/SnapshotTests/testCoreAnimationRenderingEngine.TypeFace-G-75.png b/Tests/__Snapshots__/SnapshotTests/testCoreAnimationRenderingEngine.TypeFace-G-75.png index 33f15ec8f4..0fab73af99 100644 Binary files a/Tests/__Snapshots__/SnapshotTests/testCoreAnimationRenderingEngine.TypeFace-G-75.png and b/Tests/__Snapshots__/SnapshotTests/testCoreAnimationRenderingEngine.TypeFace-G-75.png differ diff --git a/Tests/__Snapshots__/SnapshotTests/testMainThreadRenderingEngine.TypeFace-G-100.png b/Tests/__Snapshots__/SnapshotTests/testMainThreadRenderingEngine.TypeFace-G-100.png index 2b5d56e50d..0595e79072 100644 Binary files a/Tests/__Snapshots__/SnapshotTests/testMainThreadRenderingEngine.TypeFace-G-100.png and b/Tests/__Snapshots__/SnapshotTests/testMainThreadRenderingEngine.TypeFace-G-100.png differ diff --git a/Tests/__Snapshots__/SnapshotTests/testMainThreadRenderingEngine.TypeFace-G-75.png b/Tests/__Snapshots__/SnapshotTests/testMainThreadRenderingEngine.TypeFace-G-75.png index 32245c6e51..99ec08f8e7 100644 Binary files a/Tests/__Snapshots__/SnapshotTests/testMainThreadRenderingEngine.TypeFace-G-75.png and b/Tests/__Snapshots__/SnapshotTests/testMainThreadRenderingEngine.TypeFace-G-75.png differ