Pookkalam by Ashish Abraham

Code

"CODE-A-POOKALAM TINKERHUB"

#Creating the prerequisites

#function to create squares
def square(color, side):
    return rectangle(w=side, h=side, fill=color, stroke='none')

# TinkerHub logo
def thb_logo():
    r1 = rectangle(w=105, h=50, fill='#2CC0CF', stroke='none', x=-45, y=70) 
    r2 = rectangle(w=50, h=50, fill='#2078F9', stroke='none', x=50, y=70)
    layer1 = r1 + r2
    layer2 = rectangle(w=175, h=50, fill='#FECD3D', stroke='none', x=-12, y=0) 
    r1 = rectangle(w=70, h=50, fill='#EE3C35', stroke='none', x=-65, y=-70) 
    r2 = rectangle(w=42, h=50, fill='#91BF23', stroke='none', x=0, y=-70) 
    r3 = rectangle(w=42, h=50, fill='#045768', stroke='none', x=52, y=-70) 
    layer_three = r1 + r2 + r3
    return combine([layer1, layer2, layer_three]) | scale(0.14) | translate(x=2)

#START DRAWING
main_circle = circle(r=152,fill='#CD2626',stroke="none")
show(main_circle)

# creating outerlayer with outer_layer_data
outer_layer_data = [ {"side":212.5, "color":'orange'}, {"side":196, "color":'#F8E63D'}, {"side":182, "color":'#E3BD36'}, {"side":168, "color":'#F36636'}, {"side":155, "color":'#a92822'} ]
outer_layer=[]
for i in outer_layer_data:
    if(outer_layer_data.index(i) % 2 == 0 ):
        layer = square(side=i['side'], color=i['color']) | rotate(5) | repeat(10,  rotate(10)) 
    else:
        layer = square(side=i['side'], color=i['color']) | repeat(10,  rotate(10)) 
    outer_layer.append(layer)
show(combine(outer_layer))


c1 = circle(r=100,fill='#FFD700',stroke='none')
c2 = circle(r=95,fill='#c2c200',stroke='none')
c3 = circle(r=22,fill='white',stroke='#9e0808',stroke_width=3)
show(c1,c2)

red_layer = square(side=105,color='#FF0000') | repeat(3,  rotate(30))
white_layer = square(side=136,color='#FEFDF3') | repeat(3,  rotate(30))
show(red_layer,white_layer)

r1 = square(side=137,color='yellow') | repeat(20,rotate(30))
r2 = square(side=65,color='#7d1004') | repeat(20,rotate(30))
r3 = square(side=79,color='brown')  | rotate(20)| repeat(10,rotate(30))
r4 = square(side=112,color='orange') | rotate(45)| repeat(20,rotate(30))
r5 = square(side=90,color='#FF0000') | rotate(30)| repeat(20,rotate(30))
r6 = square(side=70,color='#FF4500') | rotate(45)| repeat(20,rotate(30))
r7 = square(side=57,color='#E3CF57') | rotate(30)| repeat(20,rotate(30))
show(r1,r2,r3,r4,r5,r6,r7)

e1 = ellipse(w=30,h=17,x=20,y=0,stroke='#9e0808',stroke_width=3,fill="#FF3030") | rotate(22.5)
flower = e1 | repeat(9, rotate(45))
show(flower,c3,thb_logo())

print("\t.....Keep Tinkering.....\n\t\tHAPPY ONAM")