Explore
Courses
Batches
Sketches
Statistics
Code a Pookkalam
Jobs
Devsprint
People
Course Creation
Create a Course
Guidelines
Resources
Support
Blogs
My Profile
About Us
Login
Sketches
0
New Sketch
By
Sreyas M Pillai
Run
#ball def ball(color): c1=circle(r=50,fill='dark'+ color,stroke='none') c2=circle(r=42,fill=color,stroke='none') c3=circle(r=35,fill='white',stroke='none') c4=ellipse(w=68,h=80,fill=color,stroke='none') | translate(x=-5) r=rectangle(x=0,y=50,w=30,h=20,fill='yellow',stroke='none') e1=circle(x=0,y=60,r=7,fill='yellow',stroke='none') e2=circle(x=0,y=60,r=4,fill='white',stroke='none') b=e1+e2+r+c1+c2+c3+c4 return b #tree def tree(): P1=point(x=0, y=100) P2=point(x=-50,y=-50) P3=point(x=50,y=-50) s=polygon([P1,P2,P3],fill='green',stroke='none') r=rectangle(w=3,fill='white',h=3,stroke='none') r1=r | repeat(10,translate(y=10)) | translate(x=29) | rotate(17.5) r2=r | repeat(7,translate(y=-10)) | translate(x=29) | rotate(18.8) r3=r1+r2 r4=r3 | scale(-1) | rotate(-36) | translate(x=10,y=29) r5=r3 | rotate(-28) | translate(x=-48,y=8) | scale(0.8) r6=r5 | scale(x=-1) r7=r5 | rotate(10) | translate(x=15) s1=polygon([P1,P2,P3],fill='green',stroke='none') | scale(0.2) | translate(y=-55) t=s1+s+r1+r2+r4+r5+r6+r7 return t for i in range(160): red=color(r=0,g=i+10,b=i+160) c=circle(x=0, y=0, fill=red, r=250-i, stroke="none") show(c) e1=ellipse(x=-80,y=-120,fill='white',stroke='none')| rotate(5) e2=ellipse(x=50,y=-120,fill='white',stroke='none') | rotate(0) e3=ellipse(x=-160,y=-90,w=50,h=100,fill='white',stroke='none') |rotate(12) e4=ellipse(x=140,y=-130,fill='white',stroke='none') | rotate(5) show(e1,e2,e3,e4) t1=tree() | scale(0.5) | translate(x=120,y=-50) t2=tree() | scale(0.8) | translate(x=-100,y=-65) b1=ball('orange') | scale(0.2) | translate(x=-80,y=-2) b2=ball('red') | scale(0.18) | translate(x=-50,y=-2) b3=ball('blue') | scale(0.16) | translate(x=-23,y=-4) b4=ball('green') | scale(0.14) | translate(x=0,y=-4.8) b5=ball('violet') | scale(0.12) | translate(x=22,y=-4.5) b6=ball('orange') | scale(0.10) | translate(x=40,y=-3.8) b7=ball('red') | scale(0.08) | translate(x=56,y=-3.5) b8=ball('blue')| scale(0.07) | translate(x=70,y=-3.5) b9=ball('green') | scale(0.06) | translate(x=85,y=-3.5) b10=ball('violet') | scale(0.05) | translate(x=97,y=-3.5) b11=ball('orange') | scale(0.05) | translate(x=108,y=-3.8) b12=ball('red') | scale(0.045) | translate(x=117,y=-3.8) l1=line(x1=-100,y1=14,x2=0,y2=6) l2=line(x1=0,y1=6,x2=120,y2=0) show(t1,t2,b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,l1,l2) #sun def sun(): for i in range(100): sun=color(r=i+255,g=i+165,b=i+0) #moon=color(r=i+244,g=i+241,b=i+201) s=circle(x=0, y=0, fill=sun, r=30-i, stroke="none") return s #cloud def cloud(): e=ellipse(fill='white',stroke='none') e4=ellipse(w=250,h=100,fill='white',stroke='none') e1=e|rotate(35) e2=e|rotate(-35) e3=ellipse(w=100,h=180,fill='white',stroke='none') c=e4+e1+e2+e3 return c s=sun() | scale(0.7) | translate(x=-80,y=100) c1=cloud() | scale(0.25) | translate(x=-70,y=78) c2=cloud() | scale(0.2) | translate(x=-105,y=95) c3=cloud() | scale(0.15) | translate(x=105,y=110) c4=cloud() | scale(0.3) | translate(x=150,y=110) show(s,c1,c2,c3,c4) #bird def bird(): e1=ellipse(w=5,h=30,fill='black') | rotate(40) e2=e1 | rotate(-80) | translate(x=10) b=e1+e2 return b b1=bird() | scale(0.3)| translate(x=100,y=88) b2=bird() | scale(0.25)| translate(x=115,y=88) b3=bird() | scale(0.25)| translate(x=108,y=83) b4=bird() | scale(0.2)| translate(x=123,y=83) show(b1,b2,b3,b4) #star e1=ellipse(w=5,h=19,fill='yellow',stroke='none')|repeat(3,rotate(60))|translate(-100,15) e2=e1 | translate(340,-15) | scale(0.5) show(e1,e2) #giftbox def gift(fill1,fill2): q=rectangle(w=25,h=25,stroke_width=1,fill=fill1) + rectangle(y=15,h=6,w=33,stroke_width=1,fill=fill1) + rectangle(y=3,h=30,w=7,stroke_width=2,fill=fill2,stroke='none') q1=q | translate(-130,-139) q2=ellipse(w=5,h=19,fill=fill2,stroke='none')|rotate(60)|translate(-140,-117) q3=q2|scale(x=-1)|translate(x=-263) return combine((q1,q2,q3)) #snow def grid(n): c_width = 300 width = 300 / n xstart = -150 + width/2 ystart = -150 + width/2 shapes = [] for i in range(n): for j in range(n): x = xstart + width * i y = ystart + width * j s = spheroid(300//n) | translate(x=x, y=y) | rotate(random(180)) shapes.append(s) return combine(shapes) def spheroid(r): shapes = [] for i in range(10): shapes.append(circle(r=1, fill='white',stroke='none')) return combine(shapes) show(grid(13)) #panda e=ellipse(w=55,h=30,fill='white',stroke='none') a=e | translate(y=5) s=ellipse(w=50,h=36,fill='black')+ e + a t=s | translate(y=75) w=t | translate(x=0,y=-45) l1=line(x1=0,y1=0,x2=0,y2=16) l2=l1 | translate(y=15) l3=l2 | translate(x=0.3) o=ellipse(y=35,w=20,h=10,fill='black') q=ellipse(w=30,h=25,fill='black') r=q | translate(x=-5,y=60) p=r | rotate(20) c1=circle(r=8,fill='white',stroke='none') c2= c1 | translate(x=-18.7,y=57) c3=circle(r=4,fill='black') c4= c3 | translate(x=-18,y=57) c5=p+c2+c4 c5=c5 | rotate(-2) c6=c5 | scale(x=-1) d=ellipse(x=35,y=-30,w=25,h=70,fill='black') | rotate(70) | translate(x=20,y=-25) e=ellipse(x=-35,y=-30,w=25,h=70,fill="black") | rotate(-70) | translate(x=-20,y=-25) f=ellipse(x=23,y=-75,w=35,h=70,fill="black") g=ellipse(x=-23,y=-75,w=35,h=70,fill="black") c=ellipse(x=0,y=-25,w=90,h=110,fill='black')+ ellipse(x=0,y=-25,w=83,h=103,fill='white')+ellipse(x=0,y=50,w=110,h=100,fill='black')+ellipse(x=0,y=50,w=106,h=96,fill='white') el1=ellipse(w=38,h=30,fill='black') | translate(x=-20,y=103) el=el1 | rotate(12) el2=el | scale(x=-1) teddy = combine([el,el2,d,e,f,g,c,w,l2,l3,o,c5,c6]) panda=teddy | scale(0.3) | translate(-40,-47) show(panda) g1=gift("red","yellow") | translate(85,60) | rotate(-5) g2=gift("blue","gold") | translate(98,68) | rotate(5) show(g2,g1)
Comments
Want to discuss?
Post it here, our mentors will help you out.
Login