Skip to content

Instantly share code, notes, and snippets.

@lewdev
Created October 6, 2023 12:08
Show Gist options
  • Select an option

  • Save lewdev/32a1e436808478aebe23af91f072fb0f to your computer and use it in GitHub Desktop.

Select an option

Save lewdev/32a1e436808478aebe23af91f072fb0f to your computer and use it in GitHub Desktop.
πŸ” Dweet Burger Builder Code
<style>html,body{background:#222;display:flex;justify-content:center;align-items:center;height:100%;margin:0}#c{background:white;max-height:100%;max-width:100%}</style>
<canvas id=c width=1080 height=1080></canvas>
<script>
x=c.getContext`2d`,lfr=1,S=Math.sin,C=Math.cos,T=Math.tan,R=(r,g,b,a=1)=>`rgba(${r|0},${g|0},${b|0},${a})`,t=f=nfm=0;
/* code */z=t=>{
c.width=c.height=120
t?0:v=1;
onclick=_=>v=(v>5?1:v+1)
h=[15,10,5,5,4,15]
p=5
i=0
console.log(v);
for(i=6;i--;){q=h[i]
x.beginPath();
x.fillStyle="Tan,#B30,#070,#FF0,Gray,Tan".split`,`[i];
x.roundRect(15,p,88,q,[5])
if(i<v)x.fill()
p+=q}
/* code */};loop=fTime=>{requestAnimationFrame(loop);if(lfr&&fTime<nfm-2)return;nfm=Math.max(nfm+1e3/60,fTime);t=f/60;if(t*60|0!=f++)t+=1;z(t)};
loop()
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment