Guest User

G'MIC Snow Animation

a guest
Jun 14th, 2024
567
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.88 KB | None | 0 0
  1. # Generate snow animation.
  2. snow :
  3.   nb_frames=400
  4.  
  5.   # Generate volumetric image of rotating snowflakes.
  6.   shape_snowflake 300
  7.   repeat 100 {
  8.     f:=3+0.5*$> +resize[0] $f%,$f%,1,1,2 rotate. {lerp(0,90,$>/10)},1,0
  9.   }
  10.   remove[0] append z,0.5 autocrop. rescale2d. 16
  11.  
  12.   # Generate time-parameterized motion curves.
  13.   local[] { 8,1,1,{3*1000} rand. 0,1 s c,-3 rbf $nb_frames,0,1 append c }
  14.  
  15.   # Render animation frames.
  16.   repeat $nb_frames { f=$>
  17.     echo[] "\r  > Frame "{$f+1}/$nb_frames
  18.     400,400
  19.     {1,s/3},1,1,1,"
  20.      begin(P = I[#1,"$>"]; S = vector(#w#0*h#0*3,255));
  21.      k3 = 3*x;
  22.      x = P[k3]*w#-1;
  23.      y = P[k3 + 1]*h#-1;
  24.      r = round(lerp(0,d#0 - 1,cut(P[k3 + 2],0,1)));
  25.      M = crop(#0,0,0,r,w#0,h#0,1);
  26.      draw(#-1,S,x,y,0,0,w#0,h#0,1,1,0.75,M);
  27.    " remove.
  28.     text_outline. "Snow",0.5~,0.5~,${"font macondo,150"},3,1,255
  29.   }
  30.   remove[0,1]
Tags: gmic
Advertisement
Add Comment
Please, Sign In to add comment