switching between image sequence loops
in
Programming Questions
•
7 months ago
hello, i got few image sequences, each about 53 frames long
i need to loop them and switch from one to another after some
conditions are met
here's what i do
using example by
http://www.shiffman.net/2011/12/26/night-6-image-sequence-object-with-variable-speed/
i create An array of "Animation" objects
Animation[] animations = new Animation[5];
then in setup i load image sequences one by one
PImage[] seq = new PImage[40];
for (int i = 0; i < seq.length; i++) {
seq[i] = loadImage("picture"+nf(i+1,2)+".png");
}
PImage[] seq1 = new PImage[53];
for (int i = 0; i < seq1.length; i++) {
seq1[i] = loadImage("picture"+nf(i+1,2)+".png");
}
(and other sequences...)
then
animations[0] = new Animation(seq,0,0);
animations[1] = new Animation(seq1,0,0);
then in draw loop
i loop sequences
i make variable
int switch=0;
to change sequences
animations[switch].animate();
then when i need to switch between sequence loops
i change value of the switch
is this the correct way to do it?
i run into out of memory error after a while...
maybe there is more clever and economic approaches?
i need to loop them and switch from one to another after some
conditions are met
here's what i do
using example by
http://www.shiffman.net/2011/12/26/night-6-image-sequence-object-with-variable-speed/
i create An array of "Animation" objects
Animation[] animations = new Animation[5];
then in setup i load image sequences one by one
PImage[] seq = new PImage[40];
for (int i = 0; i < seq.length; i++) {
seq[i] = loadImage("picture"+nf(i+1,2)+".png");
}
PImage[] seq1 = new PImage[53];
for (int i = 0; i < seq1.length; i++) {
seq1[i] = loadImage("picture"+nf(i+1,2)+".png");
}
(and other sequences...)
then
animations[0] = new Animation(seq,0,0);
animations[1] = new Animation(seq1,0,0);
then in draw loop
i loop sequences
i make variable
int switch=0;
to change sequences
animations[switch].animate();
then when i need to switch between sequence loops
i change value of the switch
is this the correct way to do it?
i run into out of memory error after a while...
maybe there is more clever and economic approaches?
1