Make graphics elements move to music in OpenGL
in
Core Library Questions
•
2 years ago
Hi! I am very new to Processing, and to this forum. I have a question for my OpenGL code.
Is there anyway to get the graphics elements move to the music? Like small-boxes and so on.
Thanks for any help :)
Here is my code so far:
- 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/5);
- rotateY(a*10);
- rotateY(a*0);
- rect(20, 20, -20, 20);
- rect(20, 20, -20, 20);
- rect(50, 20, -20, 20);
- rect(20, 50, -20, 20);
- rect(-20, 20, -20, 20);
- rect(-20, 20, -20, 20);
- rect(-50, 20, -20, 20);
- rect(-20, 50, -20, 20);
- rect(-20, 20, -20, 20);
- rect(-20, 20, -20, 20);
- rect(-50, 20, -20, 20);
- rect(-20, 50, -20, 20);
- rect(20, 20, 20, -20);
- rect(20, 20, 20, -20);
- rect(-50, 20, 20, -20);
- rect(20, 20, 20, -20);
- fill(sin(a)*100+100);
- fill(sin(a)*100+10+200-50-40+30);
- a -= 0.01;
- }
1