Canvatorium Visio Lab 5007
Using View offset to explore window bounds.
I was wondering where the window bounds were and when clipping would start. It seems the X and Y bounds are based on the window size. The Z bounds are a bit different. A view can be offset only slightly behind the window before it clips. It can be offset 650 points in front of the window before it clips.
struct Lab5007: View {
@State var xValue: CGFloat = 0
@State var yValue: CGFloat = 0
@State var zValue: CGFloat = 10
var body: some View {
ZStack() {
Form {
Text("X Axis: \(xValue)")
Slider(value: $xValue, in: -360...360)
Text("Y Axis: \(yValue)")
Slider(value: $yValue, in: -360...360)
Text("Z Axis: \(zValue)")
Slider(value: $zValue, in: -660...660)
}
Rectangle()
.foregroundStyle(.blue)
.frame(width: 100, height: 100)
.hoverEffect(.automatic, isEnabled: true)
.cornerRadius(24)
.shadow(radius: 20)
.offset(x: xValue, y: yValue)
.offset(z: zValue)
}.padding(.top, 20)
}
}