# =========================================================================== # # SinCos sized squares on a SinCos path with symmetry # # Created by barcud. # # See: www.contextfreeart.org/gallery/view.php?id=4239#comment4477 # # 27.07.2021 # =========================================================================== # startshape main[r 30]

CF::MinimumSize = 0.1 CF::Symmetry = CF::Cyclic,5,2.3,1

LMax = 1200 rot=1.2

wid = 4 hei = 2.2

shape main{

loop MyX = -0,LMax,1 [ ] {
  if (MyX < 400)
    MyFrame (MyX)[s 1 x  (sin(MyX) * 1-MyX/LMax) y (cos(MyX) * 1-MyX/LMax) z MyX  r (MyX/rot)]
  else
    MyFrame (MyX)[s (1 * (LMax - MyX)/400) x  (sin(MyX) * 1-MyX/LMax) y (cos(MyX) * 1-MyX/LMax) z MyX  r (MyX/rot)]
}

}

shape MyFrame(which){

if(mod(which,2) ==0){
  SQUARE[s (1+0.25*sin(which)*wid) hei sat 1 b 0]
  SQUARE[s (1+0.25*sin(which)*(wid-0.003)) (hei-0.003) h (120 - which*3)  sat 0.9 b (1.5+ 0.75*cos(which*10))  r 0.5]  ## sat 0 make the inner square

# white == sat 1 gives it colour

} else {
  SQUARE[s (1+0.25*sin(which)*wid) hei sat 1 b 0]
  SQUARE[s (1+0.25*sin(which)*(wid-0.005)) (hei-0.005) h (which*2)  sat 1 b (1+ 0.25*cos(which*3)) r 0.25]
}

}

// circle or triangle instead of Square works well