Initializer

init(gradient:center:startRadiusFraction:endRadiusFraction:)

Creates an elliptical gradient.

Declaration 宣言

init(gradient: Gradient, center: UnitPoint = .center, startRadiusFraction: CGFloat = 0, endRadiusFraction: CGFloat = 0.5)

Discussion 議論

For example, an elliptical gradient centered on the top-leading corner of the view:


EllipticalGradient(
    gradient: .init(colors: [.blue, .green]),
    center: .topLeading,
    startRadiusFraction: 0,
    endRadiusFraction: 1)
  • gradient: The colors and their parametric locations.

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

  • startRadiusFraction: 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.

  • endRadiusFraction: 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.

See Also 参照

Creating an Elliptical Gradient