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
The Joy of Programming
Getting Started
A gentle introduction to programming.
Hello, Joy!
Hello, Python!
Drawing Shapes
Write small programs to draw simple shapes.
Drawing Circles
Positioning Shapes
Rectangles and Ellipses
Lines and Polygons
Styles
Add colors and styles to the shapes.
Basic Styles
The Web Colors
Creating Colors
Combining Shapes
Combine two or more shapes to create new shapes.
Combining Two Shapes
Combining Many Shapes
Transformations
Apply transformations like translate, rotate and scale to create new shapes.
Translate
Rotate
Scale
Repeat
Composition
Composing new shapes by defining functions.
Functions
Functional Composition
Repetition & Variation
Create repetition and variation in sketches using loops and conditionals.
The For Loop
Repeating Shapes
Thinking in Loops
Making Grids
Conditional Expressions
Generating
Write programs that generate a new drawings everytime they are run.
Randomness
Generative Art
More Generative Art
Not Available for Preview
This lesson is not available for preview. Please join the course to access it.
All Courses
The Joy of Programming
Generative Art
Generative Art
Anand Chitipothu
Oct 11, 2021
There is no preview available for this lesson. Please join the course to access it. Click
here
to enroll.
Previous Lesson
Next Lesson
Ask a Question
×
Questions
JE
answer for 8.6
Joswin Emmanuel
3 years ago
6
answer for 8.6
JE
Joswin Emmanuel
3 years ago
Post
Dismiss
coord=[-125,-75,-25,25,75,125] for i in coord: for j in coord: for _ in range(10): n=random(40) show(rectangle(i,j,n,n))
coord=[-125,-75,-25,25,75,125] for i in coord: for j in coord: for _ in range(10): n=random(40) show(rectangle(i,j,n,n))
DP
Dhanush P N
3 years ago
Post
Dismiss
##8.5 ```python def make_shape(width): if random(1) < 0.5: return circle(r=width/2) + ellipse(w=width/2, h=width) else: return circle(r=width/2) + ellipse(w=width, h=width/2) ```
##8.5 ```python def make_shape(width): if random(1) < 0.5: return circle(r=width/2) + ellipse(w=width/2, h=width) else: return circle(r=width/2) + ellipse(w=width, h=width/2) ```
DP
Dhanush P N
3 years ago
Post
Dismiss
##8.6 ```python def make_shape(width): return random_concentric_squares(n=10, max_size=width) def random_concentric_squares(n, max_size): shapes = [] for i in range(n): s = random(max_size) c = rectangle(w=s, h=s) shapes.append(c) return combine(shapes) ```
##8.6 ```python def make_shape(width): return random_concentric_squares(n=10, max_size=width) def random_concentric_squares(n, max_size): shapes = [] for i in range(n): s = random(max_size) c = rectangle(w=s, h=s) shapes.append(c) return combine(shapes) ```
NF
Niya Farhaan
3 years ago
Post
Dismiss
here's a nice pattern 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): r=random(1) if r < 0.5: return random_concentric_squares(n=10, max_side=width*0.8) else: return random_concentric_circles(n=10, max_radius=width*0.8/2) def random_concentric_squares(n, max_side): shapes = [] for i in range(n): w = random(max_side) h=w c = rectangle(w=w,h=h) shapes.append(c) return combine(shapes) def random_concentric_circles(n, max_radius): shapes = [] for i in range(n): r = random(max_radius) c = circle(r=r) shapes.append(c) return combine(shapes) shape = make_grid(6) show(shape)
here's a nice pattern 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): r=random(1) if r < 0.5: return random_concentric_squares(n=10, max_side=width*0.8) else: return random_concentric_circles(n=10, max_radius=width*0.8/2) def random_concentric_squares(n, max_side): shapes = [] for i in range(n): w = random(max_side) h=w c = rectangle(w=w,h=h) shapes.append(c) return combine(shapes) def random_concentric_circles(n, max_radius): shapes = [] for i in range(n): r = random(max_radius) c = circle(r=r) shapes.append(c) return combine(shapes) shape = make_grid(6) show(shape)
NF
Niya Farhaan
3 years ago
Post
Dismiss
ok that backfired
ok that backfired
KL
Khadeeja lubaba
3 years ago
Post
Dismiss
Exercise 8.5?
Exercise 8.5?
Want to discuss?
Post it here, our mentors will help you out.
Login