How can i give this Animation for a Dynamic Frame
void DoAnimation(DependencyObject obj)
{
var sb = new Storyboard();
var da1 = new DoubleAnimationUsingKeyFrames();
da1.KeyFrames.Add(new SplineDoubleKeyFrame { KeyTime = KeyTime.FromTimeSpan(TimeSpan.FromMilliseconds(0)), Value = 1 });
da1.KeyFrames.Add(new SplineDoubleKeyFrame { KeyTime = KeyTime.FromTimeSpan(TimeSpan.FromMilliseconds(15)), Value = 0, KeySpline = new KeySpline(0,0,0.4,0.969) });
Storyboard.SetTargetProperty(obj, new PropertyPath("(UIElement.Opacity)"));
Storyboard.SetTarget(da1, obj);
sb.Children.Add(da1);
var da3 = new DoubleAnimationUsingKeyFrames();
da3.KeyFrames.Add(new SplineDoubleKeyFrame { KeyTime = KeyTime.FromTimeSpan(TimeSpan.FromMilliseconds(0)), Value = 1 });
da3.KeyFrames.Add(new SplineDoubleKeyFrame { KeyTime = KeyTime.FromTimeSpan(TimeSpan.FromMilliseconds(15)), Value = 0.8, KeySpline = new KeySpline(0, 0, 0.4, 0.969) });
da3.KeyFrames.Add(new SplineDoubleKeyFrame { KeyTime = KeyTime.FromTimeSpan(TimeSpan.FromMilliseconds(15)), Value = 1 });
da3.KeyFrames.Add(new SplineDoubleKeyFrame { KeyTime = KeyTime.FromTimeSpan(TimeSpan.FromMilliseconds(25)), Value = 1 });
Storyboard.SetTargetProperty(da3, new PropertyPath("(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)"));
Storyboard.SetTarget(da3, obj);
sb.Children.Add(da3);
var da5 = new DoubleAnimationUsingKeyFrames();
Storyboard.SetTargetProperty(da5, new PropertyPath("(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleY)"));
Storyboard.SetTarget(da5, obj);
da3.KeyFrames.Add(new SplineDoubleKeyFrame { KeyTime = KeyTime.FromTimeSpan(TimeSpan.FromMilliseconds(0)), Value = 1 });
da3.KeyFrames.Add(new SplineDoubleKeyFrame { KeyTime = KeyTime.FromTimeSpan(TimeSpan.FromMilliseconds(15)), Value = 0.8, KeySpline = new KeySpline(0, 0, 0.4, 0.969) });
da3.KeyFrames.Add(new SplineDoubleKeyFrame { KeyTime = KeyTime.FromTimeSpan(TimeSpan.FromMilliseconds(15)), Value = 1 });
da3.KeyFrames.Add(new SplineDoubleKeyFrame { KeyTime = KeyTime.FromTimeSpan(TimeSpan.FromMilliseconds(25)), Value = 1 });
sb.Children.Add(da5);
sb.Begin();
}
I am creating a dynamic Frame . How can i give this animation for a dynamic frame .
Please help me