public Effects.Transition ToTransition <T>(Transition t, T target) { ITransitionType tp; switch (t.Type) { case "linear": tp = new TransitionType_Linear(t.Time); break; case "bounce": tp = new TransitionType_Bounce(t.Time); break; case "flash": tp = new TransitionType_Flash(t.FlashTimes, t.Time); break; case "deceleration": tp = new TransitionType_Deceleration(t.Time); break; case "throwcatch": tp = new TransitionType_ThrowAndCatch(t.Time); break; default: tp = new TransitionType_Linear(t.Time); break; } var r = new Effects.Transition(tp); foreach (var property in t.Properties) { object val = null; switch (property.Type) { case "int": val = NumberConverter.Convert(property.Value); break; case "color": val = ColorConverter.Convert(property.Value); break; } r.add(target, property.Name, val); } return(r); }
public Transition Convert(string s, object target) { var spl = s.Split(' '); var prop = spl[0]; var dur = new TimeConverter().Convert(spl[1]); var typ = spl[2]; var des = spl[3]; ITransitionType t = null; switch (typ) { case "linear": t = new TransitionType_Linear(dur); break; case "ease-inout": t = new TransitionType_EaseInEaseOut(dur); break; case "bounce": t = new TransitionType_Bounce(dur); break; case "throwcatch": t = new TransitionType_ThrowAndCatch(dur); break; case "damping": t = new TransitionType_CriticalDamping(dur); break; default: t = new TransitionType_Linear(dur); break; } var r = new Transition(t); r.add(target, prop, des); return(r); }