Added the convenient transition with duration APIs
This commit is contained in:
parent
964864f243
commit
c9ef6ce541
|
@ -83,7 +83,7 @@ typedef void (^SDWebImageTransitionCompletionBlock)(BOOL finished);
|
||||||
*/
|
*/
|
||||||
@interface SDWebImageTransition (Conveniences)
|
@interface SDWebImageTransition (Conveniences)
|
||||||
|
|
||||||
/// Fade transition.
|
/// Fade-in transition.
|
||||||
@property (nonatomic, class, nonnull, readonly) SDWebImageTransition *fadeTransition;
|
@property (nonatomic, class, nonnull, readonly) SDWebImageTransition *fadeTransition;
|
||||||
/// Flip from left transition.
|
/// Flip from left transition.
|
||||||
@property (nonatomic, class, nonnull, readonly) SDWebImageTransition *flipFromLeftTransition;
|
@property (nonatomic, class, nonnull, readonly) SDWebImageTransition *flipFromLeftTransition;
|
||||||
|
@ -98,6 +98,34 @@ typedef void (^SDWebImageTransitionCompletionBlock)(BOOL finished);
|
||||||
/// Curl down transition.
|
/// Curl down transition.
|
||||||
@property (nonatomic, class, nonnull, readonly) SDWebImageTransition *curlDownTransition;
|
@property (nonatomic, class, nonnull, readonly) SDWebImageTransition *curlDownTransition;
|
||||||
|
|
||||||
|
/// Fade-in transition with duration.
|
||||||
|
/// @param duration transition duration, use ease-in-out
|
||||||
|
+ (nonnull instancetype)fadeTransitionWithDuration:(NSTimeInterval)duration NS_SWIFT_NAME(fade(duration:));
|
||||||
|
|
||||||
|
/// Flip from left transition with duration.
|
||||||
|
/// @param duration transition duration, use ease-in-out
|
||||||
|
+ (nonnull instancetype)flipFromLeftTransitionWithDuration:(NSTimeInterval)duration NS_SWIFT_NAME(flipFromLeft(duration:));
|
||||||
|
|
||||||
|
/// Flip from right transition with duration.
|
||||||
|
/// @param duration transition duration, use ease-in-out
|
||||||
|
+ (nonnull instancetype)flipFromRightTransitionWithDuration:(NSTimeInterval)duration NS_SWIFT_NAME(flipFromRight(duration:));
|
||||||
|
|
||||||
|
/// Flip from top transition with duration.
|
||||||
|
/// @param duration transition duration, use ease-in-out
|
||||||
|
+ (nonnull instancetype)flipFromTopTransitionWithDuration:(NSTimeInterval)duration NS_SWIFT_NAME(flipFromTop(duration:));
|
||||||
|
|
||||||
|
/// Flip from bottom transition with duration.
|
||||||
|
/// @param duration transition duration, use ease-in-out
|
||||||
|
+ (nonnull instancetype)flipFromBottomTransitionWithDuration:(NSTimeInterval)duration NS_SWIFT_NAME(flipFromBottom(duration:));
|
||||||
|
|
||||||
|
/// Curl up transition with duration.
|
||||||
|
/// @param duration transition duration, use ease-in-out
|
||||||
|
+ (nonnull instancetype)curlUpTransitionWithDuration:(NSTimeInterval)duration NS_SWIFT_NAME(curlUp(duration:));
|
||||||
|
|
||||||
|
/// Curl down transition with duration.
|
||||||
|
/// @param duration transition duration, use ease-in-out
|
||||||
|
+ (nonnull instancetype)curlDownTransitionWithDuration:(NSTimeInterval)duration NS_SWIFT_NAME(curlDown(duration:));
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -84,6 +84,10 @@ CATransition * SDTransitionFromAnimationOptions(SDWebImageAnimationOptions optio
|
||||||
@implementation SDWebImageTransition (Conveniences)
|
@implementation SDWebImageTransition (Conveniences)
|
||||||
|
|
||||||
+ (SDWebImageTransition *)fadeTransition {
|
+ (SDWebImageTransition *)fadeTransition {
|
||||||
|
return [self fadeTransitionWithDuration:0.5];
|
||||||
|
}
|
||||||
|
|
||||||
|
+ (SDWebImageTransition *)fadeTransitionWithDuration:(NSTimeInterval)duration {
|
||||||
SDWebImageTransition *transition = [SDWebImageTransition new];
|
SDWebImageTransition *transition = [SDWebImageTransition new];
|
||||||
#if SD_UIKIT
|
#if SD_UIKIT
|
||||||
transition.animationOptions = UIViewAnimationOptionTransitionCrossDissolve | UIViewAnimationOptionAllowUserInteraction;
|
transition.animationOptions = UIViewAnimationOptionTransitionCrossDissolve | UIViewAnimationOptionAllowUserInteraction;
|
||||||
|
@ -94,6 +98,10 @@ CATransition * SDTransitionFromAnimationOptions(SDWebImageAnimationOptions optio
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (SDWebImageTransition *)flipFromLeftTransition {
|
+ (SDWebImageTransition *)flipFromLeftTransition {
|
||||||
|
return [self flipFromLeftTransitionWithDuration:0.5];
|
||||||
|
}
|
||||||
|
|
||||||
|
+ (SDWebImageTransition *)flipFromLeftTransitionWithDuration:(NSTimeInterval)duration {
|
||||||
SDWebImageTransition *transition = [SDWebImageTransition new];
|
SDWebImageTransition *transition = [SDWebImageTransition new];
|
||||||
#if SD_UIKIT
|
#if SD_UIKIT
|
||||||
transition.animationOptions = UIViewAnimationOptionTransitionFlipFromLeft | UIViewAnimationOptionAllowUserInteraction;
|
transition.animationOptions = UIViewAnimationOptionTransitionFlipFromLeft | UIViewAnimationOptionAllowUserInteraction;
|
||||||
|
@ -104,6 +112,10 @@ CATransition * SDTransitionFromAnimationOptions(SDWebImageAnimationOptions optio
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (SDWebImageTransition *)flipFromRightTransition {
|
+ (SDWebImageTransition *)flipFromRightTransition {
|
||||||
|
return [self flipFromRightTransitionWithDuration:0.5];
|
||||||
|
}
|
||||||
|
|
||||||
|
+ (SDWebImageTransition *)flipFromRightTransitionWithDuration:(NSTimeInterval)duration {
|
||||||
SDWebImageTransition *transition = [SDWebImageTransition new];
|
SDWebImageTransition *transition = [SDWebImageTransition new];
|
||||||
#if SD_UIKIT
|
#if SD_UIKIT
|
||||||
transition.animationOptions = UIViewAnimationOptionTransitionFlipFromRight | UIViewAnimationOptionAllowUserInteraction;
|
transition.animationOptions = UIViewAnimationOptionTransitionFlipFromRight | UIViewAnimationOptionAllowUserInteraction;
|
||||||
|
@ -114,6 +126,10 @@ CATransition * SDTransitionFromAnimationOptions(SDWebImageAnimationOptions optio
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (SDWebImageTransition *)flipFromTopTransition {
|
+ (SDWebImageTransition *)flipFromTopTransition {
|
||||||
|
return [self flipFromTopTransitionWithDuration:0.5];
|
||||||
|
}
|
||||||
|
|
||||||
|
+ (SDWebImageTransition *)flipFromTopTransitionWithDuration:(NSTimeInterval)duration {
|
||||||
SDWebImageTransition *transition = [SDWebImageTransition new];
|
SDWebImageTransition *transition = [SDWebImageTransition new];
|
||||||
#if SD_UIKIT
|
#if SD_UIKIT
|
||||||
transition.animationOptions = UIViewAnimationOptionTransitionFlipFromTop | UIViewAnimationOptionAllowUserInteraction;
|
transition.animationOptions = UIViewAnimationOptionTransitionFlipFromTop | UIViewAnimationOptionAllowUserInteraction;
|
||||||
|
@ -124,6 +140,10 @@ CATransition * SDTransitionFromAnimationOptions(SDWebImageAnimationOptions optio
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (SDWebImageTransition *)flipFromBottomTransition {
|
+ (SDWebImageTransition *)flipFromBottomTransition {
|
||||||
|
return [self flipFromBottomTransitionWithDuration:0.5];
|
||||||
|
}
|
||||||
|
|
||||||
|
+ (SDWebImageTransition *)flipFromBottomTransitionWithDuration:(NSTimeInterval)duration {
|
||||||
SDWebImageTransition *transition = [SDWebImageTransition new];
|
SDWebImageTransition *transition = [SDWebImageTransition new];
|
||||||
#if SD_UIKIT
|
#if SD_UIKIT
|
||||||
transition.animationOptions = UIViewAnimationOptionTransitionFlipFromBottom | UIViewAnimationOptionAllowUserInteraction;
|
transition.animationOptions = UIViewAnimationOptionTransitionFlipFromBottom | UIViewAnimationOptionAllowUserInteraction;
|
||||||
|
@ -134,6 +154,10 @@ CATransition * SDTransitionFromAnimationOptions(SDWebImageAnimationOptions optio
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (SDWebImageTransition *)curlUpTransition {
|
+ (SDWebImageTransition *)curlUpTransition {
|
||||||
|
return [self curlUpTransitionWithDuration:0.5];
|
||||||
|
}
|
||||||
|
|
||||||
|
+ (SDWebImageTransition *)curlUpTransitionWithDuration:(NSTimeInterval)duration {
|
||||||
SDWebImageTransition *transition = [SDWebImageTransition new];
|
SDWebImageTransition *transition = [SDWebImageTransition new];
|
||||||
#if SD_UIKIT
|
#if SD_UIKIT
|
||||||
transition.animationOptions = UIViewAnimationOptionTransitionCurlUp | UIViewAnimationOptionAllowUserInteraction;
|
transition.animationOptions = UIViewAnimationOptionTransitionCurlUp | UIViewAnimationOptionAllowUserInteraction;
|
||||||
|
@ -144,12 +168,17 @@ CATransition * SDTransitionFromAnimationOptions(SDWebImageAnimationOptions optio
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (SDWebImageTransition *)curlDownTransition {
|
+ (SDWebImageTransition *)curlDownTransition {
|
||||||
|
return [self curlDownTransitionWithDuration:0.5];
|
||||||
|
}
|
||||||
|
|
||||||
|
+ (SDWebImageTransition *)curlDownTransitionWithDuration:(NSTimeInterval)duration {
|
||||||
SDWebImageTransition *transition = [SDWebImageTransition new];
|
SDWebImageTransition *transition = [SDWebImageTransition new];
|
||||||
#if SD_UIKIT
|
#if SD_UIKIT
|
||||||
transition.animationOptions = UIViewAnimationOptionTransitionCurlDown | UIViewAnimationOptionAllowUserInteraction;
|
transition.animationOptions = UIViewAnimationOptionTransitionCurlDown | UIViewAnimationOptionAllowUserInteraction;
|
||||||
#else
|
#else
|
||||||
transition.animationOptions = SDWebImageAnimationOptionTransitionCurlDown;
|
transition.animationOptions = SDWebImageAnimationOptionTransitionCurlDown;
|
||||||
#endif
|
#endif
|
||||||
|
transition.duration = duration;
|
||||||
return transition;
|
return transition;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue