How do you do animated image rotation in WPF?

I'm just starting to use WPF. I want to rotate the image when I press the button, but I do not want the image to rotate in one moment of rotation. I want the image to be displayed at the same level at a time. What is the easiest way to do this in C #?

+4
source share
1 answer

Apply RotateTransform to the image with its original Angle set to 0. Then animate the Angle transform property in the normal way.

If you specifically want a discrete rotation, where the rotation is noticeably clicked on jumps of one degree, use DoubleAnimationUsingKeyFrames instead of the usual DoubleAnimation and create each keyframe DiscreteDoubleKeyFrame. (You probably want to create a program script in this case because you will have many key frames.)

+6
source

Source: https://habr.com/ru/post/1300522/


All Articles