CHAPTER 9

Repetition

In this chapter we have made use of the knowledge that a composition may be generated not only from a limited vocabulary, but that there may also be regular repetition of vocabulary elements.


- The Compositional Uses of Repetition:

9.5 Stairs

Screen_Shot_2013-08-08_at_1.04.29_AM.png

  1. void setup(){
  2. size(800,600);
  3. }
  4.  
  5. void draw(){
  6.  
  7. int length1 = 200;
  8. int width1 = 50;
  9.  
  10. int x_increment = 50;
  11. int y_increment = 50;
  12. int num_of_steps = 10;
  13.  
  14. int x = 50;
  15. int y = 50;
  16.  
  17. for(int i = 1; i <= num_of_steps; i++){
  18. rect(x,y,length1,width1);
  19. x += x_increment;
  20. y += y_increment;
  21. }
  22. }

Comments

Posted by Alexandre Villares on
The same on Processing Python Mode:


def setup():
size(800,600)

def draw():
length1 = 200
width1 = 50

x_increment = 50
y_increment = 50
num_of_steps = 10

x = 50
y = 50

for i in range(num_of_steps):
rect(x,y,length1,width1)
x += x_increment
y += y_increment
Posted by Alexandre Villares on
def setup():
□ □ □ □ size(800,600)
□ □ □ □
def draw():
□ □ □ □ length1 = 200
□ □ □ □ width1 = 50
□ □ □ □
□ □ □ □ x_increment = 50
□ □ □ □ y_increment = 50
□ □ □ □ num_of_steps = 10
□ □ □ □
□ □ □ □ x = 50
□ □ □ □ y = 50
□ □ □ □
□ □ □ □ for i in range(num_of_steps):
□ □ □ □ □ □ □ □ rect(x,y,length1,width1)
□ □ □ □ □ □ □ □ x += x_increment
□ □ □ □ □ □ □ □ y += y_increment
Leave a Reply



(Your email will not be publicly displayed.)


Captcha Code

Click the image to see another captcha.