internal void Remove(Glide glide) { toRemove.Add(glide); }
/// <summary> /// Tweens a set of numeric properties on an object. /// </summary> /// <param name="target">The object to tween.</param> /// <param name="values">The values to tween to, in an anonymous type ( new { prop1 = 100, prop2 = 0} ).</param> /// <param name="duration">Duration of the tween in seconds.</param> /// <param name="delay">Delay before the tween starts, in seconds.</param> /// <returns>The tween created, for setting properties on.</returns> public Glide Tween(object target, object values, float duration, float delay = 0) { var glide = new Glide(); glide.target = target; glide.duration = duration; glide.delay = delay; glide.parent = this; toAdd.Add(glide); if (values == null) // in case of timer return glide; foreach (PropertyInfo property in values.GetType().GetProperties()) { var info = new GlideInfo(target, property.Name); var to = new GlideInfo(values, property.Name, false).Value; float s = info.Value; float r = to - s; glide.vars.Add(info); glide.start.Add(s); glide.range.Add(r); glide.end.Add(to); } return glide; }