Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue #13 The initial position set for burst #15

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 23 additions & 16 deletions Sandbox/Sandbox/PreviewViews/ConfettiView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,31 @@ import Vortex
/// A sample view demonstrating confetti bursts.
struct ConfettiView: View {
var body: some View {
VortexViewReader { proxy in
ZStack {
Text("Tap anywhere to create confetti.")
GeometryReader { geometry in
VortexViewReader { proxy in
ZStack {
Text("Tap anywhere to create confetti.")

VortexView(.confetti.makeUniqueCopy()) {
Rectangle()
.fill(.white)
.frame(width: 16, height: 16)
.tag("square")
VortexView(.confetti.makeUniqueCopy()) {
Rectangle()
.fill(Color.white)
.frame(width: 16, height: 16)
.tag("square")

Circle()
.fill(.white)
.frame(width: 16)
.tag("circle")
}
.onTapGesture { location in
proxy.move(to: location)
proxy.burst()
Circle()
.fill(Color.white)
.frame(width: 16)
.tag("circle")
}
.onTapGesture { location in
proxy.move(to: location) // works fine
proxy.burst()
}
.onAppear {
let initialPosition = CGPoint(x: geometry.size.width / 2, y: geometry.size.height / 2)
proxy.move(to: initialPosition) // should work now
proxy.burst()
}
}
}
}
Expand Down