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
random concentric squares with random Stroke colours
By
Devjith P
Run
def make_grid(n): width = 300 d = width/n xstart = -width/2 + d/2 ystart = width/2 - d/2 shapes = [] for i in range(n): for j in range(n): x = xstart + d*j y = ystart - d*i shape = make_shape(d) | translate(x=x, y=y) shapes.append(shape) return combine(shapes) def make_shape(width): return random_concentric_square(n=10, max_radius=0.8*(width/2)) def random_concentric_square(n, max_radius): shapes = [] for i in range(n): fill=color(r=rand_col(),g=rand_col(),b=rand_col()) r = random(max_radius) c = rectangle(h=2*r,w=2*r,stroke=fill) shapes.append(c) return combine(shapes) def rand_col(): return random(0,225) shape = make_grid(6) background_=rectangle(h=300,w=300,fill="black",stroke="none") show(shape)
Comments
Want to discuss?
Post it here, our mentors will help you out.
Login