Code
def OvalPetal(x,y,w,h,n_repeat,colour):
n_diff=360/n_repeat
n=n_diff
for i in range(n_repeat):
e=ellipse(x=x,y=y,w=w,h=h,stroke="#ffdee0",stroke_width=".5",fill=colour)
petal=e|rotate(n)
show(petal)
n=n+n_diff
def Lotus(w,h,x):
if w<0 or h<0:
return
OvalPetal(0,0,w,h,8,colour=color(r=254, g=int(121-3*h), b=int(197-3*h)))
return Lotus(w-15,h-7,0)
# creating bg
main_bg=rectangle(w=300,h=300,fill="black")
show(main_bg)
# Recurssive functions for gradient effect on outer edge
def shade_petal(petal,s):
if s<0:
return petal
petal=ellipse(x=25,y=0,w=50,h=25,fill=color(r=int(125-100*s), g=int(227-100*s),b=3),stroke="none")|repeat(2,rotate(15))
petal=petal|scale(s)
return petal+shade_petal(petal,s-0.1)
p1=(shade_petal(circle(stroke="none"),1))
p2=ellipse(x=25,y=0,w=50,h=25,fill="#fb4c04",stroke="none")|repeat(2,rotate(15))|rotate(270)
p3=ellipse(x=25,y=0,w=50,h=25,fill="#ffbe00",stroke="none")|repeat(2,rotate(15))|rotate(180)
petal=combine([p1,p2,p3])
# Spiral petals on outer edge
ww=54
petal5=circle(stroke="none")
petal1=ellipse(x=25,y=0,w=ww,h=ww/2,fill="white",stroke="none")
petal1=petal1|repeat(2,rotate(15))|repeat(4,rotate(90))
petal5=combine([petal1,petal])
petal5=petal5|translate(x=100,y=0)
spiral_flower1 = petal5| repeat(36*4, rotate(10)|scale(0.97))
spiral_flower2=spiral_flower1|scale(.5)
spiral_flower3=spiral_flower2|translate(x=-105,y=0)
spiral_flower4=spiral_flower3|repeat(10,rotate(360/10))
show(spiral_flower4)
#Oval petalflower layer-fairy land theme;)
def Gradient_petal(w,h,x):
petal=ellipse(x=x,y=0,w=w,h=h,fill=color(r=int(43+100*w/h), g=0, b=255),stroke="none")
if w<0 or h<0:
return petal
return petal+Gradient_petal(w-5,h-.5,x)
petal=(ellipse(w=100,h=50,stroke="white",fill="white",stroke_width=3)+Gradient_petal(100,50,0))|translate(x=-25,y=0)
petal1=petal|scale(y=.6)|repeat(10,rotate(360/10))|repeat(2,rotate(18))
pollen=(line(x1=0,y1=0,x2=25,y2=0,stroke="#f1b600")+circle(x=25,y=0,r=5,fill="#e18fff",stroke="white"))|scale(.9)|repeat(15,rotate(360/15))
flower=(petal1|scale(.8))+(circle(r=20,fill="#efff73",stroke="white",stroke_width=1)+pollen)|scale(1.3)
flower1=flower|scale(.4)
flower2=flower1|translate(x=100,y=0)|repeat(15,rotate(360/15))
flower4=flower2
for i in range(5):
flower4=flower4|rotate(15)|scale(.82)
show(flower4)
# Creating a bg for lotus ;) Green square design
l=80
green_bg=[]
for i in range(1,4):
green_r=rectangle(w=l,h=l,fill=color(r=int(255-i*20),g=255,b=int(255-i*50)),stroke="#61fc00",stroke_width=.3)#887800
green_rect=green_r|repeat(60,rotate(360/60))
green_rect=green_rect|scale(1-i*.05)
green_bg.append(green_rect)
g_bg=combine(green_bg)
show(g_bg)
Lotus(100,50,0)
# Generating Pollen grain for Lotus on centre
pollen_bg=circle(r=9,fill="white",stroke="none")
show(pollen_bg)
shape = circle(x=5, y=0, r=4, stroke="#ffc800",stroke_width=.3) | repeat(30, rotate(360/30))
show(shape)