Home > Mobile >  Animating an image to slide out of the side of a view with iOS Swift
Animating an image to slide out of the side of a view with iOS Swift

Time:10-03

I'm making an animated splash screen which displays my logo. Initially an icon appears in the center of the screen which then transitions to the left side of the screen, and while doing so reveals the rest of the logo which slides out of the right side of the moving icon. I can move the icon to the left, that part is straightforward. What I need help with is revealing the image from the side of the icon. To help visualise what I mean I have made this (crude) animated gif of what I need to achieve:

enter image description here

CodePudding user response:

An image is displayed in an image view. If the image view is set with its content mode to Right, then it suffices to start with the image view at width zero and animate its width to get wider and wider, thus (as you say) "revealing" more and more of the image from the left.

  • Related