how does animation work