Sub RotateViewShortestArc (v As B4XView, Duration As Int, Target As Float)
Dim Rotation As Float = v.Rotation
Dim dx As Float = (Target - Rotation) Mod 360
If dx > 180 Then
dx = -(360 - dx)
Else if dx < -180 Then
dx = 360 + dx
End If
v.SetRotationAnimated(Duration, Rotation + dx)
End Sub