Pookkalam by Shazia Shanavas

Code

import math

#colours
orange=color(r=255,g=144,b=0)
spclorange=color(r=255,g=85,b=0)
green=color(r=103,g=176,b=50)
spclgreen=color(r=107,g=240,b=12)
brown=color(r=199,g=145,b=44)
kred=color(r=202,g=0,b=1)
kgreen=color(r=106,g=163,b=28)
grey1=color(r=200,g=200,b=200)
grey2=color(r=150,g=150,b=150)

def flower(x,y):
    f1=circle(r=2,fill="white",stroke="none")
    f2=circle(y=5,r=2,fill="white",stroke="none")|repeat(6,rotate(60))
    f=combine([f1,f2])|translate(x=x,y=y)
    return f

def path(d,f, stroke="none"):
    return Shape("path", d=d, fill=f, stroke=stroke)

def arc(angle,f, **kwargs):
    x = 90 * math.cos(math.radians(angle))
    y = 90 * math.sin(math.radians(angle))
    long_flag = int(angle > 180)
    d = f"M 90 0 A 90 90 0 {long_flag} 1 {x} {y}"
    return path(d,f, **kwargs)

def path2(d, col,wid):
    return Shape("path", d=d, stroke_width=wid, stroke=col)

def arc2(angle, col, wid,**kwargs):
    x = 50 * math.cos(math.radians(angle))
    y = 50 * math.sin(math.radians(angle))
    long_flag = int(angle > 180)
    d = f"M 50 0 A 50 50 0 {long_flag} 1 {x} {y}"
    return path2(d, col, wid, **kwargs)

def sailor(x,y):
    s1=circle(x=x,y=y+4,r=2.7,fill="black")
    s2=ellipse(x=x,y=y-5,w=4,h=12,fill="black")
    l1=rectangle(x=x+3,y=y-2,w=11,h=1.2,fill="black")
    l=rectangle(w=11,h=0.5,fill="black")|rotate(65)
    l2=l|translate(x=x+6,y=y-4)    
    s=combine([s1,s2,l1,l2])
    return s

#background
bc1=circle(r=95,fill="#fff666",stroke=orange)
bc2=circle(r=60,fill=kred,stroke="black")
bc3=circle(r=50,fill="red",stroke="none")
bc4=circle(r=40,fill=orange,stroke="none")
bc5=circle(r=30,fill="yellow",stroke="none")
bc6=circle(r=20,fill="#fff999",stroke="none")
bc7=circle(r=10,fill="white",stroke="none")
bc=combine([bc2,bc3,bc4,bc5,bc6,bc7])|translate(x=90)
newbc=bc|repeat(8,rotate(45))
show(newbc,bc1)

# dance part1
c2=circle(r=90,fill="black")
show(c2)
c1=circle(r=50,stroke="red",stroke_width=2)
c2=circle(r=48,stroke="yellow",stroke_width=2)
c3=circle(r=44,stroke="#B31B1B",stroke_width=6)
c4=circle(y=44,r=2,fill="#FFD700",stroke="none")|repeat(20,rotate(18))
c5=circle(r=40,fill=orange,stroke=green,stroke_width=3)
c6=circle(r=30,stroke="#B31B1B",stroke_width=6)
c7=circle(r=28,fill=spclgreen,stroke="none")
c8=circle(r=23,fill=spclorange,stroke="none")
k1=combine([c1,c2,c3,c4,c5,c6,c7,c8])|scale(x=1.2,y=1.2)

#white flower
wf1=flower(0,35)
wf2=flower(35,0)
wf3=flower(0,-35)
wf4=flower(25,25)
wf5=flower(25,-25)
k2=combine([wf1,wf2,wf3,wf4,wf5])
# dance part2
p1=point(x=0,y=30)
p2=point(x=6,y=15)
p3=point(x=-6,y=15)
t1=polygon([p1,p2,p3],fill="#FFD700",stroke="none")
c21=circle(y=15,r=6,fill="#FFD700",stroke="none")
c22=circle(y=15,r=4,fill="red",stroke="none")
k3=combine([t1,c21,c22])|repeat(10,rotate(36))

#bead
bead1=circle(r=2,fill=orange,stroke="none")
bead2=circle(x=3,r=2,fill=orange,stroke="none")
bead3=circle(x=2,y=3,r=2,fill=orange,stroke="none")
bead4=circle(x=2,y=-3,r=2,fill=orange,stroke="none")
bead=combine([bead1,bead2,bead3,bead4])|translate(y=-85)
nbead=bead|repeat(10,rotate(18))
show(nbead)

#dance part3
e31=ellipse(y=-44,w=80,h=40,fill="#58edbb",stroke="none")
e32=ellipse(y=-44,w=70,h=30,stroke="#e23192",stroke_width=2)
e33=ellipse(y=-44,w=60,h=20,stroke="#e23192",stroke_width=2)
e34=ellipse(y=-44,w=50,h=10,stroke="#e23192",stroke_width=2)
r31=rectangle(y=-48,w=85,h=10,fill=kred,stroke="none")
e35=ellipse(y=-70,w=75,h=60,fill=kgreen,stroke="none")
e36=ellipse(y=-55,w=20,h=25,fill="yellow",stroke="none")
e37=ellipse(y=-55,w=15,h=20,stroke="orange",stroke_width=2)
c31=circle(y=-65,r=2.5,fill="red",stroke=1)
r32=rectangle(x=-25,y=-60,w=15,h=2,fill="black")|rotate(35)
r33=rectangle(x=55,y=-35,w=10,h=2,fill="black")|rotate(325)
eye1=ellipse(x=22,y=-70,w=20,h=6,fill="black")
eye2=ellipse(x=22,y=-68,w=15,h=6,fill="white")
eye3=circle(x=22,y=-68,r=3,fill="blue",stroke="none")
lip1=ellipse(y=-90,w=20,h=6,fill="red",stroke="none")
lip2=ellipse(y=-90,w=20,h=2,fill=kred,stroke="none")
lip3=circle(x=11,y=-90,r=2.5,fill="red",stroke="none")
we1=ellipse(y=-85,w=100,h=60,fill="white",stroke="none")
we2=ellipse(y=-80,w=90,h=55,fill=grey1,stroke="none")
we3=ellipse(y=-75,w=80,h=55,fill=grey2,stroke="none")
k4=combine([we1,we2,we3,e31,e32,e33,e34,e35,e36,e37,c31,r31,r32,r33,eye1,eye2,eye3,lip1,lip2,lip3])
k=combine([k1,k2,k3,k4])|translate(y=27)
ear=newbc|scale(x=0.06,y=0.06)
ear1=ear|translate(x=40,y=-30)
show(k,ear1)

#next half
shape1=arc(180,"#b0d6f5")|rotate(90)
shape2=arc(90,"#56e3a8")|rotate(180)
w=circle(x=-9,r=9,fill="#56e3a8",stroke="none")
wc=w|repeat(5,translate(x=-18))
p1=point(x=0,y=0)
p2=point(x=90,y=0)
p3=point(x=0,y=90)
shape3=polygon([p1,p2,p3],fill="#56e3a8",stroke="none")|scale(x=-1,y=-1)
mp2=point(x=-22.5,y=45)
mp3=point(x=-45,y=0)
show(shape1,wc,shape2,shape3)
wc=circle(r=3,fill="white",stroke="none")
sun1=circle(r=10,fill="#fff999",stroke="none")
sun2=circle(r=9,fill="yellow",stroke="none")
sun3=circle(r=7,fill=orange,stroke="none")
sun4=circle(r=2,fill="red",stroke="none")
sun=combine([sun1,sun2,sun3,sun4])|translate(x=-23,y=70)
show(sun)
wc1=wc|translate(x=-50,y=62)
wc2=wc|translate(x=-54,y=61)
wc3=wc|translate(x=-50,y=61)
wc4=wc|translate(x=-54,y=63)
wc5=wc|translate(x=-52,y=60)
newc=combine([wc1,wc2,wc3,wc4,wc5])|scale(x=2)
newc1=newc|translate(x=70,y=6)
newc2=newc|translate(x=90,y=-15)
show(newc1,newc2)          

#boat
b1=rectangle(x=-25,y=-30,w=48,h=5,fill="black")
b2=rectangle(x=-52,y=-25,w=3,h=6,fill="black")|repeat(3,rotate(2.5))
temp1=circle(r=2,fill="black")
pb1=point(-2,0)
pb2=point(2,0)
pb3=point(0,7)
temp2=polygon([pb1,pb2,pb3],fill="black")
b=combine([temp1,temp2])|rotate(35)
b3=b|translate(x=-50,y=-23)
b=combine([b2,b3])
show(b1,b)

#boat2
b21=rectangle(x=-32,y=-55,w=63,h=6,fill="black")
b22=b|translate(x=-13,y=-25)
show(b21,b22)

x=-42
y=-18
for i in range(3):
    bs=show(sailor(x,y))
    x=x+15
    
x=-55
y=-42
for i in range(4):
    bs=show(sailor(x,y))
    x=x+15

l=72
leaf1=arc2(35,"#328c20",3)|translate(-50,0)
leaf2=leaf1|rotate(60)
leaf3=leaf2|rotate(60)
leaf=arc2(25,"#328c20",3)|translate(-50,0)
leaf4=leaf|rotate(240)
leaf=arc2(19,"#328c20",3)|translate(-50,0)
leaf5=leaf|rotate(300)
t=arc2(60,"brown",5)|rotate(180)
trunk=t|translate(50,0)
tr=combine([trunk,leaf1,leaf2,leaf3,leaf4,leaf5])|translate(66,35)
tree=tr|scale(x=-1)
show(tree)