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

scaleEffect(x:y:anchor:)

Scales this view’s rendered output by the given horizontal and vertical amounts, relative to an anchor point. このビューのもつ描出された出力をこの与えられた水平と垂直の量によって、あるアンカーポイントに関して、拡大縮小します。

Declaration 宣言

func scaleEffect(x: CGFloat = 1.0, y: CGFloat = 1.0, anchor: UnitPoint = .center) -> some View

Parameters パラメータ

x

An amount that represents the horizontal amount to scale the view. The default value is 1.0.

y

An amount that represents the vertical amount to scale the view. The default value is 1.0.

anchor

The anchor point that indicates the starting position for the scale operation.

Discussion 議論

Use scaleEffect(x:y:anchor:) to apply a scaling transform to a view by a specific horizontal and vertical amount.


Image(systemName: "envelope.badge.fill")
    .resizable()
    .frame(width: 100, height: 100, alignment: .center)
    .foregroundColor(Color.red)
    .scaleEffect(x: 0.5, y: 0.5, anchor: .bottomTrailing)
    .border(Color.gray)

A screenshot showing a 100x100 pixel red envelope scaled down 50% in