fixed bug in animation api and added animation speed