Exercises: for, mouse, variables

Exercise 1

Reproduce the drawing below using one for loop:


10 lines, 500×500 px canvas.

Tips:
.Don’t start coding! Break down the problem on paper first
.Consider using a variable for the lines coordinates like startX, startY and endX, endY.
.Try to draw parallel lines first

Exercise 2

Reproduce the dynamic sketch below:

20 lines on each side, 500×500 px canvas.

Exercise 3

Reproduce the drawing below using nested for loops:


9×9 circles. 50px of distance between the centers, 500×500 px canvas.
The circles gradually fade to black.

Tips:
. break down the problem in different sub-problems
. make a tiling of identical circles first
. implement a variable diameter and figure out a relation with the index variable
. do the same with the alpha channel

Posted in

Post a comment