added code for viewport animation
some errors remain