Implemented heartbeat animation on main thread.