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
2
RGB Everywhere
By
Samrudh N
Run
#RGB everywhere #no of iterations n=25 #function to generate random locations. def random_loc(shape): temp = shape |scale(random(0.1,1)) |translate(random(-150,150), random(-150,150)) show(temp) white_background = rectangle(w=300,h=300, fill="white", stroke="none") green_rectangle = rectangle(w=100,h=100,fill=color(r=0,g=255, b=0, a=0.5), stroke="none") red_rectangle = rectangle(x=-10,y=-10,w=100,h=100,fill=color(r=255,g=0, b=0, a=0.5), stroke="none") blue_rectangle = rectangle(x=10,y=10,w=100,h=100,fill=color(r=0,g=0, b=255, a=0.5), stroke="none") output = red_rectangle + green_rectangle + blue_rectangle show(white_background) for i in range(n): random_loc(output)
Comments
Want to discuss?
Post it here, our mentors will help you out.
Login