0

I am developing a Windows Phone 8 game application and I want to rotate the image and at the same time I want to re-size the image from 100 to 0 then again from 0 to 100. Till now what I have done is

<Storyboard x:Name="Rotatetransition" >
        <DoubleAnimation Storyboard.TargetName="TransRotate" 
                     Storyboard.TargetProperty="ScaleX"
                     From="1" To="0"
                     BeginTime="0:0:0"
                     Duration="0:0:0.5"  
                     AutoReverse="True"/>
        <DoubleAnimation Storyboard.TargetName="TransRotate" 
                     Storyboard.TargetProperty="ScaleY"
                     From="1" To="0"                                                           
                     BeginTime="0:0:0"
                     Duration="0:0:0.5"
                     AutoReverse="True"/>
    </Storyboard>

So this animation is resizing my image to 0 from 100. Now the same image I want to rotate so that it will look good and I can load new image for a new game.

For rotaing the image I have code

<Storyboard x:Name="Rotatetransition2" >
        <DoubleAnimation Storyboard.TargetName="AnimatedRotateTransform" 
                                             Storyboard.TargetProperty="Angle" 
                                             By="10"        
                                             To="720" 
                                             Duration="0:0:0.2" 
                                             FillBehavior="Stop" />

    </Storyboard>

But the problem is in the Image control I can use only one child <Image.RenderTransform>

<Image x:Name="PreviewImage" Height="480" Width="480" Opacity="1" RenderTransformOrigin="0.5,0.5"   >
                <Image.RenderTransform>
                    <ScaleTransform x:Name="TransRotate" />
                </Image.RenderTransform>
                <!--<Image.RenderTransform>
                    <RotateTransform x:Name="AnimatedRotateTransform" Angle="0" />
                </Image.RenderTransform>-->
            </Image>

In the code behind when the game completes I will call

 Rotatetransition.Begin();
 Circletransition.Begin();
 RotatetransitionRev.Begin(); // Again resize the new Loaded image from 0 to 100
 Circletransitionrev.Begin(); // Roate the image again from 0 to 720
 StartThegame();

Can anyone suggest how do I achieve this?

and the new game will start.

Debhere
  • 1,055
  • 2
  • 19
  • 41

1 Answers1

1

Try using a TransformGroup:

<Image.RenderTransform>
    <TransformGroup>
        <ScaleTransform />
        <RotateTransform />
    </TransformGroup>
</Image.RenderTransform>
codechinchilla
  • 2,129
  • 13
  • 23
  • Animation is not present in Windows Phone 8. – Debhere Sep 26 '13 at 17:11
  • However I got the way this can be achieved with above solution, but the animation is not smooth, it's sluggish, any ideas how do I go for a smooth animation? – Debhere Sep 27 '13 at 05:23
  • 1
    Hi Debhere, unfortunately I would need to know more about your code to see how to optimize it. Are there other operations going on in the background? Is the image very high resolution? I feel like a simple scale and translate on an Image should have decent perf, so there may be another factor. – codechinchilla Sep 29 '13 at 19:31