SpriterDotNet icon indicating copy to clipboard operation
SpriterDotNet copied to clipboard

New feature: Adding delta animations onto a base animation

Open TobyLobster opened this issue 7 years ago • 3 comments

As a new feature, it would be really useful to be able to script adding animations together, e.g. A "crouch" animation plays, lowering the body and head to new positions, a separate "head movement idle" animation plays on top (the extra head idle movement adding on top of the head's crouching position), and, say, her eyes blink fast as a third animation on top.

Then, some moments later, the crouch animation transitions to a walk animation, then to a run, but the other animations continue to play on top.

Note this is not the same as blending. In this scenario we start with 100% of the crouch animation. We then take the difference between the transform of the current frame of the head movement idle animation as compared to the first frame of the same animation, and add this difference on top of the crouch.

For the blinking animation, the eyelids are animated, and we could choose to configure so that the local transform of these eyelid bones overrides any other of our animation's local transforms of these eyelid bones.

I'm not entirely sure here, but it sounds to me like this degree of control is more flexible than SubEntities. It's controlled by script in the runtime, doesn't require special authoring, allows the same bones to be affected by more than one animation, and generally gives customisable control as to how and when animations are added together.

Such a system could then be extended to (a) allow more than two animations to be blended together, (b) allow customisation of how transforms are calculated. e.g. If you always want one bone's transform to be 50% between that of two other bones.

TobyLobster avatar Sep 13 '16 22:09 TobyLobster

Good idea. If I'm not mistaken, this is just like the current blending except this would calculate transforms by adding data from multiple animations (with different weights) instead of interpolating them. Did I get that right?

loodakrawa avatar Sep 13 '16 23:09 loodakrawa

Just realised (+ you mentioned it) that the superimposed animation(s) should add relative transforms to the base animation, not add everything together.

What about animations with different sprites? Should superimposed animation sprites always take precedence over the base animation? It feels like they should - but I'm trying to analyse this from every angle.

loodakrawa avatar Sep 14 '16 06:09 loodakrawa

Yes, that sounds reasonable - a new sprite on the superimposed animation should probably override the base animation's sprite, since it's effectively being applied after the effects of the base animation.

TobyLobster avatar Sep 14 '16 06:09 TobyLobster