Skip to content

Repository files navigation

MTTransitions

Transitions ports from GL-Transitions to Metal.

Features

  • Up to 76 transitions
  • Image Transitions
  • UIView Transitions
  • UIViewController Push Transtions
  • UIViewController Present Transitions
  • Video Merge Transitions
  • Create video from images with transitions
  • Create video from images with transitions and background music

Requirements

  • iOS 10.0 +
  • Xcode 11.0 +
  • Swift 5.0 +

Transitions

Support Following Transitions:

  • MTAngularTransition
  • MTBounceTransition
  • MTBowTieHorizontalTransition
  • MTBowTieVerticalTransition
  • MTBurnTransition
  • MTButterflyWaveScrawlerTransition
  • MTCannabisleafTransition
  • MTCircleCropTransition
  • MTCircleTransition
  • MTCircleOpenTransition
  • MTColorPhaseTransition
  • MTColourDistanceTransition
  • MTCrazyParametricFunTransition
  • MTCrossZoomTransition
  • MTCrossHatchTransition
  • MTCrossWarpTransition
  • MTCubeTransition
  • MTDirectionalTransition
  • MTDirectionalWarpTransition
  • MTDirectionalWipeTransition
  • MTDisplacementTransition
  • MTDoomScreenTransition
  • MTDoorwayTransition
  • MTDreamyTransition
  • MTDreamyZoomTransition
  • MTFadeTransition
  • MTFadeColorTransition
  • MTFadegrayscaleTransition
  • MTFlyeyeTransition
  • MTGlitchDisplaceTransition
  • MTGlitchMemoriesTransition
  • MTGridFlipTransition
  • MTHeartTransition
  • MTHexagonalizeTransition
  • MTInvertedPageCurlTransition
  • MTKaleidoScopeTransition
  • MTLinearBlurTransition
  • MTLumaTransition
  • MTLuminanceMeltTransition
  • MTMorphTransition
  • MTMosaicTransition
  • MTMultiplyBlendTransition
  • MTPerlinTransition
  • MTPinwheelTransition
  • MTPixelizeTransition
  • MTPolarFunctionTransition
  • MTPolkaDotsCurtainTransition
  • MTRadialTransition
  • MTRandomSquaresTransition
  • MTRippleTransition
  • MTRotateScaleFadeTransition
  • MTSimpleZoomTransition
  • MTSquaresWireTransition
  • MTSqueezeTransition
  • MTStereoViewerTransition
  • MTSwapTransition
  • MTSwirlTransition
  • MTTangentMotionBlurTransition
  • MTTVStaticTransition
  • MTUndulatingBurnOutTransition
  • MTWaterDropTransition
  • MTWindTransition
  • MTWindowBlindsTransition
  • MTWindowSliceTransition
  • MTWipeDownTransition
  • MTWipeLeftTransition
  • MTWipeRightTransition
  • MTWipeUpTransition
  • MTZoomInCirclesTransition

Installation

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

pod MTTransitions

Get Started

Each transition requires two input MTIImage. Image should be .oriented(.downMirrored).

import MTTransitions
lettransition=MTBounceTransition()
transition.inputImage =<from Image>
transition.destImage =<to Image>
// animate progress from 0.0 to 1.0
imageView.image = transition.outputImage

UIView Transition

leteffect=MTPerlinTransition()MTTransition.transition(with: view, effect: effect, animations:{
// Do your animation to your view
}){(_)in
// Transition completed
}

UIViewController Push Transition

classPushAViewController:UIViewController{privatelettransition=MTViewControllerTransition(transition:MTBurnTransition())
// ...
}extensionPushAViewController:UINavigationControllerDelegate{func navigationController(_ navigationController:UINavigationController, animationControllerFor operation:UINavigationController.Operation, from fromVC:UIViewController, to toVC:UIViewController)->UIViewControllerAnimatedTransitioning?{if operation ==.push {return transition
}returnnil}}

UIViewController Present Transition

class PresentAViewController:UIViewController{
// ...
letvc=PresentBViewController()
vc.modalPresentationStyle =.fullScreen
vc.transitioningDelegate = self
present(vc, animated:true, completion:nil)}extensionPresentAViewController:UIViewControllerTransitioningDelegate{func animationController(forDismissed dismissed:UIViewController)->UIViewControllerAnimatedTransitioning?{return transtion
}func animationController(forPresented presented:UIViewController, presenting:UIViewController, source:UIViewController)->UIViewControllerAnimatedTransitioning?{return transtion
}}

Video Transition

MTTransitions also support merging videos with transitions.

  • Support merge multiple video files
  • Support multiple transition effects
  • Support different multiple render size.
  • Support passthrough transition.
// pick one transtion effect
leteffect=MTTransition.Effect.wipeLeft
letduration=CMTimeMakeWithSeconds(2.0, preferredTimescale:1000)try? videoTransition.merge(clips,
effect: effect,
transitionDuration: duration){[weak self] result inguardlet self =selfelse{return}letplayerItem=AVPlayerItem(asset: result.composition)
playerItem.videoComposition = result.videoComposition
self.player.seek(to:.zero)self.player.replaceCurrentItem(with: playerItem)self.player.play()}

Please refer VideoTransitionSampleViewController and MultipleVideoTransitionsViewController for more details.

Create Video From Images

MTMovieMaker support create video from a sequence images with transitions. You can also pass a local audio file url to MTMovieMaker to create background music.

letfileURL=URL(fileURLWithPath: path)
movieMaker =MTMovieMaker(outputURL: fileURL)do{tryMTMovieMaker?.createVideo(with: images, effects: effects){ result inswitch result {case.success(let url):print(url)case.failure(let error):print(error)}}}catch{print(error)}

About

iOS Transitions ports from GL-Transitions.

Resources

Stars

3 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages