C4Labs / C4iOS

C4 is an open-source creative coding framework that harnesses the power of native iOS programming with a simplified API that gets you working with media right away. Build artworks, design interfaces and explore new possibilities working with media and interaction.
www.c4ios.com
MIT License
981 stars 75 forks source link

Rotation property doesn't get applied when set in `setup()` #674

Open traviskirton opened 8 years ago

traviskirton commented 8 years ago

The following works:

override func setup() {
    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)

    wait(0.001) {
        r.rotation += 1.75 * M_PI
    }
}

Resulting in:

simulator screen shot may 16 2016 4 42 34 pm

However, the following has no effect...

override func setup() {
    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)

    r.rotation += 1.75 * M_PI
}

Resulting in:

simulator screen shot may 16 2016 4 42 20 pm