refactor slide animation