Pookkalam by Abhishek Gopal

Code

#OUTER LAYER

# ______________outer layer____________________
c1=circle(fill="#010000",r=150)#black

def square(color,x):
  rect=rectangle(w=x, h=x, fill=color, stroke='none') | repeat(12,  rotate(10)) 
  return rect
s1=square(color='#700001',x=212) 
s2=square(color='#ee7e02',x=194) | rotate(5)
s3=square(color='#f6b206',x=178)
s4=square(color='#f5eb78',x=164) | rotate(5)
s5=square(color='#f1eabd',x=152)


#white circles
sc1 = circle(r=15,y=60,x=-30,stroke="#f8f8ff",stroke_width="0.8")
sc2 = circle(r=12,y=60,x=-30,stroke="#f8f8ff",stroke_width="0.8")
sc3 = circle(r=9,y=60,x=-30,stroke="#f8f8ff",stroke_width="0.8")
sc4 = circle(r=6,y=60,x=-30,stroke="#f8f8ff",stroke_width="0.8")
sc5 = circle(r=3,y=60,x=-30,stroke="#f8f8ff",stroke_width="0.8")
suCirc = sc1+sc2+sc3+sc4+sc5
subcir=(suCirc| repeat(18,rotate(30))|scale(1.15))|rotate(18)
c2=circle(fill="black",r=96)


sc1 = circle(r=15,y=60,stroke="#700001",stroke_width="4")
sc2 = circle(r=12,y=60,stroke="#ef8d06",stroke_width="4")
sc3 = circle(r=9,y=60,stroke="#f3e30c",stroke_width="4")
sc4 = circle(r=6,y=60,stroke="#49601c",stroke_width="4")
sc5 = circle(r=3,y=60,stroke="#e1dfaa",stroke_width="4")
subCircle = sc1+sc2+sc3+sc4+sc5
sub=subCircle | repeat(12,rotate(30))|scale(1.2)

square_comb=combine([c1,s1,s2,s3,s4,s5,c2,subcir,sub])



#__________________kathakali__________

def kathakali():
  c5=circle(r=100,fill="red",stroke="none",y=30)
  c6=circle(r=95,fill="#fbf112",stroke="none",y=30)#yellow stroke
  c7=circle(r=92,fill="#a2040a",stroke="none",y=30)#dark red
  c8=circle(r=72,fill="#83d900",stroke="none",y=30)#green
  #c9=circle(r=66,stroke="red",_width=3,stroke_width=3,y=30)#red
  c9=circle(r=66,stroke="red",stroke_width=3,y=30)#red

  c10=circle(r=64,fill="#f0e904",stroke="none",y=30)#yellow
  c1=circle(r=62,fill="#a2040a",stroke="none",y=30)#dark red
  c2=circle(r=50,fill="#ff1703",stroke="none",y=30)#red
  c3=circle(r=47,fill="#ffae00",stroke="none",y=30)#dark yellow
  c4=circle(r=43,fill="#87d602",stroke="none",y=30)
  c11=circle(r=41,fill="#a2040a",stroke="none",y=30)
  sm_c1=circle(r=3,x=0,y=53,fill="#F9F9F9",stroke="none") | repeat(20,rotate(20))|translate(y=30)#loopwhitecircle
  sm_c2=circle(r=5,x=0,y=81,stroke="#f7c26e",stroke_width=5) | repeat(12,rotate(30))|translate(y=30)#loopcircle
  e1=ellipse(x=6,w=6,h=2,stroke="none",fill='#f7da14')
  petal=(e1| repeat(10, rotate(40)))|translate(30)
  flower=(petal | repeat(10,rotate(45)))|translate(y=30)

  s2 = ellipse(w=65, h=88,fill="#02aa23",stroke="none")| translate(y=-50)  #face green
  s3 = ellipse(w=65, h=50,fill="#02aa23",stroke="none")| translate(y=-50)
  e1 = ellipse(w=203, h=109,fill="white",stroke="#e9f0f3", stroke_width=10)|translate(y=-20)#white ellipse1
  e3 = ellipse(w=209, h=107,fill="black",stroke="none", stroke_width=10)|translate(x=-1.5,y=-31)#white ellipse1
  e2 = ellipse(w=150, h=80,fill="white",stroke="#e9f0f3", stroke_width=8)|translate(y=-10)#white ellipse2

  #out circles
  w_elip=(e3+e1+e2)| scale(0.5) | translate(y=-65)
  outer_circles=c5+c6+c7+c8+c9+c10+c1+c2+c3+c4+c11+w_elip+s2+sm_c1+sm_c2+flower
  def eye():
    i_out=circle(r=50,fill="black",stroke="none")
    i_in=circle(r=10,fill="white",stroke="none",x=20,y=25)
    i_e=ellipse(w=260,h=100,fill="white",stroke="none")
    i_blck=ellipse(w=400,h=190,fill="black",stroke="none")|translate(y=-18,x=-20)
    eyesh=combine([i_blck,i_e,i_out,i_in]) | scale(1/15)|translate(y=-58,x=-14)
    l1=(line(x1=-40,y1=-50,x2=-10,y2=-50,stroke_width=10)| rotate(-40))+(line(x1=-43,y1=-33,x2=0,y2=-33,stroke_width=8))|translate(y=-70)|scale(0.49)
    final=eyesh+l1
    return final

  eye_lef=eye()
  eye_rit=eye()| scale(x=-1)

  def nose():
    eli_1=ellipse(w=8, h=3,fill="#0a732b",stroke="none")| translate(y=-73,x=-5)  
    eli_2=eli_1 | scale(x=-1)
    shape=combine([eli_1,eli_2])
    return shape

  def lips():
    rect=rectangle(w=90,h=3,fill="#c1241f",stroke="none")
    c1=circle(r=7,fill="#c1241f",stroke="none",x=40,y=0)
    c2=c1| scale(x=-1)
    eli1=ellipse(w=20, h=13,fill="#c1241f",stroke="none")|translate(x=-9)
    eli3=ellipse(w=26, h=8,fill="#932013",stroke="none")|translate(y=-2)
    eli2=eli1 | scale(x=-1)
    shape=combine([rect,eli1,eli2,eli3,c1,c2])|translate(y=-200)|scale(0.4)
    return shape

  def fhead1():
    p1=point(x=-100,y=75)
    p2=point(x=100,y=75)
    p3 = point(x=100, y=0)
    p4 = point(x=0, y=-50)
    p5=point(x=-100,y=0)
    t1 = point(x=0, y=50)
    t2 = point(x=26.5, y=0)
    t3 = point(x=-26.5, y=0)
    tri= polygon([t1, t2, t3],fill="black")
    c1=(circle(r=25,fill="black")+tri)|scale(0.6)|translate(y=-20)
    shape1=polygon([p1,p2,p3,p4,p5],fill="#ffeb06",stroke="none")
    shape2=polygon([p1,p2,p3,p4,p5],fill="#fddd00",stroke="none")|scale(0.7)
    e1=ellipse(w=120,h=10,fill="white",stroke="none")|translate(y=7)
    e2=ellipse(w=120,h=10,fill="white",stroke="none")|translate(y=-5)
    e3=ellipse(w=120,h=10,fill="white",stroke="none")|translate(y=-15)
    Tshape=(shape1+shape2+e1+e2+e3+c1)| scale(0.2)|translate(y=-42)
    return Tshape

  def fhead2():
    p1=point(x=-137,y=32)
    p2=point(x=137,y=32)
    p3 = point(x=137, y=-15)
    p4 = point(x=0, y=-50)
    p5=point(x=-137,y=-15)
    shape1=polygon([p1,p2,p3,p4,p5],fill="#f83f06",stroke="none")
    shape2=polygon([p1,p2,p3,p4,p5],stroke="white",stroke_width=3)|scale(0.7)
    shape3=polygon([p1,p2,p3,p4,p5],stroke="white",stroke_width=3)|scale(0.4)

    Tshape=(shape1+shape2+shape3)| scale(0.2)|translate(y=-30)
    return Tshape

  def earing():
    c1=circle(r=78,fill="#ffad00",stroke="none")
    c3=circle(r=10,x=0,y=50,fill="#a50607",stroke="none") | repeat(8,rotate(45))#loopcircle
    c2=circle(r=15,fill="#a50607",stroke="none")
    c4=circle(r=70,stroke="white")
    c5=(c1+c2+c3+c4)|scale(0.19)|translate(x=45,y=-50)
    c6=c5|scale(-1)|translate(y=-100)
    return c5+c6

  def kireedam():
    def design(n):
      shape = rectangle(w=20, h=20,stroke="white") | repeat(10, rotate(10))
      cir=circle(r=8,fill="white")
      des=cir+shape
      des=des | repeat(n,translate(42))
      des1=des | scale(-1)
      return des+des1

    r1=(rectangle(w=200,h=40,fill="red",stroke= "none"))|translate(y=14)#g
    round_edge1=circle(r=22,fill="#a0060e",stroke= "none")|translate(145)
    round_edge2=round_edge1 | scale(-1)
    r2=(rectangle(w=306,h=40,fill="#a0060e",stroke= "none")+round_edge2+round_edge1+design(4))|translate(y=58)|scale(0.7)#green
    big_c=circle(r=94,fill="#e62611",stroke="#00bd21",stroke_width=3)|translate(y=20)#big red tomb
    
    fun1=(big_c+r1+r2)|scale(0.4)|translate(y=-25)
    topr_rec=rectangle(w=35,h=70,x=0,y=45,fill="#e62611",stroke= "none")
    in_smcirc=circle(r=22,x=0,y=50,stroke="#8aca1c",stroke_width=2)
    sround=rectangle(w=20,h=15,x=5,y=0,stroke="orange")
    goldround=sround|repeat(20,rotate(18))|translate(y=50)
    dot=circle(r=2,x=0,y=50,fill="#FFD700",stroke="none")
    sm_cir=circle(r=25,x=0,y=50,fill="#ff1a03",stroke="brown")+in_smcirc+dot#small red
    topg_rec=(rectangle(w=35,h=3,x=0,y=25,fill="#8aca1c",stroke= "none"))|repeat(6,translate(x=0,y=10))
    r =(rectangle(x=22,y=0,w=5,h=5,fill="green",stroke="orange",stroke_width=2))|repeat(16,rotate(12))#yelloarc
    c = (circle(x=28,y=0,r=2,fill="#4682B4",stroke="none"))|repeat(14,rotate(18))
    c2= (circle(x=32,y=0,r=2,fill="white",stroke="none"))|repeat(14,rotate(18))
    arc=(r+c+c2)|scale(0.5)
    l1=line(x1=3,y1=0,y2=0,x2=10,stroke="orange")
    m_line=l1|repeat(11,rotate(18))|translate(y=-5)
    def top():   
      t1 = point(x=0, y=50)
      t2 = point(x=23, y=0)
      t3 = point(x=-23, y=0) 
      c1=(circle(r=22,fill="#f91f06",stroke="none")+polygon([t1, t2, t3],fill="#f91f06",stroke="none"))|translate(y=78)
      c2=(circle(r=22,fill="#f5670a",stroke="none")+polygon([t1, t2, t3],fill="#f5670a",stroke="none"))|translate(y=95)|scale(0.8)
      c3=(circle(r=22,fill="#fcaa00",stroke="none")+polygon([t1, t2, t3],fill="#fcaa00",stroke="none"))|translate(y=120)|scale(0.6)
      c4=(circle(r=22,fill="#fcf500",stroke="none")+polygon([t1, t2, t3],fill="#fcf500",stroke="none"))|translate(y=180)|scale(0.4)
      flame=(c1+c2+c3+c4)|scale(0.8)|translate(y=13)
      return flame
    fun2=(topr_rec+topg_rec+sm_cir+fun1+arc+m_line+goldround)|translate(y=-20)
    fun3=top()+fun2
    return fun3
  fun=outer_circles+kireedam()+s3+eye_lef+eye_rit+nose()+fhead1()+fhead2()+earing()+lips()|translate(y=-20)
  return fun
sp=(kathakali())|scale(0.7)|translate(y=-8)
show(square_comb,sp)