Integrate mathematical movement equations with Javascript animation