Pookkalam by Biju J

Code

def c(r,col):
    a = circle(x=0, y=0, r=r, stroke_width=0, fill=col)
    show(a)

def e(r,n,col):
    a=ellipse(y=r/2, w=r/3, h=r, stroke_width=0, fill=col)
    b=a | repeat(360/n,rotate(n))
    show(b)

def r(r,n,col):
    s=1.414*r
    a=rectangle( w=s, h=s, stroke_width=0, fill=col)
    b=a | repeat(360/n,rotate(n))
    show(b)

c(150,"#0d6b4d")
r(150,10,"white")
c(140,"yellow")
e(140,30,"orange")

c(90,"red")
r(90,45,"#0d6b4d")
c(70,"#ffffac")

d1 = circle(r=7,x=115,y=30,fill="violet", stroke_width=4,stroke="green")|repeat(12,rotate(30))
show(d1)
def flow():
    h1 = circle(x=15,y=10,r=20,stroke_width=0,fill="red")
    h2 = circle(x=-15,y=10,r=20,stroke_width=0,fill="red")
    hp1 = point(x=-33, y=0)
    hp2 = point(x=0, y=-40)
    hp3 = point(x=33, y=0)
    h3= polygon([hp1,hp2,hp3],stroke_width=0, fill="red")
    hl = combine([h1,h2,h3])
    hk= hl|translate(y=30) |repeat(4,rotate(90))
    c = circle(r=20,fill="yellow",stroke="black")
    h = hk + c
    hr=h|scale(0.2)|translate(y=110)|repeat(12,rotate(30))
    heart = hr|repeat(12,rotate(30))
    show(hr)
flow()

def umb():
    e= ellipse(x=-11, w=100,h=90, stroke="#c98f50",stroke_width= 3,fill="yellow")
    a1= line(x1=-60,y1=0, x2=0,y2=0, stroke="#c98f50",stroke_width=5)|repeat(7,rotate(30) | scale(.9))
    a2=a1 |scale(y=-1)
    a=a1+a2
    u=e+a
    xx=u |scale(.6)|translate(x=10,y=40)|rotate(-20)
    show (xx)
    p1 = point(x=-40,y=-100)
    p2 = point(x=-20,y=70)
    p3 = point(x=20,y=70)
    p4 = point(x=40,y=-100)
    m = polygon([p1,p2,p3,p4],fill="#c72e48")
    f1 = ellipse(x=0,y=0,w=40,h=15,fill="#ff087f", stroke_width=0)|repeat(12,rotate(30))|translate(y=80)
    m=m+f1
    m1 =m |scale(.8)|translate(y=-20,x=-70)
    m2=m |scale(.8)|translate(y=-20,x=70)
    mb=rectangle(x=0,y=-100,w=250,h=50,fill="#c72e48")
    ma=m+m1+m2+mb
    maveli=ma |scale(.4) |translate(y=0)
    show(maveli)
    b1= line(x1=0,y1=0, x2=-10,y2=-70,stroke="#c98f50",stroke_width=7)
    bb=b1|scale(.6)|translate(x=10,y=40)|rotate(-17)
    show(bb)

ma=umb()
show(ma)



def vilakku():
    p1 = point(x=0, y=100)
    p2 = point(x=10, y=75)
    p3 = point(x=5, y=60)
    p4 = point(x=5, y=50)
    p5 = point(x=50, y=50)
    p6 = point(x=60, y=60)
    p7 = point(x=40, y=40)
    p8 = point(x=50,y=30)
    p9 = point(x=5, y=30)
    p10 = point(x=15, y=-50)
    p11 = point(x=50, y=-50)
    p12 = point(x=50, y=-55)
    p13 = point(x=45, y=-55)
    p14 = point(x=60, y=-70)
    p15 = point(x=0, y=-70)

    half1 = polygon([p1, p2, p3, p4, p5, p6,p7, p8, p9, p10, p10, p11, p12, p13, p14, p15], 
                    fill="#e9ba00",stroke="none")
    deepam = ellipse(x=-55, y=58, w=10, h=20, stroke="#ffe313",stroke_width=3, fill="#fdfd54") | repeat(3,translate(x=55))
    half2 = half1 | scale(x=-1)
    villaku = half1 + half2 + deepam
    return villaku

v = vilakku()
v=v| scale(.3)| translate(x=-35,y=-30)|repeat(3,translate(x=35))
show(v)

print("HAPPY ONAM")