Canvatorium Visio Lab 5018
Glass Ornaments & Materials.
Using glass effect and materials on Ornament.
This lab is in answer to a question on a previous video about Ornaments.
struct Lab5018: View {
@State var selected = "Apple"
var body: some View {
ZStack {
VStack(spacing: 10) {
Text("Selected value")
Text(selected)
}
.padding(100)
.ornament(attachmentAnchor: .scene(.bottom)) {
HStack {
Button("Apple") {
selected = "Apple"
}
.background(selected == "Apple" ? .thinMaterial : .thickMaterial)
.glassBackgroundEffect()
Button("Banana") {
selected = "Banana"
}
.background(selected == "Banana" ? .thinMaterial : .thickMaterial)
.glassBackgroundEffect()
Button("Orange") {
selected = "Orange"
}
.background(selected == "Orange" ? .thinMaterial : .thickMaterial)
.glassBackgroundEffect()
}
.padding(8)
.glassBackgroundEffect()
}
}
}
}