/// <summary> /// Instead of easing based on time, generate n interpolated points (slices) /// between the start and end positions. /// </summary> /// <param name="ease"> /// A <see cref="Function"/> /// </param> /// <param name="start"> /// A <see cref="Vector3"/> /// </param> /// <param name="end"> /// A <see cref="Vector3"/> /// </param> /// <param name="slices"> /// A <see cref="System.Int32"/> /// </param> /// <returns> /// A <see cref="IEnumerator"/> /// </returns> public static IEnumerator NewEase(Function ease, Vector3 start, Vector3 end, int slices) { IEnumerable <float> counter = Interpolate.NewCounter(0, slices + 1, 1); return(NewEase(ease, start, end, slices + 1, counter)); }
/// <summary> /// Returns sequence generator from the first node to the last node over /// duration time using the points in-between the first and last node /// as control points of a bezier curve used to generate the interpolated /// points in the sequence. If there are no control points (ie. only two /// nodes, first and last) then this behaves exactly the same as NewEase(). /// In other words a zero-degree bezier spline curve is just the easing /// method. The sequence is generated as it is accessed using the /// Time.deltaTime to calculate the portion of duration that has elapsed. /// </summary> /// <param name="ease"> /// A <see cref="Function"/> /// </param> /// <param name="nodes"> /// A <see cref="Transform[]"/> /// </param> /// <param name="duration"> /// A <see cref="System.Single"/> /// </param> /// <returns> /// A <see cref="IEnumerable<Vector3>"/> /// </returns> public static IEnumerable <Vector3> NewBezier(Function ease, Transform[] nodes, float duration) { IEnumerable <float> timer = Interpolate.NewTimer(duration); return(NewBezier <Transform>(ease, nodes, TransformDotPosition, duration, timer)); }
/// <summary> /// Returns sequence generator from start to end over duration using the /// given easing function. The sequence is generated as it is accessed /// using the Time.deltaTime to calculate the portion of duration that has /// elapsed. /// </summary> /// <param name="ease"> /// A <see cref="Function"/> /// </param> /// <param name="start"> /// A <see cref="Vector3"/> /// </param> /// <param name="end"> /// A <see cref="Vector3"/> /// </param> /// <param name="duration"> /// A <see cref="System.Single"/> /// </param> /// <returns> /// A <see cref="IEnumerator"/> /// </returns> public static IEnumerator NewEase(Function ease, Vector3 start, Vector3 end, float duration) { IEnumerable <float> timer = Interpolate.NewTimer(duration); return(NewEase(ease, start, end, duration, timer)); }