2024-01-23 01:24:24 +00:00
|
|
|
#include animate.js
|
2024-02-10 04:23:26 +00:00
|
|
|
#include rng.js
|
2024-01-23 01:24:24 +00:00
|
|
|
|
|
|
|
const MamiYouAreAnIdiot = function() {
|
|
|
|
const html = <div class="youare">
|
|
|
|
<div class="youare-content">
|
|
|
|
<div class="youare-text">
|
|
|
|
<div class="youare-big">you are an idiot</div>
|
|
|
|
<div class="youare-small">!</div>
|
|
|
|
</div>
|
|
|
|
<div class="youare-smiles">
|
|
|
|
<div class="youare-smile">☺</div>
|
|
|
|
<div class="youare-smile">☺</div>
|
|
|
|
<div class="youare-smile">☺</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>;
|
|
|
|
|
2024-02-10 04:23:26 +00:00
|
|
|
const rng = new MamiRNG;
|
2024-01-23 01:24:24 +00:00
|
|
|
let soundSrc;
|
|
|
|
|
|
|
|
const pub = {
|
|
|
|
getElement: () => html,
|
2024-02-09 22:38:57 +00:00
|
|
|
onViewPush: async () => {
|
|
|
|
try {
|
2024-02-10 17:23:47 +00:00
|
|
|
soundSrc = await mami.sound.library.loadSource('misc:youare');
|
2024-02-09 22:38:57 +00:00
|
|
|
soundSrc.setMuted(true);
|
|
|
|
soundSrc.setLoop(true, 0.21, 5);
|
|
|
|
soundSrc.play();
|
|
|
|
} catch(ex) {
|
|
|
|
console.error(ex);
|
|
|
|
}
|
2024-01-23 01:24:24 +00:00
|
|
|
},
|
|
|
|
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,
|
2024-02-10 04:23:26 +00:00
|
|
|
duration: rng.next(1500, 15001),
|
2024-01-23 01:24:24 +00:00
|
|
|
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;
|
|
|
|
};
|