added snippet for requestanimationframes