Pookkalam by Ramsheed Dilhan

Code

show(rectangle(h=500,w=500,fill='white'))


#THE OUTER SPIRAL


show(rectangle(h=300,w=300,fill="white",stroke="none"))
c = circle(r=100,fill="#96ceb4",stroke="none")
c2 = circle(r=90,fill="white",stroke="none")
c2 = c2 | scale(y=1.12)
shape = c + c2
shape = (shape | scale(5))
show(shape)
for i in range(160):
    shape = (shape | scale(0.9)|rotate(60))
    show(shape)


# THE ZIG-ZAG CIRCLE


r1 = rectangle(w=200,h=200,fill='#d96459',stroke='none') | repeat(10, rotate(10))
r2 = rectangle(w=185,h=185,fill='#ff6f69',stroke='none') | rotate(5) | repeat(10, rotate(10))
r3 = rectangle(w=171,h=171,fill='#f2ae72',stroke='none') | rotate(10) | repeat(10, rotate(10))
r4= rectangle(w=158,h=158,fill='#ffcc5c',stroke='none') | rotate(15) | repeat(10, rotate(10))
r5= rectangle(w=146,h=146,fill='#f2e394',stroke='none') | rotate(20) | repeat(10, rotate(10))
r6= rectangle(w=130,h=130,fill='#ffeead',stroke='none') | rotate(25) | repeat(10, rotate(10))
r7= rectangle(w=120,h=120,fill='#588c7e',stroke='none') | rotate(30) | repeat(10, rotate(10))
r8= rectangle(w=120,h=120,fill='#96ceb4',stroke='none') | rotate(30) | repeat(10, rotate(10))
r=combine([r1,r2,r3,r4,r5,r6,r7,r8])
show(r | scale(1.08))


# THE INNER SPIRAL

#show(rectangle(h=300,w=300,fill="white",stroke="none"))
c = circle(r=85,fill="#96ceb4",stroke="none")
c2 = circle(r=75,fill="white",stroke="none")
c2 = c2 | scale(y=1.12)
shape = c + c2
#shape = (shape | scale(5))
show(shape)
for i in range(160):
    shape = (shape | scale(0.9)|rotate(60))
    show(shape)

    
    
    
#########################################################


# THE STACK OF SQUARES

def tri(x1,y1,x2,y2,x3,y3,fill,stroke):
    p1 = point(x=x1,y=y1)
    p2 = point(x=x2,y=y2)
    p3 = point(x=x3,y=y3)
    shape = polygon([p1,p2,p3],fill=fill,stroke=stroke)
    return shape

def cir(r,fill,stroke):
    shape = circle(r=r,fill=fill,stroke=stroke)
    return shape



k=1
u=0
v=0.001
list1 = ['#d96459','#f2ae72','#f2e394','#588c7e']
list2 = ['#ff6f69','#ffcc5c','#ffeead','#96ceb4']

for i in list1:
    j = list2[u]
    
    shape2 = tri(-50,-50,-50,-25,-37.5,-37.5,i,i)
    shape2=(shape2 | repeat(4,rotate(90)))
    
    shape1 = tri(0,0,-50,0,-50,50,i,i) 
    shape1=(shape1 | repeat(4,rotate(90)))

    

    ############################################
    
    shape4 = tri(0,50,0,70.71,25,50,j,j)
    shape4 =(shape4 | repeat(4,rotate(90)))

    shape3 = tri(0,0,-37.5,37.5,0,70.71,j,j)
    shape3 = (shape3 | repeat(4,rotate(90)))

    

    shape = combine([shape1,shape2,shape3,shape4])
    shape =(shape | scale(k))
    show(shape | rotate(v))
    v=v+0.001
    k=k-0.1
    u=u+1