I'm trying to animate an image to move to a certain point then turn and come back to the startign point,I searched this site for answers but i still can't seem to understand how the RenderTransform works.
This is my current code for anyone interested in helping me:
public static void MoveTo(this Image target, double newX, double newY,int s)
{
Vector offset = VisualTreeHelper.GetOffset(target);
DoubleAnimation animay = new DoubleAnimation(0, newY - offset.Y, TimeSpan.FromSeconds(s));
DoubleAnimation animax = new DoubleAnimation(0, newX - offset.X, TimeSpan.FromSeconds(s));
TransformGroup transformGroup = new TransformGroup();
TranslateTransform translatetransform = new TranslateTransform();
ScaleTransform scaletransform = new ScaleTransform();
transformGroup.Children.Add(translatetransform);
transformGroup.Children.Add(scaletransform);
target.RenderTransform = transformGroup;
target.RenderTransform.BeginAnimation(TranslateTransform.YProperty, animay);
target.RenderTransform.BeginAnimation(TranslateTransform.XProperty, animax);
}
Edit: Just to be clear I should add that I know how to animate the object to move and flip separately,but can't make them work in succession with a Transform Group.