Introducing Anamorphic Movies
Introducing Anamorphic Movies
Author: Erik Mahieu
polygonPoints[θ0_,r_,n_,m_:51]:=Table[{0,.75}+rCos[Pi/n]Sec[(2ArcTan[Cot[(1/2)n(θ-θ0)]])/n]{Cos[θ],Sin[θ]},{θ,0,2π,π/m}]rosePoints[θ0_,r_,n_,m_:51]:=1/3Table[{0,2.25}+r{(Sin[nθ+θ0]+2)Cos[θ],Sin[θ](Sin[nθ+θ0]+2)},{θ,0,2π,π/m}]colors={RGBColor[0.965,0.3285,0.0785],RGBColor[0.266,0.516,0.9576],RGBColor[0.207,0.652,0.324],RGBColor[0.988,0.73,0.0195]};
frames=Table[Module[{n=4,r=1.,ptsC,ptsP,ptsS,m=55},ptsC=CirclePoints[{0,.75},r,m];ptsP=polygonPoints[θ0,r,n,m];ptsS=polygonPoints[π/4.,1.425r,4,2m];Graphics[{EdgeForm[Thick],FaceForm[cols[[2]]],Polygon[ptsS],FaceForm[cols[[3]]],Polygon[ptsC],FaceForm[cols[[1]]],Polygon[ptsP]},ImageSize275]],{θ0,0.05,6.3,6.3/51}];ListAnimate[frames]
anamorphFrames=frames/.{x_?NumericQ,y_?NumericQ}cylindricalAnamorphMapCF[{x,y},{7.,5}]//Quiet;ListAnimate[anamorphFrames]
frames=Table[Module[{n=5,r=1.,ptsC,ptsP,ptsS,m=55},ptsC=CirclePoints[{0,.75},r,m];ptsCc=CirclePoints[{0,.75},.32r,m];ptsP=rosePoints[θ0,r,n,m];ptsS=polygonPoints[π/4.,1.425r,4,2m];Graphics[{EdgeForm[Thick],FaceForm[cols[[2]]],Polygon[ptsS],FaceForm[cols[[4]]],Polygon[ptsC],FaceForm[cols[[3]]],Polygon[ptsP],FaceForm[cols[[1]]],Polygon[ptsCc]},ImageSize275]],{θ0,0.05,6.3,6.3/51}];anamorphFrames=frames/.{x_?NumericQ,y_?NumericQ}cylindricalAnamorphMapCF[{x,y},{7.,5}]//Quiet;duoFrames=Row/@Transpose[{frames,anamorphFrames}];ListAnimate[duoFrames]
Export["rose5.gif",Most@anamorphFrames]