While you can do the transition in RGB space (using component-wise linear interpolation), this might cause unnaturally-looking transitions; most noticably, the brightness and saturation may bump between control points. If it this is acceptable, just do it this way. Mapping the values through some sort of gamma function before interpolating and then reverting ...
State machines don't have exceptions, though they may have transitions to an error state.
There's no “one size fits all” answer for how you should handle errors. This depends a lot on the problem domain. Possibilities I consider useful:
If an exception occurs, this is interpreted as a transition to an error state. This error state may be terminal, i.e. ...
You can't really do it smoothly using the RGB color space, but it's easier when done with HSV.
See HSL and HSV
Using HSV space you can transition from Green to Yellow to Red along a single float value for Hue while keeping the saturation/value constant.
I am afraid that's not possible.
This is how transparency is calculated when two objects overlay:
One of the objects must have an opacity of 1 if you don't want the overlay area to be seen through.
So state machines have to handle them somehow.
No they don't.
How an exception should be handled is outside of what state machines model. You've stripped all meaning away and left us with a pattern. You can't ignore context. Wether an exception should even be recovered from is not something a state diagram tells you.
There are many other considerations....
To answer this question, we have to recognize that exceptions, themselves, are something akin to a state transition. They take you to a state which is defined by unwinding the stack. In practice, that's all they are. They're a very non-local goto.
So when it comes to exceptions there's always two ways to handle them. One is to treat them as fatal. In ...
It's going to depend on your implementation of the state machine, the language and the type of exception. I added the diagram to your question for an example:
If it were Java, and action() had a try for a checked exception, you could possibly handle things well knowing that the current state was s1 and you were in transitionName (to s2). Access to all these ...
I'd go one of two ways depending on the exact implementation details.
(Apologies, I'm not familiar with Django, so my answer speaks generically about the architecture and doesn't have specific suggestions for the language you're using)
1. JSON fields for data using Single Table Inheritance
As you suggested, I'd put the data in JSON(B) fields in Postgres. ...
In computer graphics, this kind of function is called smoothstep. When used to crossfade, it determines the global alpha value for the composition.
If the input images have an alpha channel, you should first make sure that the alpha is premultiplied. Then, you can do the crossfade composition straightforwardly, using the smoothstep alpha on each channel [...