GithubHelp home page GithubHelp logo

davidnew / hero Goto Github PK

View Code? Open in Web Editor NEW

This project forked from herotransitions/hero

0.0 1.0 0.0 109.31 MB

Elegant transition library for iOS, written in Swift.

License: MIT License

Ruby 0.84% Swift 98.74% Objective-C 0.42%

hero's Introduction

Carthage compatible Version License Xcode 8.2+ iOS 8.0+ Swift 3.0+

δΈ­ζ–‡ README

Introduction

Hero is a library for building iOS view controller transitions. It provides a layer on top of the UIKit's cumbersome transition APIs. Making custom transitions an easy task for developers.

Features

With Hero, you can easily mix & match these effects to build your own custom transition.

At its core, Hero is similar to Keynote's Magic Move. It checks the heroID property on all source and destinations views. Every matched view pairs are then automatically transitioned from its old state to its new state.

Hero can also construct animations for unmatched views. It is easy to define these animations via the heroModifiers property. Hero will run these animations alongside the Magic Move animations. All of these can be interactive, too.

By default, Hero provides dynamic duration & easing based on the Material Design Motion Guide. The duration is determined by the distance and size change. The easing curve is selected base on whether or not the view is entering or exiting the screen. It save you the hassle while providing consistent and delightful animations.

Hero does not make any assumption about how the view is built or structured. It will not modify any of your views' states other than hiding them during the animation. This means that it works with Auto Layout, programmatic layout, UICollectionView (without modifying its layout object), UITableView, UINavigationController, UITabBarController, etc...

Video Demos

The following videos give you a general idea of what you can do with Hero

  1. Video overview of the example project.
  2. Video overview of the built-in debugger that display timeline, arc curve, and 3d informations.
  3. Video overview of the usage with Injection App to provide dynamic modifications in realtime. Changing HeroID or HeroModifiers without recompiling!

Installation & Usage Guide

Hero is available on Carthage & Cocoapods. See the usage guide for instructions.

NOTE: Hero won't work on iPhone 7 Simulators due to a bug by Apple. Try using other simulators or a real device when working with Hero.

Usage Example 1

View Controller 1
redView.heroID = "foo"
greyView.heroID = "bar"
View Controller 2
isHeroEnabled = true
redView.heroID = "foo"
greyView.heroID = "bar"
greenView.heroModifiers = [.translate(x:0, y:100), .scale(0.5)]

Usage Example 2

View Controller 1
greyView.heroID = "foo"
View Controller 2
isHeroEnabled = true
greyView.heroID = "foo"

// collectionView is the parent view of all red cells
collectionView.heroModifiers = [.cascade]
for cell in redCells {
	cell.heroModifiers = [.fade, .scale(0.5)]
}

You can do these in the storyboard too!

Contribute

We welcome any contributions. Please read the Contribution Guide.

License

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

hero's People

Contributors

calebenp avatar e28eta avatar khoren93 avatar lkzhao avatar lukaskollmer avatar mrs- avatar onevcat avatar pborreli avatar sgl0v avatar youkchansim avatar zeveisenberg avatar

Watchers

 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.