MoveAfterRotation - nonkit/SmallWikiPad GitHub Wiki

MoveAfterRotation

Move triangle and line to appropriate position after rotation for avoiding rotation at corner issue on browser with Silverlight environment.

' x, y - triangle position
' width, height - size of triangle
' angle - rotate angle
tri = Shapes.AddTriangle(0, 0, 0, height, width, height)
Shapes.Move(tri, x, y)
cx = x + width / 2
cy = y + height / 2
Shapes.Rotate(tri, angle)
If silverlight Then
  a = Math.GetRadians(angle)
  _cx = cx * Math.Cos(a) - cy * Math.Sin(a)
  _cy = cx * Math.Sin(a) + cy * Math.Cos(a)
  _ox = ox - (_cx - cx)
  _oy = oy - (_cy - cy)
  Shapes.Move(tri, _ox, _oy)
EndIf

See Also

Other Resources