示例#1
0
 public PYTweenAnimation SetEaseType(Ease.Type easeType)
 {
     AnimationData.EaseType  = easeType;
     AnimationData.UsingEase = true;
     easeMethod = System.Type.GetType("Playmove.Ease").GetMethod(AnimationData.EaseType.ToString());
     return(this);
 }
示例#2
0
    protected IEnumerator SnapCoroutine(Vector2 offset, float time, Ease.Type easeType)
    {
        float elapsed    = 0.0f;
        var   scrollAxis = scrollRect.vertical ? 1 : 0;
        var   startPos   = scrollRect.content.anchoredPosition;
        var   endPos     = startPos + offset;

        while (elapsed < time)
        {
            elapsed = Math.Min(elapsed + Time.unscaledDeltaTime, time);
            var progress = elapsed / time;
            var position = scrollRect.content.anchoredPosition;
            if (m_EaseType == Ease.Type.Custom)
            {
                position[scrollAxis] = Mathf.Lerp(startPos[scrollAxis], endPos[scrollAxis], m_EaseCurve != null ? m_EaseCurve.Evaluate(progress) : progress);
            }
            else
            {
                position[scrollAxis] = Ease.Evaluate(m_EaseType, startPos[scrollAxis], endPos[scrollAxis], progress);
            }
            scrollRect.content.anchoredPosition = position;
            yield return(null);
        }

        scrollRect.content.anchoredPosition = endPos;
        StopSnap();

        m_OnEndSnap.Invoke(GetSnappedTarget());
    }
示例#3
0
        /// <summary>
        /// Set tween easing function.
        /// </summary>
        /// <param name="ease">Easing type</param>
        public TweenCase SetEasing(Ease.Type ease)
        {
            easeFunction = Ease.GetFunction(ease);

            return(this);
        }
 public Item(Ease.Type type)
 {
     this.type       = type;
     this.transition = Ease.GetByType(this.type);
 }