All Projects β†’ azimin β†’ Aztransitions

azimin / Aztransitions

Licence: mit
API to make great custom transitions in one method

Programming Languages

swift
15916 projects

Projects that are alternatives of or similar to Aztransitions

animated
🌊 Implicit animations for JavaFX.
Stars: ✭ 79 (-80.87%)
Mutual labels:  transitions
ionic-modal-custom-transitions
Add Custom Transitions to Ionic Modals.
Stars: ✭ 22 (-94.67%)
Mutual labels:  transitions
Ffmpeg Gl Transition
FFmpeg filter for applying GLSL transitions between video streams.
Stars: ✭ 335 (-18.89%)
Mutual labels:  transitions
kstatemachine
KStateMachine is a Kotlin DSL library for creating finite state machines (FSM) and hierarchical state machines (HSM).
Stars: ✭ 63 (-84.75%)
Mutual labels:  transitions
highway
Highway - A Modern Javascript Transitions Manager
Stars: ✭ 1,349 (+226.63%)
Mutual labels:  transitions
Material Motion Js
Reusable gestural interactions in JavaScript. In development.
Stars: ✭ 277 (-32.93%)
Mutual labels:  transitions
Material-Design-Android
My stash for all things material, animations, typography, iconography, transitions, Animated VD, Color Palette API, UI design, and more.
Stars: ✭ 38 (-90.8%)
Mutual labels:  transitions
Xamanimation
Xamarin Forms Animation Library
Stars: ✭ 389 (-5.81%)
Mutual labels:  transitions
motion-transitioning-objc
Light-weight API for building UIViewController transitions.
Stars: ✭ 24 (-94.19%)
Mutual labels:  transitions
Gatsby Starter Portfolio Emilia
Minimalistic portfolio/photography site with masonry grid, page transitions and big images. Themeable with Theme UI. Includes Light/Dark mode.
Stars: ✭ 300 (-27.36%)
Mutual labels:  transitions
transitionable-routes
Perform transitions when changing routes with React Router
Stars: ✭ 26 (-93.7%)
Mutual labels:  transitions
transit
A simple Godot asset for smooth scene transitions.
Stars: ✭ 22 (-94.67%)
Mutual labels:  transitions
React Overdrive
Super easy magic-move transitions for React apps
Stars: ✭ 3,001 (+626.63%)
Mutual labels:  transitions
stimulus-transition
Enter/Leave transition for stimulusJS, inspired by Vue/Alpine syntax
Stars: ✭ 34 (-91.77%)
Mutual labels:  transitions
Music Player
From UI Proposal to Code πŸŽΆβ–ΆοΈ
Stars: ✭ 3,459 (+737.53%)
Mutual labels:  transitions
aholachek.github.io
My website
Stars: ✭ 53 (-87.17%)
Mutual labels:  transitions
ScxmlEditor-Tutorial
ScxmlEditor - powerful tool for creating, editing and debugging scxml files
Stars: ✭ 33 (-92.01%)
Mutual labels:  transitions
Hamburger React
Animated hamburger menu icons for React (1.5 KB) πŸ”
Stars: ✭ 391 (-5.33%)
Mutual labels:  transitions
Animatify Ios
Animation, Effects & Transitions for iOS
Stars: ✭ 350 (-15.25%)
Mutual labels:  transitions
Flutter villains
Flexible and easy to use page transitions.
Stars: ✭ 294 (-28.81%)
Mutual labels:  transitions

AZTransitions

CocoaPods Compatible Carthage Compatible SPM Compatible Platform Twitter GitHub license

Make your modal transition with custom animation. AZTransitions helps you think about creativity, giving specific API methods.

Visual Example

Inside this repository you can try iOS Example target with example FashionTransition.swift class:

Animation example

Installation

  • Add the following to your Podfile and run pod install
pod 'AZTransitions'
  • or add the following to your Cartfile and run carthage update
github "azimin/AZTransitions"
dependencies: [
    .package(url: "https://github.com/azimin/AZTransitions.git", .upToNextMajor(from: "0.26.0"))
]
  • or clone as a git submodule,

  • or just copy AZTransitions/Source/CustomModalTransition.swift into your project.

Code Example

To create any custom transition just subclass CustomModalTransition:

class FashionTransition: CustomModalTransition { 
  override init() {
    super.init(duration: 0.5)
  }
}

--

Then set as az_modalTransition to nessesary view just before presenting it

override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
  segue.destination.customModalTransition = FashionTransition()
}

or

func show() {
  let viewController = UIViewController()
  viewController.customModalTransition = FashionTransition()
  self.present(viewController, animated: true, completion: nil)
}

--

To have custom present animation, just implement performTransition(interactive: Bool) inside your FashionTransition class:

func performTransition(interactive: Bool) {
  self.presentedViewController.view.alpha = 0.0
    
  UIView.animate(withDuration: duration, animations: {
    self.presentedViewController.view.alpha = 1.0
    self.presentingViewController.view.alpha = 0.0
  }, completion: { (completed) in
    self.presentingViewController.view.alpha = 1.0
    self.finishAnimation(completion: nil)
  })
}

As you may have guessed, you have different properties. The main ones:

  • duration β€” transition duration
  • presentingViewController β€” the presenting view controller (bottom one)
  • presentedViewController β€” view controller that is going to be presented (top one)

You can animate them as you want.

πŸ”₯IMPORTANTπŸ”₯ don't forget to call finishAnimation(completion: nil) in the end.

In this case animation will be:

Animation code example

UIModalPresentationStyle

Of course sometimes you want to use diffenret modal presentation styles (for example overCurrentContext), in this case you can call setCustomModalTransition(customModalTransition: CustomModalTransition, inPresentationStyle: UIModalPresentationStyle) of UIViewController instead of setting customModalTransition directly.

More

You have different properties and methods to help you:

  • performDismissingTransition(interactive: Bool) to implement custom transition animation when dismissing
  • fromViewController/toViewController in term of Apple transition. They are reversed in presenting and dismissing transitions.
  • transitionContainerView view where the transition takes place (resentingViewController.view and presentedViewController.view located on inside transitionContainerView), so you can add your custom views here to make animation more interesting (see iOS Example)
  • Some methods for interactive animations (example will be added be soon)
  • Some method to work with orientation changing things (example will be added be soon)
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].