Created
January 18, 2016 02:55
-
-
Save drart/703f617fd7db3154926d to your computer and use it in GitHub Desktop.
First Swift C4. Trying out the new animation system.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import UIKit | |
| class WorkSpace: C4CanvasController { | |
| var circles : [C4Circle]! | |
| override func setup() { | |
| circles = [C4Circle]() | |
| for var i = 0; i < 10; i++ | |
| { | |
| let x = random01() * canvas.width | |
| let y = random01() * canvas.height | |
| let p:C4Point = C4Point(x, y) | |
| let c = C4Circle(center:p, radius: 49) | |
| circles.append(c) | |
| } | |
| for circle in circles{ | |
| canvas.add(circle) | |
| } | |
| C4ViewAnimation(duration: 5.0) { | |
| for circle in self.circles { | |
| circle.fillColor = black | |
| } | |
| }.animate() | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment