A function that receives a
VisualEffectBuilder and a GeometryProxy, and returns the builder with effects chained onto it. The proxy provides layout information (size, position, safe area insets) that can drive the effect values.VisualEffectBuilder Methods
The builder supports the following chainable methods:blur(radius)— applies a Gaussian bluropacity(amount)— sets opacity (0 to 1)offset({ x, y })— offsets the componentscale(value)orscale({ x, y })— scales uniformly or per-axistransform(matrix)— applies a full 2D affine transformtranslation({ x, y })— translates the componentrotation(degrees),rotation({ degrees }), orrotation({ radians })— rotates the component
GeometryProxy Properties
The proxy provides layout information about the component:size—{ width, height }of the componentsafeAreaInsets—{ top, leading, bottom, trailing }frame(coordinateSpace)— returns aGeometryRectwithminX,minY,maxX,maxY,width,height,midX,midYbounds(coordinateSpace)— returns the bounds of a named coordinate space
"global", "local", "scrollView", or a custom name registered via .coordinateSpace().
Support
Usage
Scroll-driven opacity
Fade a component based on its position within a scroll view.Parallax effect
Scale and blur on scroll
Size-based rotation
Notes
- The callback is re-evaluated whenever the component’s geometry changes (e.g., during scrolling or resizing).
- Effects applied through the builder do not affect the component’s layout. They are purely visual transforms.
- Use
.coordinateSpace()on a parent to create named coordinate spaces that can be referenced inproxy.frame().