MCPcopy
hub / github.com/greensock/GSAP / updateRootDuration

Function updateRootDuration

src/GSDevTools.js:860–887  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

858 _selectValue(list, selectedAnimation.vars.id, animationLabel);
859 },
860 updateRootDuration = () => {
861 let time, ratio, duration;
862 if (selectedAnimation === _recordedRoot) {
863 time = _recordedRoot._time;
864 _recordedRoot.progress(1, true).time(time, true); //jump to the end and back again because sometimes a tween that hasn't rendered yet will affect duration, like a TimelineMax.tweenTo() where the duration gets set in the onStart.
865 time = (_rootTween._dp._time - _rootTween._start) * _rootTween._ts;
866 duration = Math.min(1000, _recordedRoot.duration());
867 if (duration === 1000) {
868 duration = Math.min(1000, _getClippedDuration(_recordedRoot));
869 }
870 ratio = _rootTween.duration() / duration;
871 if (ratio !== 1 && duration) {
872 inProgress *= ratio;
873 if (outProgress < 100) {
874 outProgress *= ratio;
875 }
876 _rootTween.seek(0);
877 _rootTween.vars.time = duration;
878 _rootTween.invalidate();
879 _rootTween.duration(duration);
880 _rootTween.time(time);
881 durationLabel.innerHTML = duration.toFixed(2);
882 inPoint.style.left = inProgress + "%";
883 outPoint.style.left = outProgress + "%";
884 updateProgress(true);
885 }
886 }
887 },
888 onChangeAnimation = e => {
889 animation(list.options[list.selectedIndex].animation);
890 if (e.target && e.target.blur) { //so that if an option is selected, and then the user tries to hit the up/down arrow, it doesn't just try selecting something else in the <select>.

Callers 1

GSDevToolsFunction · 0.70

Calls 7

timeMethod · 0.80
durationMethod · 0.80
seekMethod · 0.80
_getClippedDurationFunction · 0.70
updateProgressFunction · 0.70
progressMethod · 0.45
invalidateMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…