Creating a moving object

Hello all,

Can anyone recommend a good link to learn how to create moving images in swiftui? What I’m trying to do is get an image to appear and randomly bounce around the screen.

I haven’t dove into SwiftUI, but begin looking at animation!

Thank you I certainly am lol.

1 Like

Just incase anyone else had this issue heres the code i used to animate my image:

Image(“Grenade”)
.renderingMode(.original)
.rotationEffect(Angle(degrees: 20))
.aspectRatio(contentMode: .fit)
.frame(width: 100, height: 100)
.edgesIgnoringSafeArea(.all)
.rotationEffect(.degrees(self.grenadeSpin ? -360: 0))
.offset(x: grenadeSpin ? 0 : 0, y: grenadeSpin ? 250 : 600)
.onAppear() { self.grenadeSpin.toggle()}
.animation(Animation.spring(response: 15, dampingFraction: 0, blendDuration: 0).speed(1.5).delay(2))
.onTapGesture(perform: {self.endGame()})

it doesnt randomly bounce around the screen but it moves on and off screen while spinning around.