Jerome Herr’s recent post, along with my recent string art GIFs got me thinking about Bézier curves. This GIF shows the first few iterations of an algorithm I realized after the fact is basically De Casteljau's algorithm applied to points forming the corners of a square wave. I take it for granted there’s probably a fancier way to accomplish the same thing using Interpolation or BezierCurve or something.
Here’s the code (the silliness with p1, p2, etc. is because I couldn’t make ListConvolve do the right thing with lists of lists; does anybody know of a better way of dealing with this?):
Here’s the code (the silliness with p1, p2, etc. is because I couldn’t make ListConvolve do the right thing with lists of lists; does anybody know of a better way of dealing with this?):
In[]:=
DynamicModule[{cols},cols=RGBColor/@{"#08D9D6","#EAEAEA","#FF2E63","#252A34"};Manipulate[Graphics[{Thickness[.003],Table[{Blend[cols[[;;3]],j/5],Line[Nest[ListConvolve[{t,1-t},#]&,Table[ToExpression["p"<>IntegerString[i]],{i,1,50}],j]/.Table[ToExpression["p"<>IntegerString[n]]->{Floor[n/2],-2j+Mod[1+Floor[(n+1)/2],2]},{n,1,50}]]},{j,0,5}]},PlotRange->{{3.5,15.5},{-10.5,1.5}},ImageSize->540,Background->cols[[4]]],{t,0,1}]]
Out[]=

