0

So, I'm making an application and I want to gradually (over the course of a few seconds) shrink an image control until it disappears. So, I basically bound a ScaleTransform with a DoubleAnimation, but it happens instantly. Here is my code:

DoubleAnimation anim = new DoubleAnimation(360, 0, (Duration)TimeSpan.FromSeconds(1));
ScaleTransform st = new ScaleTransform();

st.ScaleX = 0;
st.ScaleY = 0;
PACSCore.RenderTransform = st;
anim.Completed += (s, _) => Exit_PACS();
st.BeginAnimation(ScaleTransform.ScaleYProperty, anim);
Luke Dinkler
  • 731
  • 5
  • 16
  • 36

1 Answers1

2

this should do the trick:

DoubleAnimation anim = new DoubleAnimation(1, 0,(Duration)TimeSpan.FromSeconds(1));

ScaleTransform st = new ScaleTransform();
Control.RenderTransform = st;
st.BeginAnimation(ScaleTransform.ScaleXProperty, anim);
st.BeginAnimation(ScaleTransform.ScaleYProperty, anim);
Philip W
  • 781
  • 3
  • 7