Hello,
I’m stumbling around using Benedikt Groß’s ANI library for processing, and was getting really confused. I’m probably in over my head.
I was trying to create what his library calls AniSequences inside a class I created and kept hitting an error that I didn’t know how to fix. Later, I accidentally came across a solution that seems to have fixed it, but I don’t understand how it did this. I was hoping someone could explain to me… like you would a six year old.
So in a sketch without using classes, after importing the library and initializing it with:
Ani.init(this);
setting up a sequence looks something like the following:
AniSequence seq;
void setup() {
seq = new AniSequence(this);
blah blah blah
}
OK. So when I tried doing this inside a class, i tried something like this:
Class Thing {
AniSequence seq;
Thing() {
seq = new AniSequence(this);
blah blah blah
}
}
But this kept giving me the error: “The Constructor ani.AniSequence(Thing)” does not exist.
No matter what I did, I couldn’t get processing to see it.
So looking at someone else’s code on here, I found this technique:
Inside the main sketch:
thing1 = new Thing(this);
And then, inside the class:
Class Thing {
AniSequence seq;
Thing(PApplet _p) {
seq = new AniSequence(_p);
blah blah blah
}
}
So far… the above seems to be working.
But I have no idea what’s happening. Could someone explain it?
I thought I understood what “this” meant, but apparently not. I don’t understand what using “this” is passing into the class. And I have zero idea what PApplet is or what it’s doing.
Thank you for reading this far.
Beginner programmer, any and all help is greatly appreciated.