Latest 0.1.2
License MIT
Platforms ios 8.0, tvos 9.0, requires ARC


Build Status

Ken Burns effect with face recognition!

APKenBurnsView is UIView subclass which supports face recognition to beautifully animate people photos.



  • Face recognition feature to beautifully animate people photos.
  • Totally random algorithm. No more hardcoded values!
  • Memory efficient. Holds maximum of two UIImage pointers at any moment.
  • Pausing animations done right.
  • Auto restart after entering background and returning back.
  • A lot of animation customizations to fit your needs.

Face Recognition

APKenBurnsView supports three modes for face recognition:

  • None – no face recognition, simple Ken Burns effect.
  • Biggest – recognizes biggest face in image, if any then transition will start or finish (chosen randomly) in center of face rect.
  • Group – recognizes all faces in image, if any then transition will start or finish (chosen randomly) in center of compound rect of all faces.


Just simple interface. Provide data source class for UIImage’s, setup all timings and run startAnimations(). No rocket science!

Data source should be ready to provide next image at the moment when APKenBurnsView calls func nextImageForKenBurnsView(kenBurnsView: APKenBurnsView) -> UIImage?. If there is no UIImage ready (still loading from network, etc.) then data source should return nil and APKenBurnsView will animate last image one more time. If you are loading your images from network you should consider some preloading mechanism.

Example of usage:

class MyViewController: UIViewController {
    // MARK: - Outlets 
    @IBOutlet weak var kenBurnsView: APKenBurnsView!

    // MARK: - Lifecycle
    override func viewDidLoad() {

        kenBurnsView.dataSource = self
        kenBurnsView.faceRecognitionMode = .Biggest

        kenBurnsView.scaleFactorDeviation = 0.5
        kenBurnsView.imageAnimationDuration = 5.0
        kenBurnsView.imageAnimationDurationDeviation = 1.0
        kenBurnsView.transitionAnimationDuration = 2.0
        kenBurnsView.transitionAnimationDurationDeviation = 1.0

    override func viewDidAppear(animated: Bool) {


extension KenBurnsViewController: APKenBurnsViewDataSource {
    func nextImageForKenBurnsView(kenBurnsView: APKenBurnsView) -> UIImage? {
        return /* Provide UIImage instance */


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


  • iOS 8.0 and higher
  • ARC


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

pod 'APKenBurnsView'


Nickolay Sheika, [email protected]


If you have improvements or concerns, feel free to post an issue and write details.

Check out all Alterplay’s GitHub projects.
Email us with other ideas and projects.


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

Latest podspec

    "name": "APKenBurnsView",
    "version": "0.1.2",
    "summary": "KenBurns effect written in pure Swift with face recognition.",
    "homepage": "",
    "license": "MIT",
    "authors": {
        "Nickolay Sheika": "[email protected]"
    "source": {
        "git": "",
        "tag": "0.1.2"
    "platforms": {
        "ios": "8.0",
        "tvos": "9.0"
    "requires_arc": true,
    "source_files": "Pod/Classes/**/*"

Pin It on Pinterest

Share This