From 4a37bfdc54e9fa9dad6b10d34f37bf96b1fc603b Mon Sep 17 00:00:00 2001 From: Sindre Sorhus Date: Thu, 12 Jul 2018 05:53:25 +0700 Subject: [PATCH] Minor UI tweaks --- Gifski/Vendor/CircularProgress.swift | 10 +++++----- Gifski/Vendor/DockProgress.swift | 10 +++++----- Gifski/VideoDropView.swift | 4 ++-- Gifski/util.swift | 11 +++++++++-- 4 files changed, 21 insertions(+), 14 deletions(-) diff --git a/Gifski/Vendor/CircularProgress.swift b/Gifski/Vendor/CircularProgress.swift index c9835991..1739caed 100644 --- a/Gifski/Vendor/CircularProgress.swift +++ b/Gifski/Vendor/CircularProgress.swift @@ -165,11 +165,11 @@ private extension NSFont { } -private extension NSColor { - func with(alpha: Double) -> NSColor { - return withAlphaComponent(CGFloat(alpha)) - } -} +//private extension NSColor { +// func with(alpha: Double) -> NSColor { +// return withAlphaComponent(CGFloat(alpha)) +// } +//} private extension NSBezierPath { diff --git a/Gifski/Vendor/DockProgress.swift b/Gifski/Vendor/DockProgress.swift index e6aa0423..1dbcb3b5 100644 --- a/Gifski/Vendor/DockProgress.swift +++ b/Gifski/Vendor/DockProgress.swift @@ -162,11 +162,11 @@ private final class ProgressCircleShapeLayer: CAShapeLayer { } -private extension NSColor { - func with(alpha: Double) -> NSColor { - return withAlphaComponent(CGFloat(alpha)) - } -} +//private extension NSColor { +// func with(alpha: Double) -> NSColor { +// return withAlphaComponent(CGFloat(alpha)) +// } +//} //private extension CGRect { diff --git a/Gifski/VideoDropView.swift b/Gifski/VideoDropView.swift index c2f95ed5..b7d5e09f 100644 --- a/Gifski/VideoDropView.swift +++ b/Gifski/VideoDropView.swift @@ -10,7 +10,7 @@ class DropView: SSView { } private let dropLabel = with(Label()) { - $0.textColor = .controlAccent + $0.textColor = NSColor.textColor.with(alpha: 0.5) } var highlightColor: NSColor { @@ -40,7 +40,7 @@ class DropView: SSView { override func didAppear() { addSubviewToCenter(dropLabel) - dropLabel.pulsateScale(duration: 1.3) + dropLabel.pulsateScale() } override func layout() { diff --git a/Gifski/util.swift b/Gifski/util.swift index d76ea633..d249daa0 100644 --- a/Gifski/util.swift +++ b/Gifski/util.swift @@ -55,6 +55,13 @@ extension NSColor { } +extension NSColor { + func with(alpha: Double) -> NSColor { + return withAlphaComponent(CGFloat(alpha)) + } +} + + extension NSView { func pulsate(duration: TimeInterval = 2) { let animation = CABasicAnimation(keyPath: #keyPath(CALayer.opacity)) @@ -69,10 +76,10 @@ extension NSView { layer?.add(animation, forKey: nil) } - func pulsateScale(duration: TimeInterval = 2) { + func pulsateScale(duration: TimeInterval = 1.5, scale: Double = 1.05) { pulsate(duration: duration) - let multiplier: CGFloat = 1.1 + let multiplier = CGFloat(scale) var tr = CATransform3DIdentity tr = CATransform3DTranslate(tr, bounds.size.width / 2, bounds.size.height / 2, 0)