facorised animation code, close #1497