The goal of this project is to create a UIView that can generate a Ken Burns transition when given an array of UIImage objects.
To use it, you simply need an instance of JBKenBurnsView and call this method to start the action:
[self.kenView animateWithImages:myImages
transitionDuration:6
initialDelay:0
loop:YES
isLandscape:YES];I recommend use CocoaPods to install JBKenBurnsView. Simply add the following line to your Podfile:
pod 'JBKenBurnsView'But you can also just drop JBKenBurnsView.m and JBKenBurnsView.h in your project.
The project is documented using AppleDocs syntax. But this is a summary:
You can start an animation using an NSArray of UIImage or NSString with the paths to the images calling:
- (void)animateWithImages:(NSArray *)images
transitionDuration:(float)time
initialDelay:(float)delay
loop:(BOOL)isLoop
isLandscape:(BOOL)isLandscape;or
- (void)animateWithImagePaths:(NSArray *)imagePaths
transitionDuration:(float)time
initialDelay:(float)delay
loop:(BOOL)isLoop
isLandscape:(BOOL)isLandscape;images:NSArray of UIImages.time:Time in seconds for the transition between images.delay:Time in seconds until the transition should start.isLoop:YES if the animation should start again when ended.isLandscape:If YES optimized to show in Landscape mode.
When the transition has started you can stop the animation calling:
- (void)stopAnimation;
Or add new images to the array of images in the slide show with:
- (void)addImage:(UIImage *)image;
There is a protocol that notifies to the delegate when an image changes or the slideshow ended.
@protocol KenBurnsViewDelegate <NSObject>
@optional
- (void)kenBurns:(JBKenBurnsView *)kenBurns didShowImage:(UIImage *)image atIndex:(NSUInteger)index;
- (void)kenBurns:(JBKenBurnsView *)kenBurns didFinishAllImages:(NSArray *)images;
@end- Need to allow device rotation.
- Improvements on image transition effects.
Build and run the KenBurnsDemo project in Xcode to see JBKenBurnsView in action.
- If you found a bug, open an issue.
- If you have a feature request, open an issue.
- If you want to contribute, submit a pull request.
Thanks a lot to all the people that have collaborated on this library:
- Peter Steinberger @steipete
- Orta @orta
- Almas Adilbek @mixdesign
- Boska @boska
- Alec Gorge @alecgorge
- @scgpilot
- @michaelcho
- @mystersu
Javier Berlana
JBKenBurnsView is available under the MIT license. See the LICENSE file for more info.
-- ###SweetBits, welcome to the candy factory.###
