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

Function initialize

esm/GSDevTools.js:1284–1353  ·  view source on GitHub ↗
(preliminary)

Source from the content-addressed store, hash-verified

1282 },
1283 autoHideDelayedCall = _delayedCall(1.3, hide).pause(),
1284 initialize = function initialize(preliminary) {
1285 //if on startup, someone does a timeline.seek(), we must honor it, so when initialize() is called, we record _recordedRoot._start so that we can use that as an offset. Remember, however, that we call initialize() twice on startup, once after a tick has elapsed just in case someone called GSDevTools.create() before their animation code, so we must record the value (once).
1286 if (_startupPhase && !_globalStartTime) {
1287 _globalStartTime = _recordedRoot._start;
1288 }
1289
1290 _fullyInitialized = !preliminary;
1291 declaredAnimation = _parseAnimation(vars.animation);
1292
1293 if (declaredAnimation && !declaredAnimation.vars.id) {
1294 declaredAnimation.vars.id = "[no id]";
1295 }
1296
1297 _merge();
1298
1299 updateList();
1300
1301 var savedAnimation = _getAnimationById(recall("animation"));
1302
1303 if (savedAnimation) {
1304 savedAnimation._inProgress = recall("in") || 0;
1305 savedAnimation._outProgress = recall("out") || 100;
1306 }
1307
1308 vars.paused && pause();
1309 selectedAnimation = null;
1310 animation(declaredAnimation || savedAnimation || _recordedRoot);
1311 var ts = vars.timeScale || recall("timeScale"),
1312 savedInOut = savedAnimation === selectedAnimation;
1313
1314 if (ts) {
1315 _selectValue(timeScale, ts, timeScaleLabel, ts + "x");
1316
1317 linkedAnimation.timeScale(ts);
1318 }
1319
1320 inProgress = ("inTime" in vars ? _timeToProgress(vars.inTime, selectedAnimation, 0, 0) : savedInOut ? savedAnimation._inProgress : 0) || 0;
1321
1322 if (inProgress === 100 && !vars.animation && savedAnimation) {
1323 //in case there's a recorded animation (sessionStorage) and then the user defines an inTime that exceeds that animation's duration, just default back to the Global Timeline. Otherwise the in/out point will be at the very end and it'd be weird.
1324 animation(_recordedRoot);
1325 inProgress = _timeToProgress(vars.inTime, selectedAnimation, 0, 0) || 0;
1326 }
1327
1328 if (inProgress) {
1329 inPoint.style.left = inProgress + "%";
1330 inPoint.style.display = outPoint.style.display = "block"; //set display:block so that it remains visible even when the minimal skin is enabled.
1331 }
1332
1333 outProgress = ("outTime" in vars ? _timeToProgress(vars.outTime, selectedAnimation, 100, inProgress) : savedInOut ? savedAnimation._outProgress : 0) || 100;
1334
1335 if (outProgress < inProgress) {
1336 outProgress = 100;
1337 }
1338
1339 if (outProgress !== 100) {
1340 outPoint.style.left = outProgress + "%";
1341 inPoint.style.display = outPoint.style.display = "block"; //set display:block so that it remains visible even when the minimal skin is enabled.

Callers 1

GSDevToolsFunction · 0.70

Calls 15

timeScaleMethod · 0.80
pauseMethod · 0.80
timeMethod · 0.80
_parseAnimationFunction · 0.70
_mergeFunction · 0.70
updateListFunction · 0.70
_getAnimationByIdFunction · 0.70
recallFunction · 0.70
pauseFunction · 0.70
animationFunction · 0.70
_selectValueFunction · 0.70
_timeToProgressFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…