Zoom effect in OpenGL with Processing
in
Core Library Questions
•
2 years ago
Is this possible?
I want a zoom effect on my scene and I`m wondering if it is a zoom code for OpenGL in processing. I still work on this project:
I want a zoom effect on my scene and I`m wondering if it is a zoom code for OpenGL in processing. I still work on this project:
- import processing.opengl.*;
float a;
void setup() {
size(200, 200, OPENGL);
fill(0);
noStroke();
}
void draw() {
background(900);
translate(width/2, height/2);
rotateX(a);
rotateY(a*5);
rotateX(PI/2);
rotateY(a*10);
rotateY(a*1);
rotate(a*5);
rotateY(a*1);
rotateY(a*10);
rect(20, 20, -20, 20); fill(sin(a)*100+178);
rect(20, 20, -20, 20); fill(sin(a)*200+300);
rect(50, 20, -20, 20); fill(sin(a)*100+100);
rect(20, 50, -20, 20); fill(sin(a)*100+100);
rect(-20, 20, -20, 20);
rect(-20, 20, -20, 20);fill(sin(a)*100+100);
rect(-50, 20, -20, 20);fill(sin(a)*100+100);
rect(-20, 50, -20, 20);
rect(-20, 20, -20, 20);fill(sin(a)*100+178);
rect(-20, 20, -20, 20);fill(sin(a)*200+300);
rect(-50, 20, -20, 20);fill(sin(a)*100+100);
rect(-20, 50, -20, 20);fill(sin(a)*100+100);
rect(20, 20, 20, -20);
rect(20, 20, 20, -20); fill(sin(a)*500+500);
rect(-50, 20, 20, -20); fill(sin(a)*500+500);
rect(20, 20, 20, -20);
a -= 0.01;
}
Thanks for any help :)
1