TestsTested | ✗ |
LangLanguage | Obj-CObjective C |
License | MIT |
ReleasedLast Release | Nov 2015 |
Maintained by Draveness, draveness.
The Objective-C library for magical scroll interactions. This library is inspired by javascript lib scroll magic. You can create magical scroll interactions with Ouroboros
.
To run the example project, clone the repo, and run pod install
from the Example directory first.
Ouroboros is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod "Ouroboros"
#import "Ouroboros.h"
Add animation to a view
is extremely easy. Call ouroboros
first, and then invoke animateWithProperty:configureBlock:
method.
[view.ouroboros animateWithProperty:OURAnimationPropertyViewBackgroundColor
configureBlock:^(Ouroboros *ouroboros) {
ouroboros.toValue = [UIColor blueColor];
ouroboros.trigger = 0;
ouroboros.duration = 100;
}];
You should pass a type of OURAnimationProperty
to this method, and set up the ouroboros
instance in the block. And that's it.
trigger
is the point when the animation start and offset
is the distance the animation occurs.
typedef enum : NSUInteger {
OURAnimationPropertyViewFrame,
OURAnimationPropertyViewBounds,
OURAnimationPropertyViewSize,
OURAnimationPropertyViewCenter,
OURAnimationPropertyViewPosition,
OURAnimationPropertyViewOrigin,
OURAnimationPropertyViewOriginX,
OURAnimationPropertyViewOriginY,
OURAnimationPropertyViewWidth,
OURAnimationPropertyViewHeight,
OURAnimationPropertyViewCenterX,
OURAnimationPropertyViewCenterY,
OURAnimationPropertyViewBackgroundColor,
OURAnimationPropertyViewTintColor,
OURAnimationPropertyViewAlpha,
OURAnimationPropertyViewTransform,
} OURAnimationProperty;
There are two animation directions for scrollView
, if you want to animate according to contentOffset.x
. You should change the scrollView
property ou_scrollDirection
to OURScrollDirectionHorizontal
.
typedef enum : NSUInteger {
OURScrollDirectionVertical,
OURScrollDirectionHorizontal,
} OURScrollDirection;
OURScrollDirectionVertical
is the default behavior for each scrollView
which will animate when contentOffset.y
of scrollView
changes.
Draveness, [email protected]
Ouroboros is available under the MIT license. See the LICENSE file for more info.