Index / 2016 / Assignment 08 Mission 03
800×200 · p5.js instance mode
assignment_8_mission_03.pde 23 lines
int[] numbers = new int[20];
int[] speed = new int[20];

void setup() {
  size(800,200);
  background(0);
  for (int j=0; j<20; j++)  {
    numbers[j] = j*5;
    speed[j] = 5;
  }  
}

void draw() {
  noStroke();
  for (int j = 0; j < 20; j++) {
    numbers[j] += speed[j];
    fill(numbers[j],numbers[j],numbers[j]);
    rect(j*40,85,30,30);
    if (numbers[j] == 255 || numbers[j] == 0) {
      speed[j] *= -1;
    }
  }
}
read-only archive source from /2016/ASSIGNMENTS/A-08 Loops and Arrays and Graphics/assignment_08_mission_03/assignment_8_mission_03.pde

Description

This page is generated from the Processing project folder at /2016/ASSIGNMENTS/A-08 Loops and Arrays and Graphics/assignment_08_mission_03/assignment_8_mission_03.pde.

Archive

No companion assets were found in this sketch folder.