Member Avatar for nblackburn

I am trying to get this Skew double animation working but for some reason nothing is happening when it is called by the Dispatch timer, i would be very greatful of any advice as i am not getting any errors or anything of that sort.

What i would like to happen is to skew the image to the boundry, followed by a reverse and repeat.

public static void Grass2(Canvas canvas, int boundry)
    {
        foreach (var element in canvas.Children.OfType<Image>())
        {
            var elementName = Regex.Split(element.Name, "_");
            if (elementName[0] == "grass")
        {
        var skewGrass = new DoubleAnimation
            {
                From = 0,
                To = boundry,
                Duration = new Duration(TimeSpan.FromMilliseconds(100)),
                RepeatBehavior = RepeatBehavior.Forever,
                EasingFunction = new BackEase(),
                AutoReverse = true
            };
        element.BeginAnimation(SkewTransform.AngleXProperty, skewGrass);
        }
    }
}

Recommended Answers

All 3 Replies

Put a breakpoint at line 6 and ensure that you are getting 'grass' as the first element.

Member Avatar for nblackburn

I am definatly getting grass as the first element, its just not performing the animation and that is what is causing me to me confused.

I don't see anything obviously wrong. What's the value of boundry? And 1/10 of a second is fairly fast, have you tried increasing the duration to see if it is just too fast for you to notice?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.