Skip to content
This repository has been archived by the owner on Aug 20, 2024. It is now read-only.

Commit

Permalink
Fix playback
Browse files Browse the repository at this point in the history
  • Loading branch information
RyanLua committed Apr 5, 2023
1 parent a19b3b0 commit 8953014
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/Shime.lua
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,8 @@ end

-- Setup tween completion callback
function Shime:_TweenCompleted()
self:Stop()
self._frame.Visible = false
self.PlaybackState = Enum.PlaybackState.Completed
end

-- Get the shimmer frame
Expand All @@ -135,26 +136,25 @@ end

-- Start shimmering
function Shime:Play()
self.PlaybackState = self._tween.PlaybackState
self.PlaybackState = Enum.PlaybackState.Begin
self._frame.Visible = true
self._tween:Play()
self.PlaybackState = self._tween.PlaybackState
self.PlaybackState = Enum.PlaybackState.Playing
end

-- Pause shimmering
function Shime:Pause()
if not self.IsCompleted then
self._frame.Visible = true
self.PlaybackState = self._tween.PlaybackState
if self.PlaybackState == Enum.PlaybackState.Playing then
self._tween:Pause()
self.PlaybackState = self._tween.PlaybackState
self.PlaybackState = Enum.PlaybackState.Paused
end
end

-- Stop shimmering
function Shime:Stop()
self.PlaybackState = self._tween.PlaybackState
-- Cancel shimmering
function Shime:Cancel()
self._tween:Cancel()
self._frame.Visible = false
self.PlaybackState = Enum.PlaybackState.Cancelled
end

return Shime

0 comments on commit 8953014

Please sign in to comment.