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

Function onChangeTimeScale

esm/GSDevTools.js:1213–1244  ·  view source on GitHub ↗
(e)

Source from the content-addressed store, hash-verified

1211 },
1212 //TIMESCALE button
1213 onChangeTimeScale = function onChangeTimeScale(e) {
1214 var ts = parseFloat(timeScale.options[timeScale.selectedIndex].value) || 1,
1215 target;
1216 linkedAnimation.timeScale(ts);
1217 record("timeScale", ts);
1218
1219 if (!paused) {
1220 if (linkedAnimation.progress() >= outProgress / 100) {
1221 target = linkedAnimation._targets && linkedAnimation._targets[0];
1222
1223 if (target === selectedAnimation) {
1224 //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.
1225 target.seek(startTime + (endTime - startTime) * inProgress / 100);
1226 }
1227
1228 linkedAnimation.progress(inProgress / 100, true).pause();
1229 } else {
1230 linkedAnimation.pause();
1231 }
1232
1233 _delayedCall(0.01, function () {
1234 return linkedAnimation.resume();
1235 });
1236 }
1237
1238 timeScaleLabel.innerHTML = ts + "x";
1239
1240 if (timeScale.blur) {
1241 //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>.
1242 timeScale.blur();
1243 }
1244 },
1245 //AUTOHIDE
1246 autoHideTween = gsap.to([find(".gs-bottom"), find(".gs-top")], {
1247 duration: 0.3,

Callers

nothing calls this directly

Calls 6

timeScaleMethod · 0.80
seekMethod · 0.80
pauseMethod · 0.80
resumeMethod · 0.80
recordFunction · 0.70
progressMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…