Update example and refactor animate js