1/* 2 3repeating-text-animation.js 4 5Creates a text loop which animates, giving the impression it is 6scrolling infinitely. 7 8Created by Ceri 27/11/2020 9 10*/ 11 12if (!W.EDIT_MODE){ 13 14 W.Modules.useOnLoad([], function(){ 15 16 let minWidth = 10000 // A number way higher than both the screen width and the width of the text you'll be animating. 17 let animationSpeed = 25 // higher numbers go more slowly 18 19 let textToAnimate = document.querySelector('.animatedText') 20 let widthToAnimate = textToAnimate.offsetWidth 21 22 while(textToAnimate.offsetWidth < minWidth){ 23 textToAnimate.appendChild(textToAnimate.querySelector('div').cloneNode(true)) 24 } 25 26 27 let position = 0 28 animateText() 29 30 function animateText(){ 31 32 setTimeout(function(){ 33 position++ 34 textToAnimate.style.transform = 'translateX(-' + position + 'px)' 35 36 if (position === widthToAnimate){ 37 position = 0 38 } 39 40 requestAnimationFrame(animateText) 41 42 },animationSpeed) 43 } 44 45 }) 46 47}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.