本文整理汇总了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));
}
}
示例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;
}
}