The right hand raggedness stems from some brew of the plotting image itself not sampling the curve sufficiently and the underlying curve generator not having sufficient “time” resolution. Either way, one has to take care.
in between losing a few card games to my son, i managed to write what is probably the worst warp effect ever using wave:
badwarp:
to_rgb
100%,100%,1,3,"a=$1;b=$2;c=$3;d=$4;n=$5;n*wave(w/x*a,wave(x/y*b,-x))+wave(h/y*c,wave(y/x*d,-y))"
replace_nan. 0 # yeah someone put this terror in me
+rotate. 180 blend[-1,-2] multiply
b. $6 n 0,255 +warp[0] [1],1,2,3
keep.
I don’t think your use of the second parameter to wave() is doing quite what you want or expect. After post 14@David_Tschumperle changed the argument list, reducing it to two. In the new scheme, the second parameter c just selects curve type.
If, instead of c \in \{0,1,2,3\} , some other number is in place, the sine curve is the default. So, I don’t think much magic is being added by the highlighted bits; they compute some number; wave() likely takes that to be an overly prolix way to select the sine wave template. Examples prior to post 14 probably need to be reworked.