public static void Animate(this IAnimatable self, string name, Animation animation, uint rate = 16, uint length = 250, Easing easing = null, Action <double, bool> finished = null, Func <bool> repeat = null) { if (repeat == null) { self.Animate(name, animation.GetCallback(), rate, length, easing, finished, null); } else { Func <bool> r = () => { var val = repeat(); if (val) { animation.ResetChildren(); } return(val); }; self.Animate(name, animation.GetCallback(), rate, length, easing, finished, r); } }