Skip to content

Commit 53c5881

Browse files
committed
Changed overshoot to use 1.0 as the origin instead of 0.0
1 parent 1f6c59f commit 53c5881

3 files changed

Lines changed: 7 additions & 7 deletions

File tree

BlurUIKit/SwiftUI/VariableBlur.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public struct VariableBlur: UIViewRepresentable {
5555
private var blurStartingInset: GradientSizing?
5656
private var dimmingTintColor: UIColor? = .systemBackground
5757
private var dimmingAlpha: DimmingAlpha? = .interfaceStyle(lightModeAlpha: 0.5, darkModeAlpha: 0.25)
58-
private var dimmingOvershoot: GradientSizing? = .relative(fraction: 0.25)
58+
private var dimmingOvershoot: GradientSizing? = .relative(fraction: 1.25)
5959
private var dimmingStartingInset: GradientSizing?
6060

6161
// MARK: - Initializer
@@ -138,7 +138,7 @@ public struct VariableBlur: UIViewRepresentable {
138138
///
139139
/// - Parameter overshoot: The overshoot distance, expressed as either an absolute point
140140
/// value or a fraction of the view's size. Pass `nil` to confine the dimming gradient
141-
/// to the view's bounds. Defaults to `.relative(fraction: 0.25)`.
141+
/// to the view's bounds. Defaults to `.relative(fraction: 1.25)`.
142142
/// - Returns: A modified `VariableBlur` with the updated dimming overshoot.
143143
public func dimmingOvershoot(_ overshoot: GradientSizing?) -> VariableBlur {
144144
var copy = self

BlurUIKit/UIKit/VariableBlurView.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public class VariableBlurView: UIView {
4141
public enum GradientSizing {
4242
// The amount of on-screen UI points starting from the origin, as a static value.
4343
case absolute(position: CGFloat)
44-
// A value between 0.0 and 1.0 relative to the size of the view. A value of 0.5 would be half the size of this view.
44+
// A relative fraction of this view's size along the gradient direction. (0.0 = 0%, 1.5 = 150%)
4545
case relative(fraction: CGFloat)
4646
}
4747

@@ -83,7 +83,7 @@ public class VariableBlurView: UIView {
8383
}
8484

8585
/// An optional overshoot value to allow the colored gradient to extend outside the blur view's bounds
86-
public var dimmingOvershoot: GradientSizing? = .relative(fraction: 0.25) {
86+
public var dimmingOvershoot: GradientSizing? = .relative(fraction: 1.25) {
8787
didSet { resetDimmingImage() }
8888
}
8989

@@ -372,7 +372,7 @@ extension VariableBlurView {
372372
case .absolute(position: let position):
373373
return (value + position).rounded(.up)
374374
case .relative(fraction: let fraction):
375-
return (value + (value * fraction)).rounded(.up)
375+
return (value * fraction).rounded(.up)
376376
}
377377
}
378378
}

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ let blurView = VariableBlurView()
3535
blurView.dimmingTintColor = .red
3636

3737
// The tint color can 'overshoot' the blur view to add more gradual transition
38-
blurView.dimmingOvershoot = .relative(fraction: 0.25)
38+
blurView.dimmingOvershoot = .relative(fraction: 1.25)
3939

4040
```
4141

@@ -46,7 +46,7 @@ blurView.dimmingOvershoot = .relative(fraction: 0.25)
4646
// Use the VariableBlur view with chainable modifiers
4747
VariableBlur(direction: .down)
4848
.dimmingTintColor(.red)
49-
.dimmingOvershoot(.relative(fraction: 0.25))
49+
.dimmingOvershoot(.relative(fraction: 1.25))
5050

5151
```
5252

0 commit comments

Comments
 (0)