This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
tutorials:custom_transitions [2011/07/01 17:59] – created daniel | tutorials:custom_transitions [2013/03/05 10:19] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== Custom transitions ====== | ||
+ | To add a custom transition, you just have to extend the '' | ||
+ | |||
+ | <code objc SPTransitions+CustomTransitions.h> | ||
+ | #import < | ||
+ | |||
+ | #define SPCT_TRANSITION_EASE_OUT_ELASTIC_SHORT @" | ||
+ | |||
+ | @interface SPTransitions (CustomTransitions) | ||
+ | |||
+ | + (float)easeOutElasticShort: | ||
+ | |||
+ | @end | ||
+ | </ | ||
+ | |||
+ | <code objc SPTransitions+CustomTransitions.m> | ||
+ | #import " | ||
+ | |||
+ | @implementation SPTransitions (CustomTransitions) | ||
+ | |||
+ | + (float)easeOutElasticShort: | ||
+ | { | ||
+ | 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/ | ||
+ | } | ||
+ | } | ||
+ | |||
+ | @end | ||
+ | </ |