当前位置: 首页>>代码示例>>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;未经允许,请勿转载。