aryaxt / iOS-Slide-Menu

iOS Slide Menu with ability to add both left and right menu, and built in gesture recognizer. Similar to Path and Facebook
Other
1.53k stars 359 forks source link

Use Key frame animation #20

Closed CoderXpert closed 10 years ago

CoderXpert commented 10 years ago

Hi; Its really a great work. Thumbs up for you. Only one recommendation use key frame animation in bounce function rather to have nested loops. That will make your code much readable. Regards

aryaxt commented 10 years ago

I know that method is a mess :) But the thing is every bounce has a different movement-size and time-frame. I'm wondering if using Core Animation directly would make it cleaner. Will give it a shot.

CoderXpert commented 10 years ago

iOS 7 key frame animation is actually to solve this chain animation stuff. You can have entirely different animation for specific keyframe. Here is small example. Animation with keyframes [UIView animateKeyframesWithDuration:duration delay:0.0 options:UIViewKeyframeAnimationOptionCalculationModeCubic animations:^{ // a. keyframe one [UIView addKeyframeWithRelativeStartTime:0.0 relativeDuration:0.5 animations:^{ // animation }]; // b. keyframe two [UIView addKeyframeWithRelativeStartTime:0.5 relativeDuration:0.5 animations:^{ //Animation }]

aryaxt commented 10 years ago

I spent a lot of time getting the SlideMenu to work on both iOS6 and iOS7, probably won't use iOS7 API for anything anytime soon :)

But thanks for the info. It would definitely simplify the code.