Bugfixes for Animation class.

The check for ended animations was always true.