can't get camera animated
in
Contributed Library Questions
•
1 year ago
Hello all,
I am fairly new to processing, and in the past few days I've got stuck in a sketch because I cannot seem to get the camera to move.
I am trying to animate it so that the camera would rotate around the triangles, as they are being drawn.
Below is my code:
- import processing.opengl.*;
- import toxi.geom.*;
- void setup()
- {
- size(1440,900,OPENGL);
- background(200);
- }
- int y= height/2;
- int z= 200;
- int x= width/2;
- void draw()
- {
- float xpos = width/2;
- float ypos = height/2;
- float zpos = -100;
- camera(x, y, z, width/2, height/2, 0, 0, -1, 0);
- x++;
- z--;
- if(frameCount%10==0)
- {
- stroke(200, 100, 40, 25);
- fill(random(20,150), random(20,50), random(0,20), 100);
- beginShape(TRIANGLES);
- vertex(xpos, height/2, 0);
- vertex(xpos+random(-500,500),height/4+random(-200,height-200),zpos+random(-50,150));
- vertex(xpos+random(-500,500),height/4+random(-200,height-200),zpos+random(-50,150));
- endShape();
- fill(200,200,200,100);
- point(xpos+random(-400,400), height/4+random(-200,height-200),zpos+random(-50,150));
- }
- }
Thank you for your help!
1