實例方法
blend
blendMode(_:)
設置將此視圖與重疊視圖合成的混合模式。
聲明
func blendMode(_ blendMode: BlendMode) -> some View
返回值
將blendMode
應用於此視圖的視圖。
參數
blendMode
用於合成此視圖的
BlendMode
。
詳述
使用blendMode(_:)
組合重疊視圖並使用不同的視覺效果來產生結果。 BlendMode
枚舉定義了許多可能的效果。
在下麵的示例中,兩個重疊的矩形應用了BlendMode/colorBurn
效果,它有效地刪除了第二張圖像的非重疊部分:
HStack {
Color.yellow.frame(width: 50, height: 50, alignment: .center)
Color.red.frame(width: 50, height: 50, alignment: .center)
.rotationEffect(.degrees(45))
.padding(-20)
.blendMode(.colorBurn)
}
可用版本
iOS 13.0+, iPadOS 13.0+, macOS 10.15+, Mac Catalyst 13.0+, tvOS 13.0+, watchOS 6.0+
相關用法
- Swift Never blur(radius:opaque:)用法及代碼示例
- Swift Never badge(_:)用法及代碼示例
- Swift Never buttonStyle(_:)用法及代碼示例
- Swift Never background(_:ignoresSafeAreaEdges:)用法及代碼示例
- Swift Never brightness(_:)用法及代碼示例
- Swift Never background(in:fillStyle:)用法及代碼示例
- Swift Never background(alignment:content:)用法及代碼示例
- Swift Never background(_:in:fillStyle:)用法及代碼示例
- Swift Never border(_:width:)用法及代碼示例
- Swift Never background(ignoresSafeAreaEdges:)用法及代碼示例
- Swift Never body用法及代碼示例
- Swift Never pageCommand(value:in:step:)用法及代碼示例
- Swift Never opacity(_:)用法及代碼示例
- Swift Never colorMultiply(_:)用法及代碼示例
- Swift Never accessibilityAction(action:label:)用法及代碼示例
- Swift Never alert(isPresented:error:actions:message:)用法及代碼示例
- Swift Never confirmationDialog(_:isPresented:titleVisibility:actions:)用法及代碼示例
- Swift Never flipsForRightToLeftLayoutDirection(_:)用法及代碼示例
- Swift Never position(x:y:)用法及代碼示例
- Swift Never position(_:)用法及代碼示例
- Swift Never luminanceToAlpha()用法及代碼示例
- Swift Never accessibilityAction(_:_:)用法及代碼示例
- Swift Never previewDisplayName(_:)用法及代碼示例
- Swift Never progressViewStyle(_:)用法及代碼示例
- Swift Never popover(isPresented:attachmentAnchor:arrowEdge:content:)用法及代碼示例
注:本文由純淨天空篩選整理自apple.com大神的英文原創作品 Never blendMode(_:)。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。