Added support for custom events to trigger animation start and stop.