why does this code doesn't animate?
in
Programming Questions
•
2 years ago
i have this code and if I run the code, the result is static picture.. but according to my understanding it should move from right to left.. any silly mistakes that someone can find??
- int com, px, x, y;
- float py;
- void setup(){
- size(1200, 600);
- background(126);
- }
- void draw(){
- background(126); //refresh background
- //create box with respect to mouse movement
- for (int i =0; i<width; i++){
- stroke(0);
- fill(255);
- px = width-i;
- py = 500;
- rect(px, py, 5, 5);
- }
- //line
- stroke(255);
- line(0, 600, 1200, 0);
- if (x <= width+60){
- x = 1200;
- y++;
- }
- }
thanks you..
1