當前位置: 首頁>>代碼示例>>C#>>正文


C# RectTransform.RotateAround方法代碼示例

本文整理匯總了C#中UnityEngine.RectTransform.RotateAround方法的典型用法代碼示例。如果您正苦於以下問題:C# RectTransform.RotateAround方法的具體用法?C# RectTransform.RotateAround怎麽用?C# RectTransform.RotateAround使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在UnityEngine.RectTransform的用法示例。


在下文中一共展示了RectTransform.RotateAround方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: ShowAndRotatePanelWhenPossible

 IEnumerator ShowAndRotatePanelWhenPossible(RectTransform thisRectTransform, Vector3 axis, float finalRotation, float duration, Vector3 rotationPivot)
 {
     Debug.Log("ShowAndRotatePanelWhenPossible()");
     thisRectTransform.gameObject.SetActive(false);
     while (!finishedRotationAnimation) yield return null;
     float flipDelta = GetPanelFlipDelta(thisRectTransform, axis, rotationPivot);
     thisRectTransform.gameObject.SetActive(false);
     thisRectTransform.localRotation = Quaternion.identity;
     thisRectTransform.RotateAround(rotationPivot, axis, 270f + flipDelta);
     thisRectTransform.gameObject.SetActive(true);
     StartCoroutine(PlayRotationAnimation(thisRectTransform, axis, finalRotation, duration, rotationPivot));
     //tabManager.busyWithPanelAnimation = false;
     if (addAlphaTweenEffect)
     {
         CanvasGroup thisCanvasGroup = thisRectTransform.gameObject.GetComponent<CanvasGroup>();
         thisCanvasGroup.alpha = 0.0f;
         StartCoroutine(PlayAlphaAnimation(thisCanvasGroup, 1.0f, duration/4));
     }
 }
開發者ID:leeohaddad,項目名稱:CodeWay,代碼行數:19,代碼來源:UITabPanelBehaviorFlipCenter.cs

示例2: PlayRotationAnimation

 // Rotation animation responsible for swapping the panels.
 IEnumerator PlayRotationAnimation(RectTransform thisRectTransform, Vector3 axis, float finalRotation, float duration, Vector3 rotationPivot)
 {
     if (!tabManager.busyWithPanelAnimation) tabManager.busyWithPanelAnimation = true;
     else readyToVacate = true;
     finishedRotationAnimation = false;
     float initialRotation = 0.0f, stepDuration = 0.1f;
     // Get Current Rotation
     initialRotation = GetRTAngleByAxis(thisRectTransform, axis);
     Debug.Log("PlayRotationAnimation(" + thisRectTransform.name + ": " + initialRotation + " -> " + finalRotation + ")");
     // Execute Animation
     for (float currentDuration=0; currentDuration<duration; currentDuration+=stepDuration)
     {
         float progress = currentDuration/duration;
         float easeProgress = (Mathf.Sin((-90f + 180f*progress)*Mathf.Deg2Rad)+1f)*0.5f;
         float rotationAngle = initialRotation + easeProgress * DistanceBetweenAngles(finalRotation, initialRotation);
         thisRectTransform.localRotation = Quaternion.identity;
         thisRectTransform.RotateAround(rotationPivot, axis, rotationAngle);
         yield return new WaitForSeconds(stepDuration);
     }
     thisRectTransform.localRotation = Quaternion.identity;
     thisRectTransform.RotateAround(rotationPivot, axis, finalRotation);
     finishedRotationAnimation = true;
     if (readyToVacate)
     {
         tabManager.busyWithPanelAnimation = false;
         readyToVacate = false;
     }
 }
開發者ID:leeohaddad,項目名稱:CodeWay,代碼行數:29,代碼來源:UITabPanelBehaviorFlipCenter.cs


注:本文中的UnityEngine.RectTransform.RotateAround方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。