| 952 | }, |
| 953 | autoHideDelayedCall = _delayedCall(1.3, hide).pause(), |
| 954 | initialize = preliminary => { |
| 955 | //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). |
| 956 | if (_startupPhase && !_globalStartTime) { |
| 957 | _globalStartTime = _recordedRoot._start; |
| 958 | } |
| 959 | _fullyInitialized = !preliminary; |
| 960 | declaredAnimation = _parseAnimation(vars.animation); |
| 961 | if (declaredAnimation && !declaredAnimation.vars.id) { |
| 962 | declaredAnimation.vars.id = "[no id]"; |
| 963 | } |
| 964 | _merge(); |
| 965 | updateList(); |
| 966 | let savedAnimation = _getAnimationById(recall("animation")); |
| 967 | if (savedAnimation) { |
| 968 | savedAnimation._inProgress = recall("in") || 0; |
| 969 | savedAnimation._outProgress = recall("out") || 100; |
| 970 | } |
| 971 | vars.paused && pause(); |
| 972 | selectedAnimation = null; |
| 973 | animation(declaredAnimation || savedAnimation || _recordedRoot); |
| 974 | let ts = vars.timeScale || recall("timeScale"), |
| 975 | savedInOut = (savedAnimation === selectedAnimation); |
| 976 | if (ts) { |
| 977 | _selectValue(timeScale, ts, timeScaleLabel, ts + "x"); |
| 978 | linkedAnimation.timeScale(ts); |
| 979 | } |
| 980 | inProgress = (("inTime" in vars) ? _timeToProgress(vars.inTime, selectedAnimation, 0, 0) : savedInOut ? savedAnimation._inProgress : 0) || 0; |
| 981 | if (inProgress === 100 && !vars.animation && savedAnimation) { //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. |
| 982 | animation(_recordedRoot); |
| 983 | inProgress = _timeToProgress(vars.inTime, selectedAnimation, 0, 0) || 0; |
| 984 | } |
| 985 | if (inProgress) { |
| 986 | inPoint.style.left = inProgress + "%"; |
| 987 | inPoint.style.display = outPoint.style.display = "block"; //set display:block so that it remains visible even when the minimal skin is enabled. |
| 988 | } |
| 989 | outProgress = (("outTime" in vars) ? _timeToProgress(vars.outTime, selectedAnimation, 100, inProgress) : savedInOut ? savedAnimation._outProgress : 0) || 100; |
| 990 | if (outProgress < inProgress) { |
| 991 | outProgress = 100; |
| 992 | } |
| 993 | if (outProgress !== 100) { |
| 994 | outPoint.style.left = outProgress + "%"; |
| 995 | inPoint.style.display = outPoint.style.display = "block"; //set display:block so that it remains visible even when the minimal skin is enabled. |
| 996 | } |
| 997 | loopEnabled = ("loop" in vars) ? vars.loop : recall("loop"); |
| 998 | loopEnabled && loop(true); |
| 999 | vars.paused && linkedAnimation.progress(inProgress / 100, true).pause(); |
| 1000 | if (_startupPhase && selectedAnimation === _recordedRoot && _globalStartTime && vars.globalSync && !paused) { |
| 1001 | linkedAnimation.time(-_globalStartTime, true); |
| 1002 | } |
| 1003 | updateProgress(true); |
| 1004 | }; |
| 1005 | |
| 1006 | |
| 1007 |
no test coverage detected
searching dependent graphs…