All Projects → Julien-Mialon → ExpectAnimXamarin

Julien-Mialon / ExpectAnimXamarin

Licence: MIT license
Xamarin.Android Binding, describe your animation and just run

Programming Languages

HTML
75241 projects

Projects that are alternatives of or similar to ExpectAnimXamarin

Microsoft.Maui.Graphics.Controls
Experimental Microsoft.Maui.Graphics.Controls - Build drawn controls (Cupertino, Fluent and Material)
Stars: ✭ 549 (+2950%)
Mutual labels:  xamarin, fluent
Graphicscontrols
Experimental GraphicsControls - Build drawn controls (Cupertino, Fluent and Material)
Stars: ✭ 149 (+727.78%)
Mutual labels:  xamarin, fluent
bottomnavigationviewex-android-binding
Xamarin.Android Binding Library for Ittianyu BottomNavigationViewEx
Stars: ✭ 25 (+38.89%)
Mutual labels:  xamarin
XamCall
XamDesign Xamarin Forms Call screen Ui Design
Stars: ✭ 25 (+38.89%)
Mutual labels:  xamarin
MonoTouch.SlideoutNavigation
A MonoTouch slide-out UI component
Stars: ✭ 41 (+127.78%)
Mutual labels:  xamarin
Xamarin.Android.OpenCV
C# bindings for the OpenCV Android SDK
Stars: ✭ 87 (+383.33%)
Mutual labels:  xamarin
Mastering-Xamarin.Forms-Second-Edition
Mastering Xamarin.Forms Second Edition, published by Packt
Stars: ✭ 16 (-11.11%)
Mutual labels:  xamarin
PTVGlass
Melbourne Public Transport timetable for Google Glass
Stars: ✭ 41 (+127.78%)
Mutual labels:  xamarin
Xam.Forms.QRCode
A QRCode renderer based on SkiaSharp.
Stars: ✭ 16 (-11.11%)
Mutual labels:  xamarin
effects-xamarin-forms
Customized Effects/Renderers for Xamarin.Forms
Stars: ✭ 21 (+16.67%)
Mutual labels:  xamarin
xamarin-forms-docs
This repository holds documentation for Xamarin Forms components
Stars: ✭ 15 (-16.67%)
Mutual labels:  xamarin
Plugin.NFC
A Cross-Platform NFC (Near Field Communication) plugin to easily read and write NFC tags in your application.
Stars: ✭ 113 (+527.78%)
Mutual labels:  xamarin
PrismHandsOn
Prism for Xamarin.Forms入門 Hands-on
Stars: ✭ 22 (+22.22%)
Mutual labels:  xamarin
XamFormsMvxTemplate
A Visual Studio 2017 template for projects based on Xamarin.Forms 3.3 and MvvmCross 6.2
Stars: ✭ 27 (+50%)
Mutual labels:  xamarin
ScreenshotPlugin
A simple Screenshot plugin for Xamarin and Windows to get and save screenshot in yours apps.
Stars: ✭ 32 (+77.78%)
Mutual labels:  xamarin
WeakEventListener
The WeakEventListener allows the owner to be garbage collected if its only remaining link is an event handler.
Stars: ✭ 25 (+38.89%)
Mutual labels:  xamarin
PCLExt.FileStorage
Portable Storage APIs
Stars: ✭ 35 (+94.44%)
Mutual labels:  xamarin
validatum
An open-source library for building fluent validation functions for .NET.
Stars: ✭ 32 (+77.78%)
Mutual labels:  fluent
ObjectDetector
A simple custom vision object detector sample app
Stars: ✭ 14 (-22.22%)
Mutual labels:  xamarin
Xamarin.Forms.MaskedEntry
📝 Use mask in your Xamarin.Forms apps
Stars: ✭ 17 (-5.56%)
Mutual labels:  xamarin

ExpectAnimXamarin

nuget

Describe your animation and run !

gif

new ExpectAnim()

                .Expect(avatar)
                .ToBe(
                    Expectations...
                )
                .ToAnimation()
                .Start();

#Download

This library is available on nuget

Install-Package Florent37.XamarinExpectAnim

This code describe the video above

new ExpectAnim()
	.Expect(_avatar)
	.ToBe(
		BottomOfParent().WithMarginDp(36),
		LeftOfParent().WithMarginDp(16),
		Width(40).ToDp().KeepRatio())
	.Expect(_name)
	.ToBe(
		ToRightOf(_avatar).WithMarginDp(16),
		SameCenterVerticalAs(_avatar),
		ToHaveTextColor(Color.White)
	)

	.Expect(_subname)
	.ToBe(
		ToRightOf(_name).WithMarginDp(5),
		SameCenterVerticalAs(_name),
		ToHaveTextColor(Color.White)
	)

	.Expect(_follow)
	.ToBe(
		RightOfParent().WithMarginDp(4),
		BottomOfParent().WithMarginDp(12),
		ToHaveBackgroundAlpha(0f)
	)

	.Expect(_message)
	.ToBe(
		AboveOf(_follow).WithMarginDp(4),
		RightOfParent().WithMarginDp(4),
		ToHaveBackgroundAlpha(0f)
	)

	.Expect(_bottomLayout)
	.ToBe(
		AtItsOriginalPosition()
	)

	.Expect(_content)
	.ToBe(
		AtItsOriginalPosition(),
		Visible()
	)
	.ToAnimation()
	.SetDuration(1500)
	.Start();

Follow scroll

gif

Use SetPercent to apply modify the current step of the animation

Exemple with a scrollview

_expectAnimMove = new ExpectAnim()
				.Expect(_avatar)
				.ToBe(
					TopOfParent().WithMarginDp(20),
					LeftOfParent().WithMarginDp(20),
					Scale(0.5f, 0.5f)
				)

				.Expect(_username)
				.ToBe(
					ToRightOf(_avatar).WithMarginDp(16),
					SameCenterVerticalAs(_avatar),

					Alpha(0.5f)
				)

				.Expect(_follow)
				.ToBe(
					RightOfParent().WithMarginDp(20),
					SameCenterVerticalAs(_avatar)
				)

				.Expect(_background)
				.ToBe(
					Height(_height).WithGravity(Java.Lang.Integer.ValueOf((int)GravityFlags.Left), Java.Lang.Integer.ValueOf((int)GravityFlags.Top))
				)
				.ToAnimation();

			_scrollView.ScrollChange += (sender, args) => {
				float percent = args.ScrollY * 1f / _scrollView.MaxScrollAmount;
				_expectAnimMove.SetPercent(percent);
			};

Apply directly

Use SetNow to apply directly the transformation

new ExpectAnim()
	.Expect(_view).ToBe(Invisible())
	.ToAnimation()
	.SetNow();

Reset

Use reset to return to the initial state of views

_expectAnimMove.Reset():

List of expectations

new ExpectAnim()
                .Expect(view)
                .ToBe(

                    //.WithMargin(marginPx)
                    //.WithMarginDp(margin)
                    //.WithMarginDimen(R.dimen.margin)

                    ToRightOf(view)
                    ToLeftOf(view)
                    BelowOf(view)
                    AboveOf(view)

                    AtItsOriginalPosition()


                    SameCenterAs(view, horizontal, vertical)
                    SameCenterHorizontalAs(view)
                    SameCenterVerticalAs(view)
                    CenterInParent(horizontal, vertical)
                    CenterVerticalInParent()
                    CenterHorizontalInParent()

                    CenterBetweenViews(view1, view2, horizontal, vertical)
                    CenterBetweenViewAndParent(otherView, horizontal, vertical, toBeOnRight, toBeOnBottom)

                    TopOfParent()
                    RightOfParent()
                    BottomOfParent()
                    LeftOfParent()

                    AlignBottom(otherView)
                    AlignTop(otherView)
                    AlignLeft(otherView)
                    AlignRight(otherView)

                    OutOfScreen(gravitiy)  //GravityFlags.Left / GravityFlags.Right / GravityFlags.Top / GravityFlags.Bottom

                	Alpha(alpha)
                    SameAlphaAs(otherView)
                    Visible()
                    Invisible()

                    //.KeepRatio()
                    //.WithGravity(horizontalGravity, verticalGravity)

                    AtItsOriginalScale()

                    Scale(scaleX, scaleY)
                    Height(height)
                    Width(width)
                    SameScaleAs(otherView)
                    SameWidthAs(otherView)
                    SameHeightAs(otherView)


                    ToHaveTextColor(textColor)
                    ToHaveBackgroundAlpha(alpha)

                    Rotated(rotation)
                    Vertical(bottomOfViewAtLeft)
                    AtItsOriginalRotation()
                )

Changelog

##1.0.2

Added flips rotations

FlippedHorizontally() FlippedVertically() FlippedHorizontallyAndVertically() WithCameraDistance(1000f)

##1.0.

Added rotations

gif

Credits

Author (xamarin binding): Julien Mialon

Follow me on Twitter Follow me on Linkedin

Original author (android version): Florent Champigny

Follow me on Twitter Follow me on Linkedin

#Original license

Copyright 2017 florent37, Inc.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
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].