To add a custom transition, you just have to extend the SPTransitions
class using a category, and add your custom transition. The name of the transition method will be the name that you have to use when you create the tween. Here is a sample:
#import <Foundation/Foundation.h> #define SPCT_TRANSITION_EASE_OUT_ELASTIC_SHORT @"easeOutElasticShort" @interface SPTransitions (CustomTransitions) + (float)easeOutElasticShort:(float)ratio; @end
#import "SPTransitions+CustomTransitions.h" @implementation SPTransitions (CustomTransitions) + (float)easeOutElasticShort:(float)ratio { if (ratio == 0.0f || ratio == 1.0f) return ratio; else { float bounce_factor = -5.0f; float p = 0.6f; float s = p / 4.0f; return powf(2.0f, bounce_factor*ratio) * sinf((ratio-s)*TWO_PI/p) + 1.0f; } } @end