scaleEffect
Scales this view's rendered output by the given amount in both the horizontal and vertical directions, relative to an anchor point.
View ModifieriOS 13.0+macOS 10.15+tvOS 13.0+watchOS 6.0+visionOS 1.0+
Overloads
3 ways to call compose().scaleEffect(). Each is one SwiftUI overload, picked by the arguments you pass.
compose().scaleEffect(
s: number,
options?: {
anchor?: SwiftUI.UnitPoint;
}
)nonisolated func scaleEffect(
_ s: CGFloat,
anchor: UnitPoint = .center
) -> ModifiedContent<Self, _UniformScaleEffect>1 more Swift overload share this form
nonisolated func scaleEffect(
_ s: CGFloat,
anchor: UnitPoint = .center
) -> some ViewParameters
s*numberThe amount to scale the view in the view in both the horizontal and vertical directions.
options.anchorSwiftUI.UnitPointThe anchor point with a default of
UnitPoint.centerthat 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)See also
More in Visual effects.
- allowedDynamicRangeReturns a new view configured with the specified allowed dynamic range.
- backgroundExtensionEffectAdds the background extension effect to the view. The view will be duplicated into mirrored copies which will be placed around the view on any edge with available safe area. Additionally, a blur effect will be applied on top to blur out the copies.
- blurApplies a Gaussian blur to this view.
- brightnessBrightens this view by the specified amount.
- clippedClips this view to its bounding rectangular frame.
- colorEffectReturns a new view that applies shader to self as a filter effect on the color of each pixel.
- colorInvertInverts the colors in this view.
- colorMultiplyAdds a color multiplication effect to this view.
- compositingGroupWraps this view in a compositing group.
- contrastSets the contrast and separation between similar colors in this view.
- distortionEffectReturns a new view that applies shader to self as a geometric distortion effect on the location of each pixel.
- drawingGroupComposites this view's contents into an offscreen image before final display.