Animate an imageView to look like it's floating in space?

off-topic

#1

I have an imageView that has an astronaut set as it's image. I want to animate it to look like it's floating in space. (have random movement and rotation, bounce back from the edge of the screen)


(Kyle Murray) #2

Hey Kristof,

If you want your astronaut asset to float along in a 2D plane, you might want to check out SpriteKit. In particular, Getting Started with Physics and Making Physics Bodies Move.

If you’re good at specifying manual animations, you could alternatively approximate a physics simulation by using hardcoded values, but there are tradeoffs involved. (The floating will only look as realistic as your animation skills permit, essentially, and it’ll be harder to incorporate random variations.)

Speaking of tradeoffs, folks who frequent these Swift forums tend to have a large appetite for Swift language questions, but have diverse specializations in other areas of programming and app development. You might find a more focused crowd for displaying floating astronaut images somewhere on the Apple Developer Forums for relevant frameworks.