Quantcast
Channel: Processing Forum
Viewing all articles
Browse latest Browse all 1768

Re : animation is not responding to increased frameRate

$
0
0
Thanks, Amnon!

I added a scaler variable to vary the speed of animation as you suggested:

  1.     import peasy.*; // camera library
        PeasyCam cam;

        int shift = 0;
        int scaler = 3;

        PShape s1,s2,s3;

        void setup(){
          size(1000,1000,OPENGL);
          smooth(8);
          frameRate(60);

          cam = new PeasyCam(this, 1000);

          s1 = createShape(RECT, 0,0, 300,-300);
          s1.fill(255,0,0);
          s1.end();

          s2 = createShape(RECT, 0,0, 300,-300);
          s2.fill(0,255,0);
          s2.end();

          s3 = createShape(RECT, 0,0, 300,-300);
          s3.fill(0,0,255);
          s3.end();
        }

        void draw(){
          background(0);
        
          pushMatrix();
          translate(0,0,shift);
          shape(s1, 0,0);
          popMatrix();

          pushMatrix();
          translate(shift,0,0);
          rotateY(PI/(-2));
          shape(s2, 0,0);
          popMatrix();
        
          pushMatrix();
          translate(0,-shift,0);
          rotateX(PI/(-2));
          shape(s3, 0,0);
          popMatrix();
        
          shift += scaler;
          if (shift>300){shift=0;}
        
        }

Viewing all articles
Browse latest Browse all 1768

Trending Articles