From the course: Advanced iOS App Development: Core Animation

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Working with springs, part 1

Working with springs, part 1 - iOS Tutorial

From the course: Advanced iOS App Development: Core Animation

Start my 1-month free trial

Working with springs, part 1

- [Instructor] Alright, so our fade in animation is nice and simple but I want our screen to have a little bit of dynamic movement. So we're gonna use a spring animation to move the sign in button up from off-screen bottom. Let's go into our SignInViewController and underneath the fadeInViews Let's make ourselves some room, declare new function called animateButtonWithSpring Again this is just for organization and to keep things a little easier to read. The first thing we need to do is create a spring animation instance. So we've already done this, so let's say, let moveUp we'll call it. And this is going to be of type CASpringAnimation Now a spring animation can be initialized with a key path just like a basic animation but we actually don't have the key path we need in our animation helper. So let's go back into the animation helper class. And say static var posY Because we want it to move up and down the y-axis and the string for this is position.y Now for our sign in view…

Contents