I'm building an API for myself to do 2D skeletal animation.
I have a Bone class and a Skeleton class.
The Skeleton creates a root bone and then subsequent bones are added via the Skeleton's add method by providing the parent bone.
What I now want to do is add animation and frames.
What I was thinking of, is a class that can load and interpolate animations. So it would be an object that would load an animation. It would then, at each frame, take in a Skeleton and modify the Skeleton accordingly.
Is this a good design? Should an animation take in a Skeleton, or should a Skeleton take in an animation and apply it onto itself?
It's best to create an Animation that makes use of a Skeleton instead of the opposite. This because, logically speaking, the object Skeleton does not require an Animation to live, but an Animation strongly requires a Skeleton. So you can couple those elements in the Animation itself. Do not put too much logics in the objects, and try to put it just where necessary.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With