[英]XAML storyboard animation moving images from outside viewport-windows phone 8
I need to create a splash screen, where image needs to slide from bottom of the screen up.Initially it should be placed outside the viewport and then brought in.I understand i need to use story board animation,give target property as image's name and use render translate.Since m new to XAML.. I have the bare skeleton, I dunno how to build things up from here.. please help. 我需要创建一个初始屏幕,其中图像需要从屏幕底部向上滑动。最初应将其放置在视口之外,然后引入。我知道我需要使用故事板动画,将目标属性用作图像的名称,并且使用渲染翻译。由于XAML尚不完善。。我拥有裸露的骨架,我不知道如何从此处构建内容。.请帮助。
<Grid HorizontalAlignment="Left" Height="1047" VerticalAlignment="Top" Width="480" Margin="0,-24,0,-255" Background="White">
<Grid.Resources>
<Storyboard x:Name="myanimation">
<DoubleAnimation></DoubleAnimation>
</Storyboard>
</Grid.Resources>
<Image HorizontalAlignment="Left" Height="252" Margin="0,795,0,0" VerticalAlignment="Top" Width="480" Source="/Assets/splash-bottom.png"/>
</Grid>
The easiest way to do this is the add a CompositeTransform to your image, initially set off the screen, and then animate the TranslateY property. 最简单的方法是在图像中添加CompositeTransform,首先将其设置在屏幕外,然后为TranslateY属性设置动画。
<Grid ...>
<Grid.Resources>
<Storyboard x:Name="MainImageSlideIn">
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(CompositeTransform.TranslateY)" Storyboard.TargetName="MainImage">
<EasingDoubleKeyFrame KeyTime="0" Value="900"/>
<EasingDoubleKeyFrame KeyTime="0:0:0.2" Value="0" />
</DoubleAnimationUsingKeyFrames>
</Storyboard>
</Grid.Resources>
<Image x:Name="MainImage"HorizontalAlignment="Left" VerticalAlignment="Top" Width="480" Source="/Assets/splash-bottom.png">
<Image.RenderTransform>
<CompositeTransform TranslateY="900" />
</Image.RenderTransform>
</Image>
</Grid>
You'll also need to trigger the storyboard to begin. 您还需要触发情节提要以开始。 I can't remember the XAML for triggering it as an event, but you can add MainImageSlideIn.Begin() in your page's
Loaded
event in C# 我不记得XAML将其触发为事件,但是您可以在C#中页面的
Loaded
事件中添加MainImageSlideIn.Begin()。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.