#include animate.js #include rng.js const MamiYouAreAnIdiot = function() { const html =
you are an idiot
!
; const rng = new MamiRNG; let soundSrc; const pub = { getElement: () => html, onViewPush: async () => { try { soundSrc = await mami.getSoundLibrary().loadSource('misc:youare'); soundSrc.setMuted(true); soundSrc.setLoop(true, 0.21, 5); soundSrc.play(); } catch(ex) { console.error(ex); } }, onViewForeground: async () => { if(soundSrc !== undefined) soundSrc.setMuted(false); }, onViewBackground: async () => { if(soundSrc !== undefined) soundSrc.setMuted(true); }, onViewPop: async () => { if(soundSrc !== undefined) soundSrc.stop(); soundSrc = undefined; }, pushOn: async views => views.push(pub, ctx => MamiAnimate({ async: true, duration: rng.next(1500, 15001), easing: 'outBounce', start: () => ctx.toElem.style.top = '-100%', update: t => ctx.toElem.style.top = `${-100 + (t * 100)}%`, end: () => ctx.toElem.style.top = null, })), }; return pub; };