DEV Community

GoyesDev
GoyesDev

Posted on

[SUI] Efectos

Algunos de los efectos más usados sobre las vistas son:

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)
    }
  }
}
Enter fullscreen mode Exit fullscreen mode


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()
  }
}
Enter fullscreen mode Exit fullscreen mode


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()
  }
}
Enter fullscreen mode Exit fullscreen mode


Bibliografía

Top comments (0)