Skip to content

Instantly share code, notes, and snippets.

@juucustodio
Last active June 30, 2018 22:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save juucustodio/24311fbf484a351bfc0a60df04c45f5a to your computer and use it in GitHub Desktop.
Save juucustodio/24311fbf484a351bfc0a60df04c45f5a to your computer and use it in GitHub Desktop.
Example of how to implement animations in Xamarin.Forms applications - http://julianocustodio.com/animations
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:PlayGroundDemo"
xmlns:xamanimation="clr-namespace:Xamanimation;assembly=Xamanimation"
x:Class="PlayGroundDemo.MainPage">
<ContentPage.Resources>
<ResourceDictionary>
<xamanimation:StoryBoard
x:Key="LogoAnimation"
Target="{x:Reference Logo}">
<xamanimation:TranslateToAnimation TranslateY="180" TranslateX="95" Duration="750" />
<xamanimation:TranslateToAnimation TranslateY="-180" TranslateX="-95" Duration="750" />
<xamanimation:TranslateToAnimation TranslateY="0" TranslateX="0" Duration="750" />
</xamanimation:StoryBoard>
</ResourceDictionary>
</ContentPage.Resources>
<ContentPage.Content>
<StackLayout>
<Image x:Name="Logo" Source="logo.png" VerticalOptions="CenterAndExpand"/>
<Button Text="Start Animation" VerticalOptions="End">
<Button.Triggers>
<EventTrigger Event="Clicked">
<xamanimation:BeginAnimation Animation="{StaticResource LogoAnimation}" />
</EventTrigger>
</Button.Triggers>
</Button>
</StackLayout>
</ContentPage.Content>
</ContentPage>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment