-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathScrubGSAPTimeline_V3.min.js
More file actions
3 lines (3 loc) · 1.34 KB
/
ScrubGSAPTimeline_V3.min.js
File metadata and controls
3 lines (3 loc) · 1.34 KB
1
2
3
window.ScrubGSAPTimeline=function(d){document.body.childNodes.forEach(function(a){gsap.set(a,{pointerEvents:"none"})});var g=gsap.timeline();if("[object Array]"===Object.prototype.toString.call(d))for(var h=d.length;-1<--h;)g.add(d[h],0);else g=d;(function(a){var k=function(c){b.innerHTML=parseFloat(a.time()).toFixed(2);a.pause();a.progress(c.clientX/window.innerWidth);e=c.clientX;f=c.clientY;gsap.set(b,{x:e>=window.innerWidth-48?e-48:e,y:20>=f?f+20:f-20})},l=function(c){a.pause();a.play(0);gsap.set(b,
{autoAlpha:1})},m=function(c){a.play(c.clientX/window.innerWidth*a.duration());gsap.set(b,{autoAlpha:0})},b=document.createElement("div"),e,f;b.style.cssText="position:fixed;border-radius:4px;font-size:14px;padding:5px;user-select:none;pointer-events:none;text-align:center;color:#53A018;top:0;left:0;font-family:Helvetica, Arial, sans-serif;background-color:#262626;line-height:1 !important;z-index:99999999";document.body.appendChild(b);document.body.onmousemove=k;document.body.onmouseover=l;document.body.onmouseout=
m;document.body.ondblclick=function(c){document.body.onmousemove?(gsap.to(b,{duration:.2,color:"#A31632"}),document.body.onmousemove=null,document.body.onmouseover=null,document.body.onmouseout=null,a.pause()):(gsap.to(b,{duration:.2,color:"#53A018"}),document.body.onmousemove=k,document.body.onmouseover=l,document.body.onmouseout=m)}})(g)};