Skip to content

Commit dd6eb26

Browse files
committed
[feat] correct BACKWARD mode, initialising,nulling the count of repeats
1 parent f84dfca commit dd6eb26

1 file changed

Lines changed: 12 additions & 3 deletions

File tree

library/src/animationManager.cxx

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,14 @@ void animationManager::ToggleAnimation()
133133
// Initialize time if not already
134134
if (!this->CurrentTimeSet)
135135
{
136-
this->CurrentTime = this->TimeRange[0];
136+
if (this->AnimationMode == AnimationModeType::BACKWARD)
137+
{
138+
this->CurrentTime = TimeRange[1];
139+
}
140+
else
141+
{
142+
this->CurrentTime = TimeRange[0];
143+
}
137144
this->CurrentTimeSet = true;
138145
}
139146
}
@@ -182,8 +189,9 @@ void animationManager::Tick()
182189
break;
183190
case AnimationModeType::BACKWARD:
184191
this->AnimationDirection = -1;
185-
this->CurrentTime = this->TimeRange[0] +
186-
modulo(this->CurrentTime - this->TimeRange[0], this->TimeRange[1] - this->TimeRange[0]);
192+
this->CurrentTime = this->TimeRange[1] -
193+
modulo(this->TimeRange[1] - this->CurrentTime, this->TimeRange[1] - this->TimeRange[0]);
194+
break;
187195
default:
188196
this->AnimationDirection = 1;
189197
this->CurrentTime = this->TimeRange[0] +
@@ -204,6 +212,7 @@ void animationManager::Tick()
204212
if (this->AnimationMaxRepeat != -1 && this->AnimationCurrentRepeat == this->AnimationMaxRepeat)
205213
{
206214
this->Playing = false;
215+
this->AnimationCurrentRepeat = 0;
207216
}
208217
}
209218

0 commit comments

Comments
 (0)