Pookkalam by Amal Chandran M V

Code

#Dedicated to our beloved frontline workers..A Big Salute

#constants
middleLine = line(x1 = 0, y1 = -15, x2 = 0, y2 = -70 )

#functions

def earth(x, y):
    p1 = point(x = x + 50, y = y + 50)
    p2 = point(x = x + 20, y = y + 30)
    p3 = point(x = x -10, y = 0)
    p4 = point(x = x -30, y = y -30)
    p5 = point(x = x + 70, y = 0)
    c1 = circle(r = 75,x=x, y=y, fill="#6b93d6", stroke = "blue")
    c2 = circle(r = 25, x = x+30, y = y+35, fill="#114f21", stroke="none")
    c3 = circle(r = 25, x = x+30, y = y+30, fill="green", stroke="none")
    
    continents = polygon([p1, p2, p3, p4, p5], fill="#35ea20", stroke="none")
    continents1 = continents | translate(x = -45, y = 20)
    earth = combine([c1, c2, c3,continents, continents1])
    return earth

def dot(x, y, color):
    c = circle(x=x, y=y, r=5, fill=color, stroke="none")
    return c

def eye(x, y):
    cRight = circle(x= x + 10, y=y, r=2, fill="black")
    eRight = ellipse(x = x + 10, y = y, w = 13, h = 6, fill="white", stroke="brown")
    cLeft = circle(x= x -10, y=y, r=2, fill="black")
    eLeft = ellipse(x = x -10, y = y, w = 13, h = 6, fill="white", stroke="brown")
    
    eye = combine([eRight, cRight,eLeft, cLeft])
    return eye

def mask(x, y, color, d):
    p1 = point(x = x - d, y = y)
    p2 = point(x = x + d, y = y)
    p3 = point(x = x + d, y = y - d)
    p4 = point(x = x, y = y - (d+5))
    p5 = point(x = x - d, y = y - d)
    
    mask = polygon([p1, p2, p3, p4, p5], fill=color, stroke="#3d6972")
    
    return mask

def people(x, y, c):
    face = ellipse(x = x, y = y, w = 30, h = 40, fill = c, stroke="none")
    body = rectangle(x = x, y = y - 50, w = 40, h = 60, fill = c, stroke="none")
    
    people = combine([face, body])
    return people

def hand(x,y,d):
    pt1 = point(x = x + 0, y = y-(d*2))
    pt2 = point(x = x-(d*1.4), y = y+0)
    pt3 = point(x = x + 0, y = y+(d*4))
    pt4 = point(x = x + (d*1.4), y = y+0)
    
    ar1 = point(x = x -(d*2), y = y -(d*4))
    ar2 = point(x = x -(d*4), y = y -(d*4))
    ar3 = point(x = x -d, y = y -d)
    ar4 = point(x = x + (d*2), y = y -(d*4))
    ar5 = point(x = x + (d*4), y = y -(d*4))
    ar6 = point(x = x + d, y = y -d)
    
    finger1 = line(x1 = x-d, y1 = y + 0,x2 = x + 0, y2 = y + (d*3.8), stroke="#705211", a = 0.5)
    finger2 = line(x1 = x + d, y1 = y + 0,x2 = x + 0, y2 = y + (d*3.8), stroke="#705211", a = 0.5)
    finger3 = line(x1 = x -(d*0.8), y1 = y + 0,x2 = x + 0, y2 = y + (d*3.8), stroke="#705211", a = 0.5)
    finger4 = line(x1 = x + (d*0.8), y1 = y + 0,x2 = x + 0, y2 = y + (d*3.8), stroke="#705211", a = 0.5)
    fingers = combine([finger1, finger2, finger3,finger4])
    
    space = line(x1 = x + 0, y1 = y + (d*2),x2 = x + 0, y2 = y -(d*2), stroke="#2b2517", stroke_width="2")
    spaceFiller = rectangle(x = x + 0, y = y-d,w = (d*2), h = (d*2), fill="#0a0101", stroke="none") 
    
    leftPalm = polygon([pt1, pt2, pt3], fill="#f2df65", stroke="#7f3c2d")
    rightPalm = polygon([pt1, pt4, pt3], fill="#f2df65", stroke="#7f3c2d")
    leftArm = polygon([ar1, ar2, ar3, pt1], fill="#f78abf", stroke="none")
    rightArm = polygon([ar4, ar5, ar6, pt1], fill="#f78abf", stroke="none")
    
    palm = combine([spaceFiller, leftPalm, rightPalm, leftArm, 
                    rightArm, space, fingers])
    return palm

def armLeft(x,y,c):
    p1 = point(x = x, y = y)
    p2 = point(x = x - 10, y = y)
    p3 = point(x = x, y = y - 43)
    
    arm = polygon([p1, p2, p3], fill = c ,stroke="none")
    return arm

def armRight(x,y, c):
    p1 = point(x = x, y = y)
    p2 = point(x = x + 10, y = y)
    p3 = point(x = x, y = y - 43)
    
    arm = polygon([p1, p2, p3], fill = c, stroke="none")
    return arm

def heart(x,y):
    firstHalf = ellipse(x=x, y=y, w = 35, h = 50, fill="#f40c27",stroke="none") | rotate(30)
    secondHalf1 = ellipse(x=x, y=y, w = 35, h = 50, fill="#f40c27",stroke="none") | rotate(-30)
    secondHalf = secondHalf1 | translate(x = 20)
    heart = combine([firstHalf, secondHalf])
    return heart

def pocket(x, y, c, s):
    pocket = rectangle(x=x, y=y, w = 20, h = 20, fill=c, stroke=s)
    return pocket

def collar(x, y, c, s):
    p1 = point(x = x-10,y = y)
    p2 = point(x = x-20,y = y)
    p3 = point(x = x-15,y = y - 10)
    
    leftCollar = polygon([p1,p2,p3], fill = c, stroke=s)
    rightCollar = leftCollar | translate(x = 20)
    collar = combine([leftCollar, rightCollar])
    return collar

def coronaVirus(x,y,r,d):
    body = circle(x = x, y = y, r = r, fill="#d6262c")
    spine = line(x1 = x, y1 = r + d,x2 = x, y2 = r - d, stroke="#f4adb0")| repeat(60,rotate(20))
    virus = combine([body, spine])
    return virus

def bandage(x,y):
    b1 = rectangle(x=x, y=y, w = 5, h = 15,fill="#d38b67", stroke="none") | rotate(-40)
    b2 = rectangle(x=x, y=y, w = 5, h = 15, fill="#d38b67", stroke="none") | rotate(40)
    bandage = combine([b1, b2])
    return bandage

def syringe(x,y):
    case = rectangle(x = x, y = y, w = 80, h = 10,fill="#f2f1bf", stroke="none")
    needle = line(x1=x, y1=y, x2= x + 55, y2=y, stroke="#c6bec6")
    back = line(x1=x-58, y1=y, x2= x, y2=y, stroke="#100311", stroke_width=3 )
    base = rectangle(x = x-58, y = y, w = 4, h = 10, fill ="#c6bec6", stroke="#989499")
    return case + needle + back + base

#doctor
hairD = ellipse(x = 0, y = 37.5, w = 45, h = 55, fill="#471306", stroke="none")
headD = ellipse(x = 0, y = 27.5, w = 45, h = 55, fill="#e0c18d", stroke="none")
neckD = rectangle(x = 0, y = -5, w = 10, h = 10, fill="#e0c18d", stroke="none")
bodyD = rectangle(x = 0, y = -38, w = 55, h = 70, fill="#f7f7f4", stroke="none")
eyeD = eye(x = 0, y = 27)
maskD = mask(x = 0, y = 20, color="#d7dcdd", d = 18)
middleLineP = middleLine
lHandD = rectangle(x = -13.75, y = -52, w = 15, h = 80, fill="#f7f7f4", stroke="none")
leftHandD = lHandD | rotate(-25)
rHandD = rectangle(x = 13.75, y = -52, w = 15, h = 80, fill="#f7f7f4", stroke="none")
rightHandD = rHandD | rotate(25)
pocketD = pocket(15,-60,"white","516d8c")
bandageD = bandage(0,0) | translate(x = 12, y = 40)
p1 = point( x = 5, y = -10)
p2 = point( x = -5 , y = -10)
p3 = point(x = 0, y = -45)
tieD = polygon([p1, p2, p3], fill="#103e5e")
l1 = line(x1= 15 , y1= -60, x2= 20 , y2= -40)
e1 = ellipse(x = 20, y = -26, w = 15, h =29)
r1 = rectangle(x = 18, y = -20, w = 20, h = 18, fill="#f7f7f4", stroke="none")
stethoscope = combine([l1,e1,r1])

doctor = combine([hairD, bodyD, headD,leftHandD, 
                  rightHandD, tieD, neckD, eyeD, 
                  maskD, middleLineP,stethoscope, pocketD, 
                  bandageD])

#nurse
capN = rectangle(x = -61, y = 46, w = 50, h = 20, fill="#f7f7f4", stroke="none")
headN = ellipse(x = -60.5, y = 27.5, w = 45, h = 55, fill="#f7dabb", stroke="none")
neckN = rectangle(x = -60, y = -5, w = 10, h = 10, fill="#f7dabb", stroke="none")
bodyN = rectangle(x = -60, y = -38, w = 55, h = 70, fill="#74cbf7", stroke="none")
tieN = tieD | translate(x = -60)
eyeN = eyeD | translate(x = -60)
maskN = maskD | translate(x = -60)
middleLineN = middleLine | translate(x = -60)
lHandN = rectangle(x = -80, y = -26, w = 30, h = 30, fill="#74cbf7", stroke="none")
leftHandN = lHandN | rotate(-5)
rightHandN = leftHandN | translate(x = 60)
leftArmN = armLeft(x = -88, y = -32, c = "#f7dabb" )
pocketN = pocket(-42,-60,"#74cbf7","516d8c")
collarN = collar(-55,-3,"#74cbf7","black")

nurse = combine([headN, capN,leftArmN, bodyN, 
                 neckN, tieN, leftHandN, rightHandN,
                 eyeN, maskN, middleLineN, pocketN, 
                 collarN])

#police
capP = rectangle(x = 60, y = 46, w = 48, h = 20, fill="#916107", stroke="none")
hairP = circle(x = 82, y = 12.5, r = 10, fill="black")
headP = ellipse(x = 60.5, y = 27.5, w = 45, h = 55, fill="#c68c63", stroke="none")
neckP = rectangle(x = 60, y = -5, w = 10, h = 10, fill="#c68c63", stroke="none")
bodyP = rectangle(x = 60, y = -38, w = 55, h = 70, fill="#916107", stroke="none")
eyeP = eyeD | translate(x = 60)
maskP = maskD | translate(x = 60)
middleLineP = middleLine | translate(x = 60)
rHandP = rectangle(x = 80, y = -26, w = 30, h = 30, fill="#916107", stroke="none")
rightHandP = rHandP | rotate(5)
leftHandP = rightHandP | translate(x = -60)
rightArmP = armRight(x = 88, y = -32, c = "#c68c63" )
pocketP = pocket(74,-28,"#916107","black")
collarP = collar(65,-3,"#916107","black")
logoP = circle(x = 60, y = 46, r = 5, fill="#777777", stroke="#352a08")
edgeP = rectangle(x = 60, y = 40, w = 48, h = 5, fill="black", stroke="none")

police = combine([hairP, headP,capP,bodyP,
                  rightArmP, rightHandP, leftHandP, neckP, 
                  eyeP, maskP, middleLineP, pocketP,
                  logoP,edgeP,collarP])

#people
people1 = people(x=-30, y=25, c = "#326977")
maskP1 = mask(x = 30, y = 23, color = "#414443", d = 10)
people2 = people1 | translate(x = -52)
maskP2 = mask(x = -30, y = 23, color = "#414443", d = 10)
people3 = people1 | translate(x = 58)
people4 = people(x=-28, y=30, c = "#93afa7")
people5 = people4 | translate(x = -60, y = 8)
people6 = people4 | translate(x = 111)

maskLayer = combine([maskP1, maskP2])
peopleLayer1 = combine([people1,people2, people3])
peopleLayer2 = combine([people4, people5, people6])
mob = combine([peopleLayer2, peopleLayer1])

#thanks
thankingHand = hand(x = 0, y = 0, d = 8) | translate(y = -80)
loveHeart = heart(0,0) | translate(x = -10, y = -84)

#syringe
syringe = syringe(0,0)|translate(x = 6, y=-94)

#earth
earth = earth(x=0, y=25)
f = dot(x = 0, y = 80, color = "#a6e244")
f1 = dot(x = -5, y = 70, color = "#a6e244")
f2 = dot(x = -10, y = 60, color = "#a6e244")
f3 = dot(x = -15, y = 80, color = "#a6e244")
f4 = dot(x = -15, y = 80, color = "#87dcf2")
f5 = dot(x = 15, y = 80, color = "#87dcf2")
f6 = dot(x = 25, y = 70, color = "#0ba845")

vegetation = combine([f,f1,f2,f3,f4,f5,f6])

#viruses
virus1 = coronaVirus(0,0,15,5) | translate(x = -62,y = 65)
virus2 = coronaVirus(0,0,10,4) | translate(x = 70,y = 60)
virus3 = coronaVirus(0,0,8,3) | translate(x = 10,y = 98)

virus = combine([virus1, virus2, virus3])

#OuterLayer
innerCircle = circle(r = 115, fill="#503a70", stroke="none")
outerlayer1 = circle(r = 118, fill="#160101", stroke="none", a = 0.1)
outerlayer2 = circle(r = 148, fill="#160101", stroke="none")
rect1=rectangle(w=180,h=180,fill="#820a0a",stroke="#a30e0e")|repeat(20,rotate(50))
rect2=rectangle(w=190,h=190,fill="#ce0606",stroke="#e81919")|rotate(15)|repeat(20,rotate(50))
rect3=rectangle(w=200,h=200,fill="#fc9802",stroke="#fc9802")|repeat(20,rotate(50))
rect4=rectangle(w=210,h=210,fill="#fceb02",stroke="#fcfc05")|rotate(15)|repeat(20,rotate(50))|scale(0.98)


#ultimateshow
show(outerlayer2,rect4, rect3, rect2, 
     rect1,outerlayer1,innerCircle,earth,
     vegetation,virus,mob,maskLayer,
     nurse,police,doctor,syringe,loveHeart,
     thankingHand)