use css keyframe animation to detect paint completion - not supported in IE9 but wanted a copy of the code in repo for future reference