mirror of
https://github.com/direct-img/vibegif.direct-img.link.git
synced 2026-10-29 19:54:51 +00:00
Generators now live in gen/<section>/<subject>/<action>.js; the section folder picks where a tile shows in the gallery and isn't part of the URL. The first 50 are in gen/bw, a dashed divider follows, then gen/color. First colored ones: fox/sleep, pig/oink, duck/swim, whale/spout, turtle/walk, owl/blink, crab/dance, butterfly/flutter, dino/stomp, jellyfish/pulse. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
19 lines
748 B
JavaScript
19 lines
748 B
JavaScript
// snowflakes of different sizes drifting down and slowly spinning
|
|
const{sin,cos,PI}=Math,T=2*PI
|
|
export const frames=20,delay=90
|
|
const F=[[46,0,20,1],[112,.3,30,1],[186,.62,24,1],[228,.15,16,1],[150,.82,38,1],[70,.55,26,1],[206,.42,32,1]]
|
|
export default(c,t)=>{
|
|
for(const[x0,o,r,n]of F){
|
|
const p=(t*n+o)%1,x=x0+12*sin(p*T+o*7),y=-r-6+p*(256+2*r+12),a=t*T/6*(n%2?1:-1)
|
|
for(const[l,s]of[[10,'#111'],[4,'#fff']]){
|
|
c.lineWidth=l;c.strokeStyle=s;c.beginPath()
|
|
for(let k=0;k<6;k++){
|
|
const b=a+k*PI/3,ux=cos(b),uy=sin(b),m=r*.55,q=r*.28
|
|
c.moveTo(x,y);c.lineTo(x+ux*r,y+uy*r)
|
|
for(const d of[-1,1])c.moveTo(x+ux*m,y+uy*m),c.lineTo(x+ux*m+cos(b+d*.9)*q,y+uy*m+sin(b+d*.9)*q)
|
|
}
|
|
c.stroke()
|
|
}
|
|
}
|
|
}
|