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

Function GSDevTools

esm/GSDevTools.js:539–1545  ·  view source on GitHub ↗
(vars)

Source from the content-addressed store, hash-verified

537 }
538},
539 GSDevTools = function GSDevTools(vars) {
540 if (!_coreInitted) {
541 _initCore();
542
543 gsap || console.warn("Please gsap.registerPlugin(GSDevTools)");
544 }
545
546 this.vars = vars = vars || {};
547
548 if (vars.animation) {
549 (GSDevTools.getByAnimation(vars.animation) || {
550 kill: function kill() {
551 return 0;
552 }
553 }).kill();
554 }
555
556 vars.id = vars.id || (_isString(vars.animation) ? vars.animation : _idSeed++); //try to find a unique ID so that sessionStorage can be mapped to it (otherwise, for example, all the embedded codepens on a page would share the same settings). So if no id is defined, see if there's a string-based "animation" defined. Last of all, we default to a numeric counter that we increment.
557
558 _lookup[vars.id + ""] = this;
559 "globalSync" in vars || (vars.globalSync = !vars.animation); //if the user calls create() and passes in an animation AFTER the initial recording time has elapsed, there's a good chance the animation won't be in the recordedRoot, so we change the default globalSync to false because that's the most intuitive behavior.
560 //GENERAL/UTILITY
561
562 var _self = this,
563 root = _createRootElement(vars.container, vars.minimal, vars.css),
564 find = function find(s) {
565 return root.querySelector(s);
566 },
567 record = function record(key, value) {
568 if (vars.persist !== false && _supportsStorage) {
569 sessionStorage.setItem("gs-dev-" + key + vars.id, value);
570 }
571
572 return value;
573 },
574 recall = function recall(key) {
575 var value;
576
577 if (vars.persist !== false && _supportsStorage) {
578 value = sessionStorage.getItem("gs-dev-" + key + vars.id);
579 return key === "animation" ? value : key === "loop" ? value === "true" : parseFloat(value); // handle data typing too.
580 }
581 },
582 //SCRUBBER/PROGRESS
583 playhead = find(".playhead"),
584 timelineTrack = find(".timeline-track"),
585 progressBar = find(".progress-bar"),
586 timeLabel = find(".time"),
587 durationLabel = find(".duration"),
588 pixelToTimeRatio,
589 timeAtDragStart,
590 dragged,
591 skipDragUpdates,
592 progress = 0,
593 inPoint = find(".in-point"),
594 outPoint = find(".out-point"),
595 inProgress = 0,
596 outProgress = 100,

Callers

nothing calls this directly

Calls 15

timeMethod · 0.80
resumeMethod · 0.80
durationMethod · 0.80
pauseMethod · 0.80
timeScaleMethod · 0.80
pausedMethod · 0.80
disableMethod · 0.80
endDragMethod · 0.80
_initCoreFunction · 0.70
_isStringFunction · 0.70
_createRootElementFunction · 0.70
findFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…