The alignment for mask
in relation to this view.
Instance Method
インスタンスメソッド
mask(alignment:
mask(alignment:_:)
Masks this view using the alpha channel of the given view.
このビューをこの与えられたビューのアルファチャンネルを使って隠します。
Availability 有効性
- iOS 15.0+
- iPadOS 15.0+
- macOS 12.0+
- Mac Catalyst 15.0+
- tvOS 15.0+
- watchOS 8.0+
Technology
- Swift
UI
Declaration 宣言
Parameters パラメータ
alignment
mask
The view whose alpha the rendering system applies to the specified view.
Discussion 議論
Use mask(_:)
when you want to apply the alpha (opacity) value of another view to the current view.
This example shows an image masked by rectangle with a 10% opacity:
Image(systemName: "envelope.badge.fill")
.foregroundColor(Color.blue)
.font(.system(size: 128, weight: .regular))
.mask {
Rectangle().opacity(0.1)
}