hi
Currently i am working on small application which give suser the option
how he/she want to see picture wtih various kind of animation.And these
animation are idependednt of each other.
For Example:
If i choose rotate animation then my application will display all the
selected pictures with rotate effect.And when he choose to see them in
Slide animation then rotate animation will stop and ans Slide animation
will Start.
But My problem is that while one animation is running and user select
another animation the first animation leaves its effect in sense that
if first animation is rotate and i select slide it will start to slide
but angle of picture is changed and its not upright.
And also my following lines of code are not working:
myStoryBoard.Stop(myImage);
myStoryBoard.Children.Remove(myFirstAnimation);
myStoryBoard.Children.Clear();
myStoryBoard.Clearvalue();
I will Be helpful to you if you could tell me how to remove the
Animation form StoryBoard Object.So that one Animation dont have effect
on new Animatiom
mail me at gagan.thukral@gmail.com

Problem in Removing the Children(animation) of StoryBoard
thePoet
I am able to solve my problem by doing following think
myStoryBoard.Stop(myImage);
Temoc
I can think of two options here:
1) Remove the effect of one Animation, by removing the animations applied to a certain property (e.g., Rotation angle of the image's RenderTransform):
(myImage.RenderTransform as RotateTransform).BeginAnimation(RotateTransform.AngleProperty, null);
This will cause the value of the RotateTransform to "snap" to the base value of the property.
2) In the Storyboard where you have your Slide animation, you can also animate the angle property back to zero (or whatever value suits your application). This would be something like:
<Storyboard>
<DoubleAnimation SB.TargetName="myImage" SB.TargetProperty="(Image.RenderTransform).(TransformGroup.Children)[0].(RotateTransform.Angle)" To="0"/>
<DoubleAnimation SB.TargetName="myImage" SB.TargetProperty="(Image.RenderTransform).(TransformGroup.Children)[0].(TranslateTransform.X)" To="200"/>
</Storyboard>
Thanks,
Ed
mgoldin
Thanks for reply,sorry for reading it late
but still its not working,i tried your first method like following
this animation is written on Y axis
(PreviewImage.RenderTransform
as TranslateTransform).BeginAnimation(TranslateTransform.YProperty, null);follwing is written on X axis
(PreviewImage.RenderTransform
as TranslateTransform).BeginAnimation(TranslateTransform.XProperty, null);but still they are leaving the effect.
I am also posting the peace of code that i have written
Following code is slide left animation
private
void SlideLeft(){
CreateNewObject();
PreviewImage.RenderTransformOrigin =
new Point(0, 0); TranslateTransform SlideLeftTranslateTransform = new TranslateTransform(0, 0);PreviewImage.RenderTransform = SlideLeftTranslateTransform;
PreviewImageLoadedTrigger.SourceName = rdSlideLeft.Name;
PreviewImage.RenderTransform = SlideLeftTranslateTransform;
PreviewImageFirstAnimation.From = 0;
PreviewImageFirstAnimation.To = -200;
if (NameRegistered){
UnregisterName(
"ImageTranslate");(PreviewImage.RenderTransform
as TranslateTransform).BeginAnimation(TranslateTransform.XProperty, null);}
RegisterName(
"ImageTranslate", SlideLeftTranslateTransform);NameRegistered =
true;PreviewImageFirstAnimation.Duration =
new Duration(new TimeSpan(0, 0, 5));PreviewImageFirstAnimation.AutoReverse =
true; Storyboard.SetTargetName(PreviewImageFirstAnimation, "ImageTranslate"); Storyboard.SetTargetProperty(PreviewImageFirstAnimation, new PropertyPath(TranslateTransform.XProperty));PreviewImageStoryBoard.Children.Add(PreviewImageFirstAnimation);
PreviewImageStoryBoard.Begin(PreviewImage,
HandoffBehavior.SnapshotAndReplace, true);}
Following code is for Bottom to top animation
private
void BottomToTop(){
CreateNewObject();//In this i allocate memory to various objects like Storyboard,Doubleanimation ,etc
PreviewImage.RenderTransformOrigin =
new Point(0, 0); // PreviewImageStoryBoard.Children.ClearValue(TranslateTransform.XProperty); //PreviewImageStoryBoard.Children.ClearValue(TranslateTransform.YProperty);PreviewImage.RenderTransform = PreviewImageTranslate;
PreviewImageTranslate.X = 0;
PreviewImageLoadedTrigger.SourceName = rdBottomTop.Name;
PreviewImageFirstAnimation.From = 200;
PreviewImageFirstAnimation.To = 0;
if (NameRegistered){
UnregisterName(
"ImageTranslate"); // PreviewImageStoryBoard.Remove(PreviewImage); // PreviewImageStoryBoard.Children.Remove(PreviewImageFirstAnimation);(PreviewImage.RenderTransform
as TranslateTransform).BeginAnimation(TranslateTransform.YProperty, null);}
RegisterName(
"ImageTranslate", PreviewImageTranslate);NameRegistered =
true;PreviewImageFirstAnimation.Duration =
new Duration(new TimeSpan(0, 0, 5)); Storyboard.SetTargetName(PreviewImageFirstAnimation, "ImageTranslate"); Storyboard.SetTargetProperty(PreviewImageFirstAnimation, new PropertyPath(TranslateTransform.YProperty));PreviewImageStoryBoard.Children.Add(PreviewImageFirstAnimation);
PreviewImageStoryBoard.Begin(PreviewImage,
HandoffBehavior.SnapshotAndReplace,true);}
Waiting for your reply