Rectangle()
.fill(
RadialGradient.radialGradient(
colors: [.blue, .yellow],
center: UnitPoint(x:0.5, y:0.5),
startRadius: 0,
endRadius: 50)
)
.frame(width: 100, height: 100)
In the above code I have a Rectangle with simple radial gradient as follow:
I wanna apply an arbitrary transformation matrix to the gradient so I can achieve following effects:
I tried following.. but it applying the transformation matrix to frame instead of shader/gradient
Rectangle()
.overlay(
RadialGradient.radialGradient(
colors: [.blue, .yellow],
center: UnitPoint(x:0.5, y:0.5),
startRadius: 0,
endRadius: 50)
.transformEffect(
CGAffineTransform(
-0.5000000596046448, 0.4999999403953552,
-0.972577691078186, -0.9725777506828308,
0.5000000596046448, 1.4725778102874756)
.translatedBy(x: -50, y: -100)
)
)
.frame(width: 100, height: 100)
it result in transformation of frame intreat of shader/gradient:
Thanks in advance 🙌🏻