Skip to content

Conversation

@traviskirton
Copy link
Collaborator

Updates gradientFill to render a graphic and create a C4Color from a UIColor from a tiled image.

Fixes: #608

@traviskirton
Copy link
Collaborator Author

NOTE: When animating between a color and a pattern there is a flicker to white. This seems to be a bug in UIKit as it occurs for a UIView as well.

    var isColor = true
    override func setup() {
        let r = UIColor.redColor()
        let p = UIColor(patternImage: UIImage(named: "pattern2")!)

        let v = UIView(frame: CGRect(x: 0, y: 0, width: 100, height: 100))
        v.backgroundColor = r
        canvas.add(v)

        canvas.addTapGestureRecognizer { (location, state) -> () in
            C4ViewAnimation(duration: 1.0) {
                if self.isColor {
                    v.backgroundColor = p
                } else {
                    v.backgroundColor = r
                }
            }.animate()
            self.isColor = !self.isColor
        }
    }

@traviskirton
Copy link
Collaborator Author

Closing, moving changes to 1.1.x

@traviskirton traviskirton deleted the GradientGraphicsContext branch February 22, 2016 20:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants