scaleEffect(_:anchor:)
Scales this view’s rendered output by the given amount in both the horizontal and vertical directions, relative to an anchor point.
Declaration
nonisolated func scaleEffect(_ s: CGFloat, anchor: UnitPoint = .center) -> ModifiedContent<Self, _UniformScaleEffect>Parameters
- s:
The amount to scale the view in the view in both the horizontal and vertical directions.
- anchor:
The anchor point with a default of Center that indicates the starting position for the scale operation.
Discussion
Use scaleEffect(_:anchor:) to apply a horizontally and vertically scaling transform to a view.
Image(systemName: "envelope.badge.fill")
.resizable()
.frame(width: 100, height: 100, alignment: .center)
.foregroundColor(Color.red)
.scaleEffect(2, anchor: .leading)
.border(Color.gray)[Image]
See Also
Scaling, rotating, or transforming a view
scaledToFill()scaledToFit()scaleEffect(x:y:anchor:)scaleEffect(x:y:z:anchor:)aspectRatio(_:contentMode:)rotationEffect(_:anchor:)rotation3DEffect(_:axis:anchor:anchorZ:perspective:)perspectiveRotationEffect(_:axis:anchor:anchorZ:perspective:)rotation3DEffect(_:anchor:)rotation3DEffect(_:axis:anchor:)transformEffect(_:)transform3DEffect(_:)projectionEffect(_:)ProjectionTransformContentMode