Introduction
In Silverlight, we create animations to compete 'adobe flash' but till
now we have not created any such project which assumes something like this, we
just saw how to transform an element by using static compositions. As we saw
multiple types of transformations, we'll see multiple types of animations too
in my coming posts. Here you will see 'DoubleAnimation' and we have also
another one that is 'DoubleAnimationUsingKeyFrames' (will discuss it later). Here
you'll go with only 'DoubleAnimation'.
Look at the XAML Code below:
XAML Code
Continue from previous part here.
In above code, I strike <TransformGroup> root
because inside this I'm only using single transform element that is
<ScaleTransform> but in case if you have multiple transform, you have to
use <TransformGroup>. Review my previous post titled "TransformGroup in
XAML Silverlight" for more.
<ScaleTransform> has name 'Action1' and it has now
two scale property that is 'ScaleX' and 'ScaleY'. Similarly we have used 'ScaleX'
and 'ScaleY' in <DoubleAnimation>.
Let's move to <DoubleAnimation> section now. There
are two <DoubleAnimtion> section now. First one for 'ScaleX' and second
one for 'ScaleY'. In both section please note we have 'Storyboard.TargetName'
is 'Action1' and 'Storyboard.TargetProperty' is 'ScaleX' and 'ScaleY' these
properties can be assumed as called part of <ScaleTransform> attribute.
If you run above code, you will find 'TextBlock' text
is being doubled on X and Y axis and this animation repeat forever because of
properties 'RepeatBehaviour' and 'AutoReverse'.
In next part we will combine ScaleX, ScaleY and Angle. Be tuned.
HAVE A HAPPY CODING!!