Using requestAnimationFrame for transitions