Help with Animation
in
Programming Questions
•
2 years ago
Hi guys, I'm having some problems with an interactive instalation...the idea is to have a kiosk where a tree will be (pics here:
http://antoniopdgomes.wordpress.com/) and by sensors, I want to trigger some animations....my problem is, as it is right now, my code is very slow so I created gif files but I have no idea on how to adapt this....anyone can help me? for "B" i made a mix_CaseB.gif, better than loading 600png's like i'm doing now i guess...thanks in advance for any help u can give me
(I had the topic previously but i hit trash by mistake --')
- PImage bg;
- int b; int c; int a; int z;
- int bb; int cc; int aa;
- int Baa;
- int i =1; int m =1; int s =0; int v =176;
- int j =0; int p =0; int w = 180;
- int k =20; int l =136;
- int mode = 0;
- boolean a_mode=false;
- boolean b_mode=false;
- void setup()
- {
- size(1005, 1005);
- frameRate(15);
- background(255);
- PImage z;
- z = loadImage("back.jpg");
- image(z,2,2);
- }
- void draw()
- {
- PImage z;
- z = loadImage("back.jpg");
- image(z,2,2);
- if (a_mode) // A 출력 모드일때
- {
- Agroup();
- }
- if (b_mode) // B 출력 모드일때
- {
- Bgroup();
- }
- }
- void keyReleased()
- {
- if (key == 'a' || key == 'A')
- {
- a_mode = !a_mode;
- }
- else if (key == 'b' || key == 'B')
- {
- b_mode = !b_mode;
- }
- }
- void Agroup()
- {
- if (j <= 601)
- {
- PImage aa = loadImage("AA_00"+nf(j,3)+".png");
- image(aa,2,2);
- println(j);
- ++j;
- } else {
- j=0;
- a_mode = false;
- background(0); // Or other color
- }
- }
- void Bgroup()
- {
- if (p <= 629)
- {
- PImage aa = loadImage("BB_00"+nf(j,3)+".png");
- image(aa,2,2);
- ++p;
- } else {
- p=0;
- mode = 0;
- background(0); // Or other color
- }
- }
1