Pookkalam by Fiza p

Code

'''
Author : Fiza P
Event  : Code a Pookalam
'''


colors=['#a92822','#Fd6002','#E3BD36',"#F8E63D","wheat"]
colorss=[]
colorss=colors*9

#background
r1=rectangle(h=310,w=310,fill="#fffffe",stroke="none")
show(r1)

#outer circle
c=circle(r=2,x=149,fill="#073305")|repeat(120,rotate(3))
c1=circle(r=146,fill="#073305",stroke="#073305",stroke_width="2")
show(c+c1)

#outer circle design
def shape(color):
    p1=point(x=-11,y=85)
    p2=point(x=11,y=85)
    p3=point(x=-6,y=75)
    p4=point(x=6,y=75)
    s=polygon([p1,p2,p4,p3],fill=color,stroke="none")|rotate(10+(i*10))
    return(s)
for i in range(36):
    s1=shape(colorss[i])|rotate(10)|scale(1.35)
    show(s1)
for i in range(36):    
    s2=shape(colorss[i])|scale(1.5)
    show(s2)
for i in range(36):    
    s3=shape(colorss[i])|rotate(-10)|scale(1.66)
    show(s3)

#middle circle
c2=circle(r=95,fill="wheat",stroke="#073305")
show(c2)

#colors for inner ellipse
clr1=color(r=253,g=96,b=2,a=0.5)
clr2=color(r=248,g=230,b=61,a=0.55)
clr3=color(r=206,g=41,b=36,a=0.5)

#ellipses in the middle
e1=ellipse(w=90,h=17,x=50,fill=clr1,stroke="none")
e2=ellipse(w=90,h=17,x=50,fill=clr2,stroke="none")

n=5
for i in range(36):
    if(i%2==0):
        e=e1 | rotate(n)
    else:
        e=e2 | rotate(n)
    show(e)
    n=n+10

e3=ellipse(w=70,h=18,x=50,fill=clr3,stroke="none")|repeat(36,rotate(10))
e4=ellipse(w=40,h=14,x=50,fill="#ce2924",stroke="none")|repeat(36,rotate(10))
show(e3+e4)

c3=circle(r=65,x=0,y=0,fill="#073305",stroke="none")
show(c3)

for i in range(6):
    s=circle(x=0,y=25,r=35,fill="yellow",stroke="none")|rotate(60+(i*60))
    show(s|rotate(90))
for i in range(6):
    s=circle(x=0,y=25,r=25,fill="#073305",stroke="none")|rotate(60+(i*60))
    show(s|rotate(90))

#creating semicircles(rohit tp's code)
import math
def semi(w,h,theta):
    return point(math.sin(theta)*(w),math.cos(theta)*h)

points=[point(0,0)]
w=11
h=25
part=0.5
step=0.01
i=0
while i < (3.14*(part*2)):
    points.append(semi(w,h,i))
    i=i+step
def e():    
    s1=polygon(points,fill="#ff5f14",stroke="none")|rotate(180)|translate(x=0,y=25)
    s2=polygon(points,fill="yellow",stroke='none')|translate(x=0,y=25)
    return s2+s1
for i in range(6):
    elip=e()|rotate(60+(i*60))
    show(elip)

#innermost design
def eli(h,w,color):
    e=ellipse(h=h,w=w,fill=color,stroke="none")|repeat(6,rotate(60))
    return e
sc=circle(r=5,fill="#db2146",stroke="none")
e1=eli(45,5,"white")|rotate(90)
e2=eli(30,5,"#6e962d")
e3=eli(75,8,"#a92900")
show(e3+e2+e1+sc)