DSControls 0.9.1

DSControls 0.9.1

Maintained by DimasSup.



  • By
  • DimasSup

DSControls

CI Status Version License Platform

Documentation

UIView animations

DSViewOneAnimation

One animation block item

DSVAnimation(0.4,^{
view.alpha = 0;
},^(BOOL finished){}).run;
DSVAnimation_Delay(0.5, 1, UIViewAnimationOptionCurveEaseIn, ^{
view1.alpa = 1;
view2.frame = CGRectMake(0, 0, 320, 50);
}, ^(BOOL result){});
DSVAnimation_Full(0.5, 1, UIViewAnimationOptionCurveEaseIn, 0.5, 0.5, ^{
view1.alpa = 1;
view2.frame = CGRectMake(0, 0, 320, 50);
}, ^(BOOL result){}).run;

Also you can use class methods -

+(DSViewOneAnimation*)animationWithDuration:(NSTimeInterval)duration delay:(NSTimeInterval)delay animationOptions:(UIViewAnimationOptions)options actionBlock:(DSStartAnimationBlock)action finishBlock:(DSCompleteAnimationBlock)finishBlock;

+(DSViewOneAnimation*)animationWithDuration:(NSTimeInterval)duration actionBlock:(DSStartAnimationBlock)action finishBlock:(DSCompleteAnimationBlock)finishBlock;

+(DSViewOneAnimation*)animationWithDuration:(NSTimeInterval)duration delay:(float)delay animationOptions:(UIViewAnimationOptions)options springDamping:(float)damping springVelocity:(float)springVelocity actionBlock:(DSStartAnimationBlock)action finishBlock:(DSCompleteAnimationBlock)finishBlock;

After create animation you can run it with instance method [animation run]

DSViewAnimationSequence

Animations sequence, do all animations one by one. Callback will be called when all animations will be finished. Add animations to sequence with instance method:

-(void)addAnimation:(__kindof DSViewBaseAnimation*)anim;

Create sequence:

DSVASequence(animation,...)

or with class method :

+(DSViewAnimationSequence*)sequenceWithAnimations:(__kindof DSViewBaseAnimation*)animations,... NS_REQUIRES_NIL_TERMINATION;

After create animation you can run it with instance method [animation run]

  • NOTE: you can add DSViewOneAnimation , DSViewAnimationSequence and DSViewGroupAnimation as animation in sequence *

DSViewGroupAnimation

Animations group. Run all animations in same time. Callback will be called when a longest animation will be finished ( * NOTE: longest animation calculated by animation.fullDuration * )

Add animations to sequence with instance method:

-(void)addAnimation:(__kindof DSViewBaseAnimation*)anim;

Create sequence:

DSVAGroup(animation,...)

or with class method :

+(DSViewGroupAnimation *)groupWithAnimations:(__kindof DSViewBaseAnimation *)animations, ... NS_REQUIRES_NIL_TERMINATION;

After create animation you can run it with instance method [animation run]

NOTE: you can add DSViewOneAnimation , DSViewAnimationSequence and DSViewGroupAnimation as animation in group

DSViewAnimationStack

Run animations one by one, First IN First OUT. You can create it manualy or get instance for each UIView with instance method:

[UIView -(DSViewAnimationsStack*)defaultAnimationsStack];

or just push animation to instance stack with instance method:

[UIView -(void)pushAnimationToStack:(__kindof DSViewBaseAnimation*)animation];

You can add more than one instance of Animations Stack for each UIView with using class method:

[UIView +(DSViewAnimationsStack*)animationsStackForView:(UIView*)view withName:(NSString*)name];

Add animation to stack:

[DSViewAnimationsStack -(void)pushAnimation:(__kindof DSViewBaseAnimation*)animation];

NOTE: Animations in stacks start immediately after add to stack if there are no active animation

NOTE: you can add DSViewOneAnimation , DSViewAnimationSequence and DSViewGroupAnimation as animation in group

CALayerAnimations

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Requirements

Installation

DSControls is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'DSControls'

Author

DimasSup, [email protected]

License

DSControls is available under the MIT license. See the LICENSE file for more info.