diff --git a/Example/Example/AnimationPreviewView.swift b/Example/Example/AnimationPreviewView.swift
index deef14a6..82bda8d8 100644
--- a/Example/Example/AnimationPreviewView.swift
+++ b/Example/Example/AnimationPreviewView.swift
@@ -62,12 +62,15 @@ struct AnimationPreviewView: View {
.playbackMode(playbackMode)
.animationDidFinish { completed in
if completed {
+ animationView?.stop()
animationPlaying = false
+ sliderValue = 0
}
}
.configure { animationView in
DispatchQueue.main.async {
currentRenderingEngine = animationView.currentRenderingEngine
+ self.animationView = animationView
}
}
.getRealtimeAnimationProgress(animationPlaying ? $sliderValue : nil)
@@ -114,11 +117,12 @@ struct AnimationPreviewView: View {
@State private var animationPlaying = true
@State private var sliderValue: AnimationProgressTime = 0
@State private var currentURLIndex: Int
- @State private var renderingEngine = RenderingEngineOption.automatic
- @State private var loopMode = LottieLoopMode.loop
+ @State private var renderingEngine = RenderingEngineOption.mainThread
+ @State private var loopMode = LottieLoopMode.playOnce
@State private var playFromProgress: AnimationProgressTime = 0
@State private var playToProgress: AnimationProgressTime = 1
@State private var currentRenderingEngine: RenderingEngine?
+ @State private var animationView: LottieAnimationView?
/// Used for remote animations only, when more than one URL is provided we loop over the urls every 2 seconds.
private let timer = Timer.publish(every: 2, on: .main, in: .common).autoconnect()