public float LerpValue(float time) { if (Position() == TimePosition.Begin) { return(time == second.Timestamp() ? 1 : 0); } if (Position() == TimePosition.End) { return(time == first.Timestamp() ? 0 : 1); } return((time - first.Timestamp()) / (second.Timestamp() - first.Timestamp())); }
public void Save(TimelineObject <T> obj) { if (saves.Count > 0 && obj.Timestamp() <= saves[saves.Count - 1].Timestamp()) { throw new TimelineException("Saving non-sequential timestamp:" + " Previous - " + saves[saves.Count - 1].Timestamp() + " / Tried - " + obj.Timestamp() + "."); } saves.Add(obj); }