views:

148

answers:

1

I am focusing on silverlight animation (as my previous posts probably indicate), and one of the things I can't find out is how can I do a scaletransform to zoom into an object (so it appears it is coming towards you), but rather than on event initiation it goes from one size to another, I want it to gradually increase in size?

For example, if you put your hand in front of you and draw it near to you, it is gradually getting closer whereas if you abruptly pull it towards you and stop, it goes from being far to being near with no sense of an in beTWEEN state. I want to get the tweening, so an object can be zoomed and then zoom in but at a small, repetitive increment.

+1  A: 

You can just animate the scale tranform

<Storyboard>
    <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="image" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)">
     <EasingDoubleKeyFrame KeyTime="00:00:02" Value="2"/>
    </DoubleAnimationUsingKeyFrames>
    <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="image" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleY)">
     <EasingDoubleKeyFrame KeyTime="00:00:02" Value="2"/>
    </DoubleAnimationUsingKeyFrames>
</Storyboard>

The example above will double the height and width of an image over a period of two seconds.

Hope this helps.

Graeme Bradbury