locked
Animate image on extended splash screen RRS feed

  • Question

  • Hi,

    W10 Mobile offers to make extended splashscreen. I use Template10 and their guideline to make extended splashscreen. I have 3 images of sizes: 620x300, 1240x600, 2480x1200px. Extended splashscreen is working fine, but I'would like to animate the image from center to bottom. Here is the code of setting up the image:

    SplashScreenImage.SetValue(Canvas.LeftProperty, SplashScreen.ImageLocation.X);
                SplashScreenImage.SetValue(Canvas.TopProperty, SplashScreen.ImageLocation.Y);
    
                if (Windows.Foundation.Metadata.ApiInformation.IsTypePresent("Windows.Phone.UI.Input.HardwareButtons"))
                {
                    SplashScreenImage.Height = SplashScreen.ImageLocation.Height / ScaleFactor;
                    SplashScreenImage.Width = SplashScreen.ImageLocation.Width / ScaleFactor;
                }
                else
                {
                    SplashScreenImage.Height = SplashScreen.ImageLocation.Height;
                    SplashScreenImage.Width = SplashScreen.ImageLocation.Width;
                }

    Height is 731 effective pixels and Width is 411 effective pixels. But the image is center, and I would like to get the sizes of centered image. I'm not sure, what Windows does. If he scales the image.

    Thanks for help

    Monday, May 2, 2016 1:30 PM

Answers

  • Hi JP_Developer,

    You could add Storyboard which includes Animation to Resources and Set the “From” and “To” of the Animation . For example:

    Xaml:

       <Canvas x:Name="c1" Grid.Row="0" Grid.RowSpan="2">
            <Canvas.Resources>
                <Storyboard x:Key="storyboard">
                    <DoubleAnimation Storyboard.TargetName="extendedSplashImage"
                                 Storyboard.TargetProperty="(Canvas.Top)"
                                 EnableDependentAnimation="True"
                                 From="1" To="200" Duration="0:0:3" />
                </Storyboard>
            </Canvas.Resources>
            <Image x:Name="extendedSplashImage" Source="Assets/splash-sdk.png"/>
        </Canvas>


    C#:

    	    extendedSplashImage.SetValue(Canvas.LeftProperty, splashImageRect.Left);
                extendedSplashImage.SetValue(Canvas.TopProperty, splashImageRect.Top);
                if (Windows.Foundation.Metadata.ApiInformation.IsTypePresent("Windows.Phone.UI.Input.HardwareButtons"))
                {
                    extendedSplashImage.Height = splashImageRect.Height / ScaleFactor;
                    extendedSplashImage.Width = splashImageRect.Width / ScaleFactor;
                }
                else
                {
                    extendedSplashImage.Height = splashImageRect.Height;
                    extendedSplashImage.Width = splashImageRect.Width;
                }
    
                var story1 = c1.Resources["storyboard"] as Storyboard;
                DoubleAnimation anima = story1.Children[0] as DoubleAnimation;
                anima.From = splashImageRect.Top; 
                anima.To= 731 - extendedSplashImage.Height;
                story1.Begin();

    Best Regards,

    Leon Guang

    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Wednesday, May 4, 2016 6:29 AM