I have made progress on translating my skew animation to the double animation class. The only problem left is when the animation is called by the dispatch timer, an error is thrown. The error is as follows...
Cannot animate the 'AngleX' property on 'System.Windows.Media.MatrixTransform' because the object is sealed or frozen.
How would i overcome this error so that the animation can work?
public static void Grass(Canvas canvas, int boundry)
{
foreach (var element in canvas.Children.OfType<Image>())
{
if (element.Name == "GrassForeground" || element.Name == "GrassBackground")
{
var skewGrass = new DoubleAnimation
{
From = 0,
To = 10,
EasingFunction = new BackEase(),
AutoReverse = true
};
var transform = (MatrixTransform)element.RenderTransform;
transform.BeginAnimation(SkewTransform.AngleXProperty, skewGrass);
}
}
}