Hi, thanks for the great library.
I found when calling the proxy.move function in onAppear, it doesn't correctly set the position. My code is like this:
struct ConfettiView: View {
var body: some View {
VortexViewReader { proxy in
ZStack {
Text("Tap anywhere to create confetti.")
VortexView(.confetti.makeUniqueCopy()) {
Rectangle()
.fill(.white)
.frame(width: 16, height: 16)
.tag("square")
Circle()
.fill(.white)
.frame(width: 16)
.tag("circle")
}
.onTapGesture { location in
proxy.move(to: location) // works fine
proxy.burst()
}
.onAppear {
proxy.move(to: CGPoint(x: 0, y: 0)) // doesn't work
proxy.burst()
}
}
}
.navigationSubtitle("Demonstrates on-demand particle bursting")
.ignoresSafeArea(edges: .top)
}
}
I think the reason is that the nearestVortexSystem has not been set during onAppear.
What I want is to set an initial position for burst. Is there any workaround? Thanks!
Hi, thanks for the great library.
I found when calling the
proxy.movefunction in onAppear, it doesn't correctly set the position. My code is like this:I think the reason is that the
nearestVortexSystemhas not been set during onAppear.What I want is to set an initial position for burst. Is there any workaround? Thanks!