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

Function updateRootDuration

esm/GSDevTools.js:1160–1201  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1158 _selectValue(list, selectedAnimation.vars.id, animationLabel);
1159 },
1160 updateRootDuration = function updateRootDuration() {
1161 var time, ratio, duration;
1162
1163 if (selectedAnimation === _recordedRoot) {
1164 time = _recordedRoot._time;
1165
1166 _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.
1167
1168
1169 time = (_rootTween._dp._time - _rootTween._start) * _rootTween._ts;
1170 duration = Math.min(1000, _recordedRoot.duration());
1171
1172 if (duration === 1000) {
1173 duration = Math.min(1000, _getClippedDuration(_recordedRoot));
1174 }
1175
1176 ratio = _rootTween.duration() / duration;
1177
1178 if (ratio !== 1 && duration) {
1179 inProgress *= ratio;
1180
1181 if (outProgress < 100) {
1182 outProgress *= ratio;
1183 }
1184
1185 _rootTween.seek(0);
1186
1187 _rootTween.vars.time = duration;
1188
1189 _rootTween.invalidate();
1190
1191 _rootTween.duration(duration);
1192
1193 _rootTween.time(time);
1194
1195 durationLabel.innerHTML = duration.toFixed(2);
1196 inPoint.style.left = inProgress + "%";
1197 outPoint.style.left = outProgress + "%";
1198 updateProgress(true);
1199 }
1200 }
1201 },
1202 onChangeAnimation = function onChangeAnimation(e) {
1203 animation(list.options[list.selectedIndex].animation);
1204

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…