Skip to content

Commit

Permalink
Updated Swift sample app
Browse files Browse the repository at this point in the history
  • Loading branch information
jernejstrasner committed Aug 1, 2015
1 parent cc340fe commit bae898b
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions SwiftSampleApp/ViewController.swift
Original file line number Diff line number Diff line change
@@ -22,18 +22,19 @@ class ViewController: UIViewController {
}

func reset() {
gradientView.reverse = false
gradientView.slopeFactor = 2.0
gradientView.startPoint = CGPoint(x: 0.5, y: 0)
gradientView.endPoint = CGPoint(x: 0.5, y: 1)
gradientView.interpolationFactor = 2.0
slider.value = Float(pow(M_E, 2.0))
updateLabel()
}

func updateLabel() {
factorLabel.text = String(format: "Slope factor: %0.4fx", gradientView.slopeFactor)
factorLabel.text = String(format: "Slope factor: %0.4fx", gradientView.interpolationFactor)
}

@IBAction func factorChanged(sender: UISlider) {
gradientView.slopeFactor = CGFloat(logf(sender.value))
gradientView.interpolationFactor = CGFloat(logf(sender.value))
updateLabel()
}

@@ -42,7 +43,7 @@ class ViewController: UIViewController {
}

@IBAction func invert(sender: AnyObject) {
gradientView.reverse = !gradientView.reverse
swap(&gradientView.startPoint, &gradientView.endPoint)
}
}

0 comments on commit bae898b

Please sign in to comment.