コード例 #1
0
ファイル: Animations.cs プロジェクト: AresLee/FarmerSimulator
        /// <summary>
        /// Open animation.
        /// </summary>
        /// <returns>Animation.</returns>
        /// <param name="rect">Rect.</param>
        /// <param name="time">Time.</param>
        public static IEnumerator Open(RectTransform rect, float time=0.5f)
        {
            if (rect!=null)
            {
                var layout = rect.GetComponentInParent<EasyLayout.EasyLayout>();
                var max_height = rect.rect.height;

                var end_time = Time.time + time;

                while (Time.time <= end_time)
                {
                    var height = Mathf.Lerp(0, max_height, 1 - (end_time - Time.time) / time);
                    rect.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, height);
                    if (layout!=null)
                    {
                        layout.NeedUpdateLayout();
                    }
                    yield return null;
                }

                //return height back for future use
                rect.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, max_height);
            }
        }
コード例 #2
0
	void EndRecord(EMMotionProperties motion,RectTransform rect){

		startRect.ApplyAllToRectTransform( rect, rect.GetComponentInParent<CanvasGroup>() );
	}
コード例 #3
0
 void Awake()
 {
     rect = GetComponent<RectTransform>();
     canvas = rect.GetComponentInParent<Canvas>();
 }