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
Ball Crusher 3D 1000KN
By
Aditya Aravind
Run
from math import sin def genBars(h=100, r=240, g=20, b=20, w=20): lines = line(x1=0,y1=0,x2=0,y2=0) w *= 2 step = 3.14 / w for i in range(w): val = step * (i + 1) xStep = i / 2 sVal = max(pow(sin(val), 0.5), 0.1) clr = color(r * sVal, g * sVal , b * sVal) lines += line(x1=xStep, x2=xStep, y1=0,y2=h, stroke=clr, fill=clr) return lines def genSphere(n=80, r=230, g=20, b=20): step = 1/n cir = circle(r=0) for i in range(n): val = step * (i + 1) sVal = max(pow(val, 0.25), 0.1) clr = color(r * sVal, g * sVal , b * sVal) cir += circle(r=100, fill=clr, stroke=clr) | scale(1 - val) return cir sphere = genSphere() | scale(0.5) | translate(y=10) sphere2 =sphere |translate(x=-90) sphere3 = sphere| translate(x=25) | scale(y=0.8, x=1.2) tube = genBars(w=60, r=20, g=200) | translate(y=-150) tubeTop = genBars(w=80, r=100, g=150, h = 20) | translate(x=-10, y=-50) holder = tube + tubeTop holder2 = holder | translate(x=-120) holder3 = holder | rotate(180) | translate(x=-63, y=25) holder4 = holder | rotate(180) | translate(x=60, y=10) arr= sphere2 + sphere3 + holder + holder2 + holder3 + holder4 show(arr)
Comments
Want to discuss?
Post it here, our mentors will help you out.
Login