Skip to content

Commit

Permalink
💫 Update: Exp - AdaptiveModal
Browse files Browse the repository at this point in the history
Summary: Update experiment/test - `swift-programmatic-modal/AdaptiveModal`.
  • Loading branch information
dominicstop committed Jun 6, 2023
1 parent 3360554 commit 108c27a
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ struct AdaptiveModalInterpolationPoint: Equatable {
let modalBackgroundVisualEffectOpacity: CGFloat;
let modalBackgroundVisualEffectIntensity: CGFloat;

//let backgroundColor: UIColor;
let backgroundColor: UIColor;
let backgroundOpacity: CGFloat;

let backgroundVisualEffect: UIVisualEffect?;
Expand Down Expand Up @@ -178,6 +178,10 @@ struct AdaptiveModalInterpolationPoint: Equatable {
?? keyframePrev?.modalBackgroundVisualEffectIntensity
?? 1;

self.backgroundColor = keyframeCurrent?.backgroundColor
?? keyframePrev?.backgroundColor
?? .black;

self.backgroundOpacity = keyframeCurrent?.backgroundOpacity
?? keyframePrev?.backgroundOpacity
?? 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -728,6 +728,15 @@ class AdaptiveModalManager {
)
);

Self.setProperty(
forObject: self.backgroundDimmingView,
forPropertyKey: \.backgroundColor,
withValue: self.interpolateColor(
inputValue: inputPercentValue,
rangeOutputKey: \.backgroundColor
)
);

Self.setProperty(
forObject: self.backgroundDimmingView,
forPropertyKey: \.alpha,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@ enum AdaptiveModalConfigTestPresets: CaseIterable {
.layerMaxXMaxYCorner
],
modalBackgroundVisualEffectIntensity: 0.6,
//backgroundColor: .red,
backgroundOpacity: 0.1,
backgroundVisualEffectIntensity: 0.075
)
Expand Down

0 comments on commit 108c27a

Please sign in to comment.