Skip to content

Commit 5e76f11

Browse files
Copilotmattleibow
andcommitted
Simplify Progress: auto-property with private set, no backing field
Co-authored-by: mattleibow <1096616+mattleibow@users.noreply.github.com>
1 parent 6c74782 commit 5e76f11

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

source/SkiaSharp.Extended/Lottie/SKLottiePlayer.cs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,11 @@ public class SKLottiePlayer
1212
private bool isInForwardPhase = true;
1313
private int repeatsCompleted = 0;
1414

15-
private TimeSpan _progress;
16-
1715
/// <summary>Gets the total duration of the loaded animation.</summary>
1816
public TimeSpan Duration { get; private set; } = TimeSpan.Zero;
1917

2018
/// <summary>Gets the current playback position.</summary>
21-
public TimeSpan Progress => _progress;
19+
public TimeSpan Progress { get; private set; }
2220

2321
/// <summary>Gets whether the animation has completed all repeats.</summary>
2422
public bool IsComplete { get; private set; } = false;
@@ -60,8 +58,8 @@ public void SetAnimation(Skottie.Animation? newAnimation)
6058
/// </summary>
6159
public void Seek(TimeSpan position)
6260
{
63-
_progress = position;
64-
UpdateProgress(_progress);
61+
Progress = position;
62+
UpdateProgress(Progress);
6563
AnimationUpdated?.Invoke(this, EventArgs.Empty);
6664
}
6765

@@ -184,8 +182,8 @@ private void Reset()
184182
Duration = animation?.Duration ?? TimeSpan.Zero;
185183

186184
// Directly set the initial position without triggering completion logic.
187-
_progress = AnimationSpeed < 0 ? Duration : TimeSpan.Zero;
188-
animation?.SeekFrameTime(_progress.TotalSeconds);
185+
Progress = AnimationSpeed < 0 ? Duration : TimeSpan.Zero;
186+
animation?.SeekFrameTime(Progress.TotalSeconds);
189187
AnimationUpdated?.Invoke(this, EventArgs.Empty);
190188
}
191189
}

0 commit comments

Comments
 (0)