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

Function loop

esm/GSDevTools.js:942–968  ·  view source on GitHub ↗
(value)

Source from the content-addressed store, hash-verified

940 },
941 //LOOP button
942 loop = function loop(value) {
943 loopEnabled = value;
944 record("loop", loopEnabled);
945
946 if (loopEnabled) {
947 loopAnimation.play();
948
949 if (linkedAnimation.progress() >= outProgress / 100) {
950 var target = linkedAnimation._targets && linkedAnimation._targets[0];
951
952 if (target === selectedAnimation) {
953 //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.
954 target.seek(startTime + (endTime - startTime) * inProgress / 100);
955 }
956
957 if (selectedAnimation._repeat && !inProgress && outProgress === 100) {
958 linkedAnimation.totalProgress(0, true);
959 } else {
960 linkedAnimation.progress(inProgress / 100, true);
961 }
962
963 play();
964 }
965 } else {
966 loopAnimation.reverse();
967 }
968 },
969 toggleLoop = function toggleLoop() {
970 return loop(!loopEnabled);
971 },

Callers 3

toggleLoopFunction · 0.70
animationFunction · 0.70
initializeFunction · 0.70

Calls 7

playMethod · 0.80
seekMethod · 0.80
totalProgressMethod · 0.80
reverseMethod · 0.80
recordFunction · 0.70
playFunction · 0.70
progressMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…