Author
Travis Kirton


Rotation

When you want to rotate something more than +/- M_PI (180°) you can use the rotation property instead of applying a transform to a view.

view.rotation = 1.75 * M_PI

Example

let r = Rectangle(frame: Rect(0, 0, 200, 200))
r.lineWidth = 15.0

let c = Circle(center: Point(), radius: 25)
c.lineWidth = 5.0

r.add(c)

r.center = canvas.center

canvas.add(r)

let a = ViewAnimation(duration: 1.0) {
    r.rotation = 1.75 * M_PI
}
a.delay = 0.5
a.animate()