frameCount stuck at frame 1

Hi,

I don't know how to delete a post from the discussions but I managed to think of deleting the noLoop() so it functions now.

I am looking at some examples from the examples page of processing.org When I look at the array example (http://processing.org/examples/array.html) I figured it out that the frameCount is stuck at frame 1. Is cos() function continues to calculate crazily? Or is there something else that does not allow the sketch to continue drawing? If the cos() function is blocking how could it be edited so that it won't continue calculating?

float[] coswave; 

void setup() {
  size(640, 360);
  coswave = new float[width];
  for (int i = 0; i < width; i++) {
    float amount = map(i, 0, width, 0, PI);
    coswave[i] = abs(cos(amount));
  }
  background(255);
  noLoop();
}

void draw() {

  int y1 = 0;
  int y2 = height/3;
  for (int i = 0; i < width; i+=2) {
    stroke(coswave[i]*255);
    line(i, y1, i, y2);
  }

  y1 = y2;
  y2 = y1 + y1;
  for (int i = 0; i < width; i+=2) {
    stroke(coswave[i]*255 / 4);
    line(i, y1, i, y2);
  }

  y1 = y2;
  y2 = height;
  for (int i = 0; i < width; i+=2) {
    stroke(255 - coswave[i]*255);
    line(i, y1, i, y2);
  }

}
Tagged:

Answers

  • edited August 2014 Answer ✓

    (Poster found and fixed problem. Adding this so I can accept it to mark as answered)

Sign In or Register to comment.