Skip to content

2*M_PI Rotations not executing (visually) #613

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
traviskirton opened this issue Feb 1, 2016 · 0 comments
Closed

2*M_PI Rotations not executing (visually) #613

traviskirton opened this issue Feb 1, 2016 · 0 comments
Assignees
Labels

Comments

@traviskirton
Copy link
Collaborator

Possible solution: look at animation groups to see if easing applies across all animations in the group. If so, then this is probably the best approach.

Here's an example that doesn't work:

import C4
import UIKit

class ViewController: C4CanvasController {
    var previous: C4Shape!
    override func setup() {
        for i in 1...20 {
            let s = C4Circle(center: canvas.center, radius: Double(50 - i * 2))
            s.anchorPoint = C4Point(0.5, 1.0)
            s.lineWidth = 0

            if i == 1 {
                s.center = canvas.center
                canvas.add(s)
            } else {
                s.center = previous.bounds.center
                previous.add(s)
            }
            previous = s

            var dir = 1.0
            if i % 2 == 0 {
                s.fillColor = C4Pink
                dir = -1.0
            }

            let a = C4ViewAnimation(duration: 0.25) {
                s.rotation += 2*M_PI
            }
            a.addCompletionObserver {
                a.animate()
            }
            a.animate()
        }
    }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants