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

Function play

esm/GSDevTools.js:876–902  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

874 },
875 //PLAY/PAUSE button
876 play = function play() {
877 if (linkedAnimation.progress() >= outProgress / 100) {
878 _checkIndependence(linkedAnimation, vars);
879
880 var target = linkedAnimation._targets && linkedAnimation._targets[0];
881
882 if (target === selectedAnimation) {
883 //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.
884 target.seek(startTime + (endTime - startTime) * inProgress / 100);
885 }
886
887 if (linkedAnimation._repeat && !inProgress) {
888 linkedAnimation.totalProgress(0, true); //for repeating animations, don't get stuck in the last iteration - jump all the way back to the start.
889 } else if (!linkedAnimation.reversed()) {
890 linkedAnimation.progress(inProgress / 100, true);
891 }
892 }
893
894 playPauseMorph.play();
895 linkedAnimation.resume();
896
897 if (paused) {
898 _self.update();
899 }
900
901 paused = false;
902 },
903 pause = function pause() {
904 playPauseMorph.reverse();
905

Callers 5

GSDevToolsFunction · 0.70
togglePlayPauseFunction · 0.70
loopFunction · 0.70
animationFunction · 0.70
onChangeAnimationFunction · 0.70

Calls 8

seekMethod · 0.80
totalProgressMethod · 0.80
reversedMethod · 0.80
playMethod · 0.80
resumeMethod · 0.80
_checkIndependenceFunction · 0.70
progressMethod · 0.45
updateMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…