1 2/** 3 * Handles all the front end animations we need. 4 */ 5export default class Animator { 6 /** 7 * Fades an element in, similar to the JQuery method of the same name. 8 * @param {HTMLElement} el 9 * @param {Number} time (ms) 10 */ 11 static fadeIn(el, time) { 12 el.style.opacity = 0; 13 el.style.display = 'block'; 14 15 let last = +new Date(); 16 const tick = () => { 17 el.style.opacity = +el.style.opacity + (new Date() - last) / time; 18 last = +new Date(); 19 20 if (+el.style.opacity < 1) { 21 (window.requestAnimationFrame && requestAnimationFrame(tick)) || setTimeout(tick, 16); 22 } 23 }; 24 25 tick(); 26 } 27 28 /** 29 * Fades an element out, similar to the JQuery method of the same name. 30 * @param {HTMLElement} el 31 * @param {Number} time (ms) 32 */ 33 static fadeOut(el, time) { 34 el.style.opacity = 1; 35 36 let last = +new Date(); 37 const tick = () => { 38 el.style.opacity = +el.style.opacity - (new Date() - last) / time; 39 last = +new Date(); 40 41 if (+el.style.opacity > 0) { 42 (window.requestAnimationFrame && requestAnimationFrame(tick)) || setTimeout(tick, 16); 43 } else { 44 el.style.display = 'none'; 45 } 46 }; 47 48 tick(); 49 } 50}
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.