Algunos de los efectos más usados sobre las vistas son:
-
shadow(_:). Recibe unShadowStyleque puede serdrop(color:radius:x:y:)oinner(color:radius:x:y:). opacity(_:)-
blendMode(_:)Combina vistas. Recibe como parámetronormal,darken,multiply,colorBurn,plusDarker,lighten,screen,colorDodge,plusLighter,overlay,softLight,hardLight,difference,exclusion,hue,saturation,color,luminosity,sourceAtop,destinationOver,destinationOut. -
ImagePaint.image(_:sourceRect:scale:)
struct ContentView: View {
var body: some View {
HStack {
Color.yellow.frame(width: 50, height: 50, alignment: .center)
Color.red.frame(width: 50, height: 50, alignment: .center)
.rotationEffect(.degrees(45))
.padding(-20)
.blendMode(.colorBurn)
}
}
}
struct ContentView: View {
var body: some View {
RoundedRectangle(cornerRadius: 10)
.foregroundStyle(
.shadow(.drop(color: .black, radius: 3, x: 10, y: 10))
)
.foregroundStyle(.blue)
.frame(width: 200, height: 200)
.padding()
}
}
struct ContentView: View {
var body: some View {
RoundedRectangle(cornerRadius: 10)
.foregroundStyle(
.image(Image("img1"),
sourceRect: .init(x: 0, y: 0, width: 1, height: 0.5),
scale: 0.04)
)
.frame(width: 200, height: 200)
.padding()
}
}



Top comments (0)