コード例 #1
0
ファイル: Spline.cs プロジェクト: leventeren/BeauRoutine
 /// <summary>
 /// Generates info about an interpolation along the given spline.
 /// </summary>
 static public void GetUpdateInfo(this ISpline inSpline, float inPercent, SplineLerp inLerpMethod, Curve inSegmentEase, out SplineUpdateInfo outInfo)
 {
     outInfo.Spline    = inSpline;
     outInfo.Percent   = inSpline.TransformPercent(inPercent, inLerpMethod);
     outInfo.Point     = inSpline.GetPoint(outInfo.Percent, inSegmentEase);
     outInfo.Direction = inSpline.GetDirection(outInfo.Percent, inSegmentEase);
 }
コード例 #2
0
ファイル: Spline.cs プロジェクト: leventeren/BeauRoutine
        /// <summary>
        /// Samples the spline for the given range and outputs to a list.
        /// </summary>
        static public void Sample(this ISpline inSpline, List <Vector2> outPoints, float inStart, float inEnd, int inNumSamples, SplineLerp inLerp = SplineLerp.Vertex)
        {
            float delta = inEnd - inStart;

            for (int i = 0; i < inNumSamples; ++i)
            {
                float t = (float)i / (inNumSamples - 1);
                outPoints.Add(inSpline.GetPoint(inSpline.TransformPercent(inStart + t * delta, inLerp)));
            }
        }
コード例 #3
0
ファイル: Spline.cs プロジェクト: leventeren/BeauRoutine
        /// <summary>
        /// Samples the spline for the given range and outputs to an array.
        /// </summary>
        static public int Sample(this ISpline inSpline, Vector2[] outPoints, float inStart, float inEnd, int inStartIdx, int inNumSamples, SplineLerp inLerp = SplineLerp.Vertex)
        {
            inNumSamples = Mathf.Min(outPoints.Length - inStartIdx, inNumSamples);

            float delta = inEnd - inStart;

            for (int i = 0; i < inNumSamples; ++i)
            {
                float t = (float)i / (inNumSamples - 1);
                outPoints[inStartIdx + i] = inSpline.GetPoint(inSpline.TransformPercent(inStart + t * delta, inLerp));
            }

            return(inNumSamples);
        }
コード例 #4
0
ファイル: SplineTween.cs プロジェクト: BeauPrime/BeauRoutine
            public void ApplyTween(float inPercent)
            {
                if (m_SplineSettings.UpdateCallback != null)
                {
                    SplineUpdateInfo info;
                    Splines.Spline.GetUpdateInfo(m_Spline, inPercent, m_SplineSettings, out info);

                    m_Setter(info.Point);
                    m_SplineSettings.UpdateCallback(info);
                }
                else
                {
                    m_Setter(m_Spline.GetPoint(m_Spline.TransformPercent(inPercent, m_SplineSettings.LerpMethod), m_SplineSettings.SegmentEase));
                }
            }