EllipticalGradient

A radial gradient that draws an ellipse.

ComponentiOS 15.0+macOS 12.0+tvOS 15.0+watchOS 8.0+EllipticalGradient in SwiftUI

Declaration

React
import { EllipticalGradient } from 'swiftui-react-native';
Swift
@frozen nonisolated struct EllipticalGradient

Initializers

3 SwiftUI initializers back <EllipticalGradient>. The props you pass pick one.

React
<EllipticalGradient
  colors: SwiftUI.Color[]
  center?: SwiftUI.UnitPoint
  startRadiusFraction?: number
  endRadiusFraction?: number
/>
Swift
nonisolated init(
    colors: [Color],
    center: UnitPoint = .center,
    startRadiusFraction: CGFloat = 0,
    endRadiusFraction: CGFloat = 0.5
)
  • colors*SwiftUI.Color[]

    The colors, evenly distributed throughout the gradient.

  • The center of the circle, in [0, 1] coordinates.

    Default `.center`

  • startRadiusFractionnumber

    The start radius value, as a fraction between zero and one. Zero maps to the center point, one maps to the diameter of the unit circle.

    Default `0`

  • endRadiusFractionnumber

    The end radius value, as a fraction between zero and one. Zero maps to the center point, one maps to the diameter of the unit circle.

    Default `0.5`

Also takes the common view props: modifiers, style and testID.

See also

More in Colors and gradients.