Skip to content

Instantly share code, notes, and snippets.

@Hurricane996
Last active September 26, 2020 00:42
Show Gist options
  • Star 10 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save Hurricane996/1f56c4d431ab0c42d5fe84657443f5b5 to your computer and use it in GitHub Desktop.
Save Hurricane996/1f56c4d431ab0c42d5fe84657443f5b5 to your computer and use it in GitHub Desktop.
<body onload="d=m=document;n=Math.random;c=z.getContext`2d`;f=g=>c.fillStyle=g;r=(...y)=>c.fillRect(...y);L=_=>{clearInterval(m);v=i=X=m=s=0;h=71;P=[1,2,3].map(k=>({x:X+=150,y:n()*86}))};L();R=_=>{f`gold`;r(0,0,X,X);f`red`;for({x,y} of P){r(x,0,16,y);r(x,y+48,16,102-y)}r(0,h,8,8);c.fillText(s,0,8)};R();d.onclick=_=>{v=-5;m=m||setInterval('h=h*(h>0);h>=142&&L();h+=v+=0.5;for(p of P){p.x-=2;if(p.x<-31){p.x+=450;p.y=n(s++)*86}p.x<8&&(h<p.y||h>p.y+48)&&L()}R()',35)}"><canvas id=z>
@Hurricane996
Copy link
Author

Hurricane996 commented Aug 27, 2020

here's a dataurl

data:text/html,<body onload="d=m=document;n=Math.random;c=z.getContext`2d`;f=g=>c.fillStyle=g;r=(...y)=>c.fillRect(...y);L=_=>{clearInterval(m);v=i=X=m=s=0;h=71;P=[1,2,3].map(k=>({x:X+=150,y:n()*86}))};L();R=_=>{f`gold`;r(0,0,X,X);f`red`;for({x,y} of P){r(x,0,16,y);r(x,y+48,16,102-y)}r(0,h,8,8);c.fillText(s,0,8)};R();d.onclick=_=>{v=-5;m=m||setInterval('h=h*(h>0);h>=142&&L();h+=v+=0.5;for(p of P){p.x-=2;if(p.x<-31){p.x+=450;p.y=n(s++)*86}p.x<8&&(h<p.y||h>p.y+48)&&L()}R()',35)}"><canvas id=z>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment