The easiest way to add some simple animations in Xamarin.Forms
Although a user is visiting a business
website or a mobile application they feel more attracted towards that
website or app and also like to use and visit the site again and again
just due to its attractive and smooth nature. Expect all the other
in-built features of a website or application, the sweet simple
animations like fade-in, fade-out, scale, etc., That is added in a web
app allure the users heart and encourage them to visit again. So, seeing
the users interest you can add several effective animations in your
Xamarin.Forms.
Let’s see how to add these amazing animation effects by following these easy steps:1. At first, create a new project in Xamarin.Forms and then create UI in XAML. See the code below.
<?xml version=”1.0” encoding=”urf8”?>
<ContentPage xmlns=”http://xamarin.com/schemas/2014/forms” xmlns:x=”http://schemas.microsoft.com/winfx/2009/xaml” xmlns:local=”clr-namespsce:FormsAnimationsApp” x:Class=”FormAnimationsApp.FormsAnimationsAppPage”>
<StackLayout Orientation=”Vrtical” Padding”30”>
<Label x:Name=”lblGret” Text=”Hello World” TextColor=”Grey” FontSize=”40” Isvisible=”false” />
<Image x:Name=”xamImage” Source=”imagename.png” Height=”200” />
<Label x:Name=”lblForms” Text=”Xamarin Forms” FontSize=”30” TextColor=”Red” HorizontalOptions=”CenterAndExpand” />
<Label x:Name=”lblFade” Text=”Animations” FontSize=”30” TextColor=”Purpel” HorizontalOptions=”CenterAndExpand” />
</Stacklayout>
</ContentPage>
2.Now, open your xml.cs file and write the below mentiond code usinf C# coding language.
using Xamarin.Forms;
namespace FormsAnimationsApp
{
Public partial class FormsAnimationsAppPage: ContentPage
{
Public FormsAnimationsAppPage ()
{
InitializeComponent ():
lblGret.IsVisible = true:
// Use this code to add Translate effect
lblGret.TranslateTo(100,0,1000, Easing.BounceOut);
// Use this code to add Scale effect
xamImage.ScaleTo(1.5, 2000, Easing.SpringIn);
// Use this code to add Rotate effect
lblForms.RotateTo (360, 1000);
// Use this code to add Fade effect
lblFade.FadeTo(0.2, 2000, Easing.SpringOut);
}
}
}
Easing has a huge list of animated
effects you can check the list and use any particular effect in your
Xamarin.Forms app as per your choice. The list has the effects like
BounceIn, BounceOut, FadeIn, FadeOut, CubicIn, CubicOut, Equals, etc.
As Xamarin is a cross-platform
technology and allows the reuse of code, hence, you did not need to
write the same code again and again for another applications.
Hire a team expert and dedicated Xamarin App Developers from here:Call me – +1-(979)-633-4727 , +91-9229225552
Xamarin Development Company
Comments
Post a Comment