GithubHelp home page GithubHelp logo

matteocrippa / apkenburnsview Goto Github PK

View Code? Open in Web Editor NEW

This project forked from gregpardo/apkenburnsview

0.0 3.0 0.0 41.17 MB

Ken Burns effect with face recognition!

License: MIT License

Ruby 1.80% Swift 98.20%

apkenburnsview's Introduction

APKenBurnsView

APKenBurnsView

Build Status Version License Platform

Ken Burns effect with face recognition!

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

APKenBurnsView

Features

  • 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.

Usage

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 nextImage(forKenBurnsView: 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() {
        super.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) {
        super.viewDidAppear(animated)

        kenBurnsView.startAnimations()
    }
}
    
extension KenBurnsViewController: APKenBurnsViewDataSource {
    func nextImage(forKenBurnsView: APKenBurnsView) -> UIImage? {
        return /* Provide UIImage instance */
    }
}

Example

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

Requirements

  • iOS 8.0 and higher
  • ARC

Installation

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

pod 'APKenBurnsView'

Author

Nickolay Sheika, [email protected]

Contacts

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.

License

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

apkenburnsview's People

Contributors

gregpardo avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.