Instance Method インスタンスメソッド

blendMode(_:)

Sets the blend mode for compositing this view with overlapping views. このビューを重なり合っているビューそれらと合成することに対するブレンドモード(混合方式)を設定します。

Declaration 宣言

func blendMode(_ blendMode: BlendMode) -> some View

Return Value 戻り値

A view that applies blendMode to this view. あるビュー、それはblendModeをこのビューに適用するものです。

Parameters パラメータ

blendMode

The BlendMode for compositing this view.

Discussion 議論

Use blendMode(_:) to combine overlapping views and use a different visual effect to produce the result. The BlendMode enumeration defines many possible effects.

In the example below, the two overlapping rectangles have a BlendMode.colorBurn effect applied, which effectively removes the non-overlapping portion of the second image:


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)
}

Two overlapping rectangles showing the effect of the blend mode view

See Also 参照

Composites