本文整理匯總了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;
}
}