Skip to content

Latest commit

 

History

History
76 lines (54 loc) · 2.85 KB

File metadata and controls

76 lines (54 loc) · 2.85 KB

Animated transitions for Xamarin.iOS

You can find a lot of animated transitions for iOS on the web, but most of them are written either in Objective-C or Swift. This library contains a small amount of cool transitions, ported to C# for Xamarin.iOS.

There is some sample code available, currenyly the MvvmCross 5 sample "Cool Animations" is up-to-date. I am working hard to bring more samples and more transitions into this library.

Usage

Transitions

Using transitions with MvvmCross

Add the nuget package "Redhotminute.Plugin.iOS.AnimatedTransitions" to your iOS project.

Create start and a target MxvViewController, create bindings, viewmodels, etc, make sure the navigation between the ViewControllers work.

For all transitions:

  1. The starting ViewController should be of type IStartAnimationViewController.
public partial class HomeViewController : MvxViewController<HomeViewModel>, IStartAnimationViewController
{
	...
  1. The target ViewController should look like this:
[MvxModalPresentation(ModalPresentationStyle = UIModalPresentationStyle.FullScreen,
                          ModalTransitionStyle = UIModalTransitionStyle.CrossDissolve)]
public partial class SettingsViewController : MvvmCross.iOS.Views.MvxViewController<SettingsViewModel>
{
	public override void ViewDidLoad()
	{
		base.ViewDidLoad();

		TransitioningDelegate = new CirculairRevealTransitioningDelegate(0.4f, UIColor.White);
  1. Set the StartFrame (and StartImage if needed) in the starting viewcontroller
SettingsButton.TouchUpInside += async (sender, e) =>
{
	StartFrame = AnimationHelper.GetFrameFromViewInScrollView(ScrollView, SettingsButton.Frame);
	await ViewModel.SettingsCommand.ExecuteAsync().ConfigureAwait(false);
};

TODO

  • Add Wiki
  • Add more transitions
  • Dive into interactive transitions
  • Add multiple parameters (open vs close duration), open vs close alpha

Inspiration, Docs, Links

License

Redhotminute.Plugin.iOS.AnimatedTransitions is licensed under the MIT License