Added source state to Transitions.

Mostly to ease the support of a 3p rendering library.
Added toJSON methods to most classes.