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 5, 2023
1 parent a9f46c8 commit 251c212
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 49 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -538,37 +538,7 @@ class AdaptiveModalManager {

return nextTransform;
};

func interpolateModalOpacity(
forInputPercentValue inputPercentValue: CGFloat
) -> CGFloat? {

return self.interpolate(
inputValue: inputPercentValue,
rangeOutputKey: \.modalOpacity
);
};

func interpolateModalBackgroundOpacity(
forInputPercentValue inputPercentValue: CGFloat
) -> CGFloat? {

return self.interpolate(
inputValue: inputPercentValue,
rangeOutputKey: \.modalBackgroundOpacity
);
};

func interpolateModalBackgroundVisualEffectOpacity(
forInputPercentValue inputPercentValue: CGFloat
) -> CGFloat? {

return self.interpolate(
inputValue: inputPercentValue,
rangeOutputKey: \.modalBackgroundVisualEffectOpacity
);
};

func interpolateModalBorderRadius(
forInputPercentValue inputPercentValue: CGFloat
) -> CGFloat? {
Expand All @@ -579,16 +549,6 @@ class AdaptiveModalManager {
);
};

func interpolateBackgroundOpacity(
forInputPercentValue inputPercentValue: CGFloat
) -> CGFloat? {

return self.interpolate(
inputValue: inputPercentValue,
rangeOutputKey: \.backgroundOpacity
);
};

// MARK: - Functions - Property Interpolators
// ------------------------------------------

Expand Down Expand Up @@ -703,8 +663,9 @@ class AdaptiveModalManager {
Self.setProperty(
forObject: modalView,
forPropertyKey: \.alpha,
withValue: self.interpolateModalOpacity(
forInputPercentValue: inputPercentValue
withValue: self.interpolate(
inputValue: inputPercentValue,
rangeOutputKey: \.modalOpacity
)
);

Expand All @@ -719,24 +680,27 @@ class AdaptiveModalManager {
Self.setProperty(
forObject: self.modalBackgroundView,
forPropertyKey: \.alpha,
withValue: self.interpolateModalBackgroundOpacity(
forInputPercentValue: inputPercentValue
withValue: self.interpolate(
inputValue: inputPercentValue,
rangeOutputKey: \.modalBackgroundOpacity
)
);

Self.setProperty(
forObject: self.modalBackgroundVisualEffectView,
forPropertyKey: \.alpha,
withValue: self.interpolateModalBackgroundVisualEffectOpacity(
forInputPercentValue: inputPercentValue
withValue: self.interpolate(
inputValue: inputPercentValue,
rangeOutputKey: \.modalBackgroundVisualEffectOpacity
)
);

Self.setProperty(
forObject: self.backgroundDimmingView,
forPropertyKey: \.alpha,
withValue: self.interpolateBackgroundOpacity(
forInputPercentValue: inputPercentValue
withValue: self.interpolate(
inputValue: inputPercentValue,
rangeOutputKey: \.backgroundOpacity
)
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,6 @@ enum AdaptiveModalConfigTestPresets: CaseIterable {
.layerMinXMaxYCorner,
.layerMaxXMaxYCorner
],
modalBackgroundVisualEffectOpacity: 0.9,
modalBackgroundVisualEffectIntensity: 0.6,
backgroundOpacity: 0.1,
backgroundVisualEffectIntensity: 0.075
Expand Down

0 comments on commit 251c212

Please sign in to comment.