added a more generic way to create animations