[app] Set initial values of parameters based on what's in UserDefaults
This commit is contained in:
parent
88c97d4bf5
commit
6c0342fb78
1 changed files with 7 additions and 3 deletions
|
@ -13,9 +13,13 @@ import MetaballsKit
|
|||
class ViewController: NSViewController, RendererDelegate {
|
||||
private static func defaultParameters() -> Parameters {
|
||||
var p = Parameters()
|
||||
p.colorStyle = .gradient2Horizontal
|
||||
p.color0 = Float4(0.50, 0.79, 1, 1)
|
||||
p.color1 = Float4(0.88, 0.50, 1, 1)
|
||||
let defaults = UserDefaults.standard
|
||||
let style = defaults.colorStyle ?? .gradient2Horizontal
|
||||
p.colorStyle = style
|
||||
let color0 = defaults.color0 ?? Float4(0.50, 0.79, 1, 1)
|
||||
p.color0 = color0
|
||||
let color1 = defaults.color1 ?? Float4(0.88, 0.50, 1, 1)
|
||||
p.color1 = color1
|
||||
return p
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue