I have a couple of open questions relating to the same sort of thing,
I am quite new to WPF but experienced with C# and Winforms.
I have looked around on the interweb for a working example but have yet to find one that works.
What I want to achieve is in a C# function create the following
- create an image (image 1)
- create an image (image 2)
- put the images on the window side by side
- create a storyboard
- animate the rotate property of image1 from 0 to 360 (animation1)
- animate the opacity property of image 2 from full to invisible (animation2)
- the storyboard should run for ten seconds with animation 1 starting at 0 seconds and animation 2 starting at 5 seconds
apologies for the explicit request for code, but, I have looked, and tried, my previous question had full code that executed but no animation showed (link below)
how to create a storyboard and rotating an image in wpf using c# code
thanks in advance
Dan.
Here is a working XAML versionn of your question followed by the identical thing in C#. May not be exactly what you were after, but it should illustrate it.
XAML version:
And C# version:
Animation is work as follows.
1-The program creates a timer.
2-The program checks the timer at set intervals to see how much time has elapsed.
3-Each time the program checks the timer, it computes the current opacity value for the rectangle based on how much time has elapsed.
4-The program then updates the rectangle with the new value and redraws it.
Following is the Code which create Rectangle and animate it.