Skip to content

Commit d744b69

Browse files
committed
Merge pull request #3934 from AnalyticalGraphicsInc/model-animation
Let repeating model animation run before start time
2 parents 4dd2409 + a64bb27 commit d744b69

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

Source/Scene/ModelAnimationCollection.js

+7-5
Original file line numberDiff line numberDiff line change
@@ -370,13 +370,15 @@ define([
370370
var pastStartTime = (delta >= 0.0);
371371

372372
// Play animation if
373-
// * we are after the start time, and
373+
// * we are after the start time or the animation is being repeated, and
374374
// * before the end of the animation's duration or the animation is being repeated, and
375375
// * we did not reach a user-provided stop time.
376-
var play = pastStartTime &&
377-
((delta <= 1.0) ||
378-
((scheduledAnimation.loop === ModelAnimationLoop.REPEAT) ||
379-
(scheduledAnimation.loop === ModelAnimationLoop.MIRRORED_REPEAT))) &&
376+
377+
var repeat = ((scheduledAnimation.loop === ModelAnimationLoop.REPEAT) ||
378+
(scheduledAnimation.loop === ModelAnimationLoop.MIRRORED_REPEAT));
379+
380+
var play = (pastStartTime || (repeat && !defined(scheduledAnimation.startTime))) &&
381+
((delta <= 1.0) || repeat) &&
380382
(!defined(stopTime) || JulianDate.lessThanOrEquals(sceneTime, stopTime));
381383

382384
if (play) {

0 commit comments

Comments
 (0)