(force)
| 781 | } |
| 782 | })[0], |
| 783 | updateProgress = function updateProgress(force) { |
| 784 | // NOTE: "force" is actually the "time" when this method gets called by the gsap.ticker! |
| 785 | if (progressDrag.isPressed && force !== true) { |
| 786 | return; |
| 787 | } |
| 788 | |
| 789 | var p = !loopEnabled && selectedAnimation._repeat === -1 ? selectedAnimation.totalTime() / selectedAnimation.duration() * 100 : linkedAnimation.progress() * 100 || 0, |
| 790 | repeatDelayPhase = selectedAnimation._repeat && selectedAnimation._rDelay && selectedAnimation.totalTime() % (selectedAnimation.duration() + selectedAnimation._rDelay) > selectedAnimation.duration(), |
| 791 | target; |
| 792 | |
| 793 | if (p > 100) { |
| 794 | p = 100; |
| 795 | } |
| 796 | |
| 797 | if (p >= outProgress) { |
| 798 | if (loopEnabled && !linkedAnimation.paused() && !progressDrag.isDragging) { |
| 799 | if (!repeatDelayPhase) { |
| 800 | p = inProgress; |
| 801 | target = linkedAnimation._targets && linkedAnimation._targets[0]; |
| 802 | |
| 803 | if (target === selectedAnimation) { |
| 804 | //in case there are callbacks on the timeline, when we jump back to the start we should seek() so that the playhead doesn't drag [backward] past those and trigger them. |
| 805 | target.seek(startTime + (endTime - startTime) * inProgress / 100); |
| 806 | } |
| 807 | |
| 808 | if (selectedAnimation._repeat > 0 && !inProgress && outProgress === 100) { |
| 809 | if (selectedAnimation.totalProgress() === 1) { |
| 810 | linkedAnimation.totalProgress(0, true).resume(); |
| 811 | } |
| 812 | } else { |
| 813 | linkedAnimation.progress(p / 100, true).resume(); |
| 814 | } |
| 815 | } |
| 816 | } else { |
| 817 | if (p !== outProgress || selectedAnimation._repeat === -1) { |
| 818 | p = outProgress; |
| 819 | linkedAnimation.progress(p / 100); |
| 820 | } |
| 821 | |
| 822 | if (!paused && (outProgress < 100 || selectedAnimation.totalProgress() === 1 || selectedAnimation._repeat === -1)) { |
| 823 | pause(); |
| 824 | } |
| 825 | } |
| 826 | } else if (p < inProgress) { |
| 827 | p = inProgress; |
| 828 | linkedAnimation.progress(p / 100, true); |
| 829 | } |
| 830 | |
| 831 | if (p !== progress || force === true) { |
| 832 | progressBar.style.left = inProgress + "%"; |
| 833 | progressBar.style.width = Math.max(0, p - inProgress) + "%"; |
| 834 | playhead.style.left = p + "%"; |
| 835 | timeLabel.innerHTML = linkedAnimation._time.toFixed(2); |
| 836 | durationLabel.innerHTML = linkedAnimation._dur.toFixed(2); |
| 837 | |
| 838 | if (dragged) { |
| 839 | playhead.style.transform = "translate(-50%,0)"; |
| 840 | playhead._gsap.x = "0px"; |
no test coverage detected
searching dependent graphs…