Last active
December 4, 2020 05:54
-
-
Save non117/bef2b688ab39e55ba714c6e34ffcc97a to your computer and use it in GitHub Desktop.
めんだこが降ります
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
w = () => window.innerWidth * 0.95 | |
h = () => window.innerHeight * 0.95 | |
r = Math.random | |
men = () => { | |
base = "https://media.handon.club/custom_emojis/images/000/" | |
if(r() > 0.01) { | |
return `${base}008/726/original/mendako_anime.png` | |
} else { | |
p = r() | |
if(p > 0.67) { | |
return `${base}016/657/original/b6e13acf026cba4f.png` | |
} else if (p > 0.33) { | |
return `${base}016/804/original/3ab74c76895085f5.png` | |
} else { | |
return `${base}008/809/original/mendako_colorful.png` | |
} | |
} | |
} | |
m0 = Array.from(document.getElementsByClassName('mendako')) | |
m1 = [...Array(30)].map(() => { | |
i = new Image() | |
i.width = 40 | |
i.height = 40 | |
i.className = 'mendako' | |
i.style.zIndex = 5000 | |
i.style.position = 'absolute' | |
i.style.left = `${w() * r()}px` | |
i.style.top = `${h() * r() * 0.5}` | |
i.src = men() | |
document.body.appendChild(i) | |
return i | |
}) | |
move = () => { | |
[...m0, ...m1].forEach( i => { | |
x = +i.style.left.replace('px','') | |
y = +i.style.top.replace('px','') | |
let newX, newY | |
if ( x > w() || x < 0 || y > h() || y < 0) { | |
i.src = men() | |
i.style.transform = 'rotate(0deg)' | |
newX = w() * r() | |
newY = h() * r() * 0.5 | |
} else { | |
newX = x + r() * 10 - 5 | |
newY = y + r() * 10 - 2 | |
} | |
i.style.left = `${newX}px` | |
i.style.top = `${newY}px` | |
if (r() > 0.99) { | |
i.style.transform = `rotate(${r() * 20 - 10}deg)` | |
if (r() > 0.99) { | |
i.style.transform = `rotate(180deg)` | |
} | |
} | |
}) | |
} | |
if (window.handle !== undefined) { | |
clearInterval(window.handle) | |
} | |
handle = setInterval(move, 100) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
w=(()=>.95*window.innerWidth),h=(()=>.95*window.innerHeight),r=Math.random,men=(()=>(base="https://media.handon.club/custom_emojis/images/000/",r()>.01?`${base}008/726/original/mendako_anime.png`:(p=r(),p>.67?`${base}016/657/original/b6e13acf026cba4f.png`:p>.33?`${base}016/804/original/3ab74c76895085f5.png`:`${base}008/809/original/mendako_colorful.png`))),m0=Array.from(document.getElementsByClassName("mendako")),m1=[...Array(30)].map(()=>(i=new Image,i.width=40,i.height=40,i.className="mendako",i.style.zIndex=5e3,i.style.position="absolute",i.style.left=`${w()*r()}px`,i.style.top=`${h()*r()*.5}`,i.src=men(),document.body.appendChild(i),i)),move=(()=>{[...m0,...m1].forEach(e=>{let a,t;x=+e.style.left.replace("px",""),y=+e.style.top.replace("px",""),x>w()||x<0||y>h()||y<0?(e.src=men(),e.style.transform="rotate(0deg)",a=w()*r(),t=h()*r()*.5):(a=x+10*r()-5,t=y+10*r()-2),e.style.left=`${a}px`,e.style.top=`${t}px`,r()>.99&&(e.style.transform=`rotate(${20*r()-10}deg)`,r()>.99&&(e.style.transform="rotate(180deg)"))})}),void 0!==window.handle&&clearInterval(window.handle),handle=setInterval(move,100); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment