Skip to content

Commit

Permalink
Minor UI tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus committed Jul 11, 2018
1 parent 91a2de1 commit 4a37bfd
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 14 deletions.
10 changes: 5 additions & 5 deletions Gifski/Vendor/CircularProgress.swift
Expand Up @@ -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 {
Expand Down
10 changes: 5 additions & 5 deletions Gifski/Vendor/DockProgress.swift
Expand Up @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions Gifski/VideoDropView.swift
Expand Up @@ -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 {
Expand Down Expand Up @@ -40,7 +40,7 @@ class DropView: SSView {

override func didAppear() {
addSubviewToCenter(dropLabel)
dropLabel.pulsateScale(duration: 1.3)
dropLabel.pulsateScale()
}

override func layout() {
Expand Down
11 changes: 9 additions & 2 deletions Gifski/util.swift
Expand Up @@ -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))
Expand All @@ -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)
Expand Down

0 comments on commit 4a37bfd

Please sign in to comment.