Tuesday, 5 June 2012

Silverlight Metro Style Splash

With the push toward making apps feel fast and fluid here is a simple animated splash screen.

Online demo:  http://stevenhollidge.com/blog-source-code/metrosplash/

Here’s an animated gif of the splash screen (click the link above for the real thing!):

splash

<UserControl x:Class="MetroSplash.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
x:Name="userControl"
mc:Ignorable="d">
<UserControl.Projection>
<PlaneProjection />
</UserControl.Projection>

<Grid x:Name="LayoutRoot" Background="White">
<Grid x:Name="BackgroundContainer"
Background="Black"
RenderTransformOrigin="0.5,0.5">
<Grid.Triggers>
<EventTrigger RoutedEvent="UserControl.Loaded">
<BeginStoryboard>
<Storyboard>
<DoubleAnimationUsingKeyFrames Storyboard.TargetName="userControl" Storyboard.TargetProperty="(UIElement.Projection).(PlaneProjection.RotationY)">
<EasingDoubleKeyFrame KeyTime="0" Value="50" />
<EasingDoubleKeyFrame KeyTime="0:0:1" Value="0" />
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames Storyboard.TargetName="userControl" Storyboard.TargetProperty="(UIElement.Projection).(PlaneProjection.LocalOffsetX)">
<EasingDoubleKeyFrame KeyTime="0" Value="-400" />
<EasingDoubleKeyFrame KeyTime="0:0:1" Value="0" />
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames Storyboard.TargetName="userControl" Storyboard.TargetProperty="(UIElement.Projection).(PlaneProjection.LocalOffsetZ)">
<EasingDoubleKeyFrame KeyTime="0" Value="-500" />
<EasingDoubleKeyFrame KeyTime="0:0:1" Value="0" />
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames Storyboard.TargetName="BackgroundContainer" Storyboard.TargetProperty="(UIElement.Opacity)">
<EasingDoubleKeyFrame KeyTime="0:0:1" Value="1" />
<EasingDoubleKeyFrame KeyTime="0:0:1.5" Value="0" />
</DoubleAnimationUsingKeyFrames>
<DoubleAnimation d:IsOptimized="True"
Duration="0:0:1.3"
Storyboard.TargetName="image"
Storyboard.TargetProperty="(UIElement.Opacity)"
To="1">
<DoubleAnimation.EasingFunction>
<CircleEase EasingMode="EaseOut" />
</DoubleAnimation.EasingFunction>
</DoubleAnimation>
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</Grid.Triggers>
<Grid.Projection>
<PlaneProjection />
</Grid.Projection>
<Grid.RenderTransform>
<CompositeTransform />
</Grid.RenderTransform>
<Image x:Name="image"
Height="95"
Margin="0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Source="Images/silverbladetechnology.png"
Stretch="None" />
</Grid>
</Grid>
</UserControl>


Source:  https://github.com/stevenh77/MetroSplash

No comments:

Post a Comment