Code Monkey home page Code Monkey logo

starwars.ios's Introduction

StarWars Animation

Platform License

This component implements transition animation to crumble view-controller into tiny pieces.

Yalantis

Preview

Check this project on dribbble.

Also, read how it was done in our blog

Requirements

  • iOS 8.0+
  • Xcode 8
  • Swift 4

Installing with CocoaPods

use_frameworks!
pod 'StarWars', '~> 2.0'

Usage

At first, import StarWars:

import StarWars

Then just implement class of UIViewControllerTransitioningDelegate that will return our animation form method animationControllerForDismissedController and assign it to transitioningDelegate of viewController that you want to dismiss.

override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
    let destination = segue.destinationViewController
    destination.transitioningDelegate = self
}

func animationControllerForDismissedController(dismissed: UIViewController) -> UIViewControllerAnimatedTransitioning? {
    return StarWarsGLAnimator()
}

There are also two things you can customize in the Star Wars animation: duration and sprite sizes. Let’s see how you can do this:

let animator = StarWarsGLAnimator()
animator.duration = 2
animator.spriteWidth = 8

Have fun! :)

Let us know!

We’d be really happy if you sent us links to your projects where you use our component. Just send an email to [email protected] And do let us know if you have any questions or suggestion regarding the animation.

P.S. We’re going to publish more awesomeness wrapped in code and a tutorial on how to make UI for iOS (Android) better than better. Stay tuned!

Version history

  • 1.0 Swift 2.0
  • 2.0 Adds Swift 3.0 support
  • 3.0 Adds Swift 4.0 support
  • 4.0 Adds Swift 5.0 support

License

The MIT License (MIT)

Copyright © 2018 Yalantis

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

starwars.ios's People

Contributors

m0rtymerr avatar maximletushov avatar mrcompoteee avatar ninjarz avatar pravdaevgen avatar rnkyr avatar serejahh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

starwars.ios's Issues

Stars animation on intro

Some improvement for stars animation on Intro screen, like flying through stars array:

    func randomizeEmitterPosition() {
        let sizeWidth = 1.0*self.bounds.size.height
        let radius =  0 + CGFloat(arc4random()) % sizeWidth;
        emitter.emitterSize = CGSizeMake(radius, radius)
        particle.birthRate = 10 + sqrt(Float(radius))
    }

StarWarsAnimator: try to make snapshot blurEffect and corner

I try make the snapshots in dismiss animation have blurEffect and corner.
let snapshot = (fromViewSnapshot!.resizableSnapshotView(from: snapshotRegion, afterScreenUpdates: false, withCapInsets: UIEdgeInsets.zero))!

blurEffect: I just add UIVisualEffectView to fromView and then
let fromViewSnapshot = fromView?.snapshotView(afterScreenUpdates: true)
this work well. all snapshot blurEffect.

but make snapshot corner I fail.

first i just use this
snapshot.layer.cornerRadius = width / 2
snapshot.layer.masksToBounds = true
but this have performance problems.

I try to solve this by use UIGraphicsGetCurrentContext clip the snapshot. by use
first. clip snapshot to image like http://stackoverflow.com/questions/25444609/screenshot-in-swift-ios. then clip image. and add image to imageview. at last. add it to containerView
but it not work. I do not know where is wrong.

sorry about my poor English.

Trigger Animation Programmatically For View

I noticed that on the Android implementation of this lib, there is an API for triggering the animation on any view...

mTilesFrameLayout.startAnimation();

Is it possible to do the same on iOS for a given View Controller? Instead of just attaching it to the segue.

Burke

View Issues

After dismissing view, could not get back first view controller's View as screen returns black

when i return StarWarsGLAnimator() it is giving me an error saying that,use of unresolved identifier.Is that a bug?

Report

The more information you provide, the faster we can help you.

⚠️ Select what you want - a feature request or report a bug. Please remove the section you aren't interested in.

A feature request

What do you want to add?

Please describe what you want to add to the component.

How should it look like?

Please add images.

Report a bug

What did you do?

Please replace this with what you did.

What did you expect to happen?

Please replace this with what you expected to happen.

What happened instead?

Please replace this with what happened instead.

Your Environment

  • Version of the component: insert here
  • Swift version: insert here
  • iOS version: insert here
  • Device: insert here
  • Xcode version: insert here
  • If you use Cocoapods: run pod env | pbcopy and insert here
  • If you use Carthage: run carthage version | pbcopy and insert here

Project that demonstrates the bug

Please add a link to a project we can download that reproduces the bug.

Expose API To Obj-C

Any chance you could add the necessary decorations to expose this lib to Obj-C? That would allow us to create a plugin for this module for github.com/nativescript.

request for opengl objc animation code

i read the blog that accompanied this repo about how this animation was created. i saw you originally wrote opengl one it in objc. is there any chance you have that code still and are willing to share it? i love this transition but am not going to use any swift in my current project and plan on trying to rewrite this in objc so it would speed things up tremendously for me.

sorry if this isnt appropriate avenue to ask. didnt see a comment section on the blog:

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.