Added functionality to vary length of animations.