update animate function in util.js