lucasbrown/swiftui-visual-effects
关于
封装 UIVisualEffectView 并集成到环境系统中的 View 修饰符。
网站与应用开发实测星标增长
- 24小时
- 0
- 7天
- 0
- 15天
- 0
- 1个月
- 正在收集历史
各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。
README.md
原文SwiftUI Visual Effects
System materials in SwiftUI
View modifiers that wrap UIVisualEffectView and all of its associated objects, with environment integration for storing effect styles. Vibrancy effects will always use the current blur effect style for proper vibrancy-effect layering.
Adding and Styling a Blur Effect
YourView()
// Add a blur effect.
.blurEffect()
// Style the blur effect.
.blurEffectStyle(.systemChromeMaterial)
Adding and Styling a Vibrancy Effect
YourView()
// Add a vibrancy effect.
.vibrancyEffect()
// Style the vibrancy effect.
.vibrancyEffectStyle(.fill)
Adding and Styling Blur and Vibrancy Effects
ZStack {
YourBackgroundContent()
// Add a blur effect.
.blurEffect()
YourForegroundContent()
// Add a vibrancy effect.
.vibrancyEffect()
}
// Set the style for blur effects within this view.
.blurEffectStyle(.systemChromeMaterial)
// Set the style for vibrancy effects within this view.
.vibrancyEffectStyle(.fill)
Adding Blur and Vibrancy Effects Directly to a View
Adding both a blur and vibrancy effect directly to a view only displays the blur effect.
If you’d like to blur the view’s background content, while adding vibrancy to the view’s foreground content, use the .background() modifier, and pass BlurEffect() as its argument. Although BlurEffect may not be very Apple-like, it’s better than the .blurEffect() modifier implementation below.
YourView()
.vibrancyEffect()
.background(BlurEffect())
// as opposed to:
YourView()
.vibrancyEffect()
.background(
Color.clear
.blurEffect()
)
探索相关项目
加载中…