I am very new to silverlight animation. I want to programmatically create an animation, like a slide show. I have an image control initially loaded with an image, should scroll fast from right to center of the screen, stay there for 3 seconds then move slowly towards left and disappear off the screen.
Then again should appear from right to center with a new image, and so on, and forever. The image is randomly fetched from wcf service, which works fine.
Here is my funky code, I played with it. I really don’t know where to begin.
private void button1_Click(object sender, RoutedEventArgs e)
{
Storyboard1.Completed += new EventHandler(Storyboard1_Completed);
DoubleAnimation da = new DoubleAnimation();
da.To = 100;
da.Duration = new Duration(TimeSpan.FromSeconds(1));
Storyboard.SetTargetProperty(da, new PropertyPath(Image.VisibilityProperty));
Storyboard.SetTarget(da, image1);
Storyboard1.Begin();
}
I couldn’t find a good tutorial on silverlight animation either. Everything I looked at wasn’t clear, it’s confusing. I prefer doing it in code so that I will have better control than xaml.
I found a nice tutorial on silverlight using expression blend. My focus was on the animation part.
Silverlight Animation Tutorial plus sample code
This is exactly what I was looking for.