use the states provided

This allows animations to be scaled/moved easily
fix use after free

the string created by value.substr(index * 2, 2) is deleted after c_str()
but before strtoul executes. The solution is to use a temporary string
to store the value.
free the texture when we are done with it
initialize variable
Merge pull request #9 from victorsavu3/master

Allow animations to be transformed and various memory problems