How to reset an animation ?

Aug 15, 2010 at 3:15 PM
Edited Aug 15, 2010 at 3:20 PM

Hi I wonder how you would go about resetting a chained animation ?

What a want to do is :

1. move a textbox down ( into screen ).
2. fade up the text. wait for 3 sec.
3. fade the text down.
4. move textbox out ( off screen )

Quess there is a smarter way ? because if the show info gets fired a few times , the chained animation does not work as expected.
How would you implement something like this chained animation in Artefact Animator ?

Kind regards.
--------------------------------------------------------------------------------------------------------------
example :
EaseObject easeObject;

void showinfo() {
   easeObject = ArtefactAnimator.AddEase(infobar_top, Canvas.TopProperty, 0, .5, AnimationTransitions.QuarticEaseOut, .5); easeObject.Complete += (eo, p) => showText();
}

void showText()
{
   easeObject = ArtefactAnimator.AddEase(textinfoHolder, OpacityProperty, 1, .4, AnimationTransitions.QuarticEaseOut, 0); easeObject.Complete += (eo, p) => hideText();
}

void hideText() {
   easeObject = ArtefactAnimator.AddEase(textinfoHolder, OpacityProperty, 0, .4, AnimationTransitions.QuarticEaseOut, 3); easeObject.Complete += (eo, p) => hideinfo();
}

void hideinfo(){
   easeObject = ArtefactAnimator.AddEase(infobar_top, Canvas.TopProperty, -175, .5, AnimationTransitions.QuarticEaseOut, 0);
}

Coordinator
Aug 21, 2010 at 4:11 AM

Hey bomanden,

I think you started it right, and assuming you don't want to transitions between the states, just add a reset to show info.

 

EaseObject easeObject;
private void Reset()
{
    if (easeObject != null) easeObject.Stop();
    Canvas.SetTop(infobar_top, -175);
    textinfoHolder.Opacity = 0;
}
 
private void ShowInfo()
{
    Reset();
    easeObject = ArtefactAnimator.AddEase(infobar_top, Canvas.TopProperty, 0, .5, AnimationTransitions.QuarticEaseOut, .5).OnComplete(showText);
}

void showText(EaseObject eo, double percent)
{
    easeObject = ArtefactAnimator.AddEase(textinfoHolder, OpacityProperty, 1, .4, AnimationTransitions.QuarticEaseOut, 0).OnComplete(hideText);
}

void hideText(EaseObject eo, double percent)
{
    easeObject = ArtefactAnimator.AddEase(textinfoHolder, OpacityProperty, 0, .4, AnimationTransitions.QuarticEaseOut, 3).OnComplete(hideinfo);
}

void hideinfo(EaseObject eo, double percent)
{
    easeObject = ArtefactAnimator.AddEase(infobar_top, Canvas.TopProperty, -175, .5, AnimationTransitions.QuarticEaseOut, 0).OnComplete((e,p)=>{easeObject=null;});
}

 

Aug 23, 2010 at 10:35 AM

Thanks jgraup 
Your answer is working for me :)
I just found the EaseObjectGroup class, is it only used to tell when all animations in a loop is done , not something like "my problem" ?
http://artefactanimator.codeplex.com/wikipage?title=easeobjectgroup&referringTitle=Documentation 

But thanks again, you have done a great job on this dll :) 

/Bo 

Coordinator
Aug 23, 2010 at 7:19 PM

Thanks Bo.

I haven't had much time to work on it since the release, but I'll try to dip back into it. As for your problem, it sounds like you just want some sequencing support.
EaseObjectGroup is really there to report when all its containing EaseObjects have completed - that way I could move on from a group of animations without having to add the Complete handler to the last object in the group.

In the situation above, you have states A -> B -> C -> D -> A.

Are you wanting to retain state A, start the chain, and at any moment stop the chain and return to state A? Or are you wanting to just stop the chain and handle the first state on your own?

Regards,
Jesse