public void Animate(IList <NPointF> path, bool reversed) { NPointF pinOffset = m_Shape.PinPoint - m_Shape.Location; NPointFList points = new NPointFList(path); if (reversed) { points.Reverse(); } int i, count = points.Count - 1; for (i = 0; i < count; i++) { // Determine the start and end point NPointF p1 = points[i] - pinOffset; NPointF p2 = points[i + 1] - pinOffset; // Create the animation float distance = p1.Distance(p2); float duration = distance / m_Speed; NTranslateAnimation move = new NTranslateAnimation(m_CurrentTime, duration); move.StartOffset = p1 - m_Shape.Location; move.EndOffset = p2 - m_Shape.Location; if (m_Shape.Style.AnimationsStyle == null) { m_Shape.Style.AnimationsStyle = new NAnimationsStyle(); } m_Shape.Style.AnimationsStyle.Animations.Add(move); m_CurrentTime += duration; } }
public void SetPause(NPointF location, float duration) { NTranslateAnimation move = new NTranslateAnimation(m_CurrentTime, duration); move.EndOffset = location - m_Shape.PinPoint; move.StartOffset = move.EndOffset; if (m_Shape.Style.AnimationsStyle == null) { m_Shape.Style.AnimationsStyle = new NAnimationsStyle(); } m_Shape.Style.AnimationsStyle.Animations.Add(move); m_CurrentTime += duration; }