fix: PhysicsModifier body function + Angle type
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -211,14 +211,14 @@ struct PhysicsModifier: ViewModifier {
|
|||||||
private let gravity: CGFloat = 0.6
|
private let gravity: CGFloat = 0.6
|
||||||
private let duration: Double = 1.6
|
private let duration: Double = 1.6
|
||||||
|
|
||||||
var body: some View {
|
func body(content: Content) -> some View {
|
||||||
let x = startX + vx * time
|
let x = startX + vx * time
|
||||||
let y = startY + vy * time + 0.5 * gravity * time * time
|
let y = startY + vy * time + 0.5 * gravity * time * time
|
||||||
|
|
||||||
content
|
content
|
||||||
.offset(x: x, y: y)
|
.offset(x: x, y: y)
|
||||||
.opacity(opacity)
|
.opacity(opacity)
|
||||||
.rotationEffect(.degrees(spin * Double(time / 30)))
|
.rotationEffect(Angle.degrees(spin * Double(time / 30)))
|
||||||
.onAppear {
|
.onAppear {
|
||||||
withAnimation(.easeOut(duration: duration).delay(delay)) {
|
withAnimation(.easeOut(duration: duration).delay(delay)) {
|
||||||
time = 30
|
time = 30
|
||||||
|
|||||||
Reference in New Issue
Block a user