This project is read-only.



  • Complete
  • Update
  • Stopped
  • Begin


// create ease
EaseObject easeObject = ArtefactAnimator.AddEase(element, AnimationTypes.Alpha, 0, time, ease, delay);

// add callback
easeObject.Complete += new EaseObjectHandler(CompleteHandler);

// handle callback
void CompleteHandler(EaseObject easeObject, double percent)

Event Extensions

Instead of the += way of attaching an event, Extensions can help add multiple listeners while keeping code on the same line.


Events using Lambda Expressions

The easiest and fastest way of adding callbacks is by using lambda expressions combined with the extensions.

element.AutoAlphaTo(0, time, ease, delay)
.OnBegin((eo, p) => Debug.WriteLine("Begin Percent=" + p))
.OnUpdate((eo, p) => Debug.WriteLine("Updated Percent=" + p))
.OnComplete((eo, p) => Debug.WriteLine("Complete Percent=" + p));


Standard EventHandlers can be wrapped in the Callback Extension.

void RunAnimation(UIElement element, EventHandler callback)
    double time = .8;
    double delay = 0;
    PercentHandler ease = AnimationTransitions.CubicEaseOut;

    element.AutoAlphaTo(0, time, ease, delay).Callback(callback);

void AnimationsComplete(object sender, EventArgs args)
    Debug.WriteLine("Animations Completed");

Last edited Mar 2, 2010 at 8:51 PM by jgraup, version 2


No comments yet.