loodakrawa / SpriterDotNet

A pure C# Spriter implementation
zlib License
220 stars 75 forks source link

Advanced blending features #53

Open Dharengo opened 8 years ago

Dharengo commented 8 years ago

Is it possible to implement a feature that lets you blend together more than two animations?

What about a feature that blends a new animation into the current one?

loodakrawa commented 8 years ago

Blending multiple animations should not be complicated - I'll change the title of this issue and leave it as a to-do task.

Isn't blending a new animation into the current one the same as blending any two animations? If not - what's the difference?

Dharengo commented 8 years ago

Well as it stands now, you have to know the names of both animations you want to blend, and they together become the new animation.

For example, you want to make a character blink once, but you want to do this regardless of whether the character is standing, walking or otherwise.

loodakrawa commented 8 years ago

Ah, ok, I understand. So it's something like blend animation X into the current one with a certain weight factor until animation X finishes and then continue playing current one?

Dharengo commented 8 years ago

That and similar scenarios, yes.

loodakrawa commented 8 years ago

OK, I'll try to do this in a generic way that covers all the common scenarios and allows the users to create their own.

Probably I'll introduce a separate object with the blend info about all animations involved, methods that get called every frame to allow adjusting the blend factor(s) and callbacks for certain events (like animation finished).

Dharengo commented 8 years ago

That would be cool. It'll go a long way in either implementing things like blend trees, or if Unity blend trees aren't directly possible (due to AnimatorController being horrifyingly difficult to tinker with), a different implementation that achieves the same effect.

Dharengo commented 8 years ago

Just to complicate things further:

Transitioning from one blended state to another blended state. As well as transitioning only part of a blended state while leaving the other part of the state as is.