Skip to content

Computer-Programming-A/RepeatingPattern

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

56 Commits
 
 

Repository files navigation

Create a repeating pattern of shapes using a while loop

In this assignment you will write a program that uses at least one while loop to make many shapes on the screen. You may find slides 84 - 120 in the slide presentation and the while loops worksheet helpful.

Start a new Game Lab program and save it with a meaningful name like RepeatingPattern. You could make a pattern of five circles with the following code:

  noFill();
  ellipse(100, 50, 50, 50);
  ellipse(125, 50, 50, 50);
  ellipse(150, 50, 50, 50);
  ellipse(175, 50, 50, 50);
  ellipse(200, 50, 50, 50);

What if you wanted a pattern of 100 circles? Copying and pasting 100 times is tedious. A better way would be to use a while loop that repeats 100 times. Look at the example program again. Notice that only the x position of each circle is changing. We could create a variable to hold that x position, and use a while loop to make the same five circles:

  noFill();
  var x = 100;
  while (x < 201) {
    ellipse(x,50,50,50);
    x = x + 25;
  }

Your program can use as many different shapes as you like, but you need to use at least one while loop to make at least one of the shapes repeat. To make the pattern interesting, you should experiment with changing the x & y positions, size, color, strokeWeight and fill of your shapes. Have fun and be creative, your pattern doesn't have to look like any other. Don't hesitate to ask for help if your aren't sure how something is suppose to work. Submit the link to your finished program on google classroom.

Samples of Student Work

Ronaldo
Caitlin
Aegis
Charlene
Max
Marielle
Alyssa
Vivian
Melvin
Theo
Justin
Artiom
Katherine
Eden
Vincent
Cathy
Jaden
Douglas
Kimi
Ngoc
Kathleen
Arwyn
Alyssa
Kathy
Jonathan
Calvin
Jordan
Nathan
Yulia
Donovan
Lucas
Amy
Alejandro
Margaux
Tania
Erick
Jimmy
Grace
Sarah
Adrian
Breanna
Kaijun
Alice
Kaitlyn
Susanna
Alex
Ally
Alyssa
Hao
Andrei
Jocelyn
Yeshi
Dylan
Jeffrey
Bella
Tennyson
Jasmine
Cali
Evalgeline
Isaac
Linen
Alvaro
Rio
Omara
Jianna
Tommy
Abigail
Cameron
Tommy
Rachel
Paolo
Tuan
Sally
Stephanie
Eva
Juan
Benjamin
Tobias
Maya
Justin
Frank
Gloria
Naomi
Damian
Niko
Kami
Tyler
Danil
Marco
Tyler
Liam

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published