Custom transitions

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>
@interface SPTransitions (CustomTransitions)
+ (float)easeOutElasticShort:(float)ratio;
#import "SPTransitions+CustomTransitions.h"
@implementation SPTransitions (CustomTransitions)
+ (float)easeOutElasticShort:(float)ratio
    if (ratio == 0.0f || ratio == 1.0f) return ratio;
        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;
  tutorials/custom_transitions.txt · Last modified: 2013/03/05 10:19 by
Powered by DokuWiki