function animate a view