本文整理汇总了C#中UnityEngine.RectTransform.DOAnchorPos方法的典型用法代码示例。如果您正苦于以下问题:C# RectTransform.DOAnchorPos方法的具体用法?C# RectTransform.DOAnchorPos怎么用?C# RectTransform.DOAnchorPos使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UnityEngine.RectTransform
的用法示例。
在下文中一共展示了RectTransform.DOAnchorPos方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SwitchPanel
private void SwitchPanel(RectTransform panelFrom, RectTransform panelTo)
{
DOTween.Kill(panelFrom.transform, true);
DOTween.Kill(panelTo.transform, true);
var y = panelFrom.anchoredPosition.y;
panelFrom.anchoredPosition = new Vector2(0, y);
panelFrom.DOAnchorPos(new Vector2(-700, y), 0.25f)
.OnComplete(() => panelFrom.gameObject.SetActive(false));
panelTo.gameObject.SetActive(true);
panelTo.anchoredPosition = new Vector2(700, y);
panelTo.DOAnchorPos(new Vector2(0, y), 0.25f);
}
示例2: AnimateOutro
/// <summary>
/// Plays the outro for the menu.
/// </summary>
private void AnimateOutro( RectTransform sliding, CanvasGroup fading, MenuDestinations d )
{
//Disable input
allowInput = false;
//Start animation
Sequence s = DOTween.Sequence ( )
.Append ( fading.DOFade ( 0, FADE_TIME ) )
.Append ( sliding.DOAnchorPos ( new Vector2 ( -sliding.rect.width, 0 ), SLIDE_TIME ) )
.OnComplete ( () =>
{
//Enable input
allowInput = true;
//Check transistion
switch ( d )
{
case MenuDestinations.RulesToAbilites:
//Hide button
abilityButton.SetActive ( false );
//Hide menu panel
rulesPanel.gameObject.SetActive ( false );
//Display ability panel
abilitiesPanel.gameObject.SetActive ( true );
//Set scroll panel to the top
scroll.value = 1;
//Display first ability
OnAbilityClick ( abilityButtons [ 0 ], false );
//Play intro
AnimateIntro ( abilitiesPanel, fading );
break;
case MenuDestinations.AbilitiesToRules:
//Hide ability panel
abilitiesPanel.gameObject.SetActive ( false );
//Display menu panel
rulesPanel.gameObject.SetActive ( true );
//Display overview
OnMenuClick ( menuButtons [ 3 ], false );
//Play intro
AnimateIntro ( rulesPanel, fading );
break;
case MenuDestinations.Tutorial:
Application.LoadLevel ( "Game Board" );
break;
case MenuDestinations.None:
Application.LoadLevel ( "Main Menu" );
break;
}
} )
.SetRecyclable ( )
.Play ( );
}
示例3: TweenOut
void TweenOut(RectTransform rt)
{
float tweenDist = -rt.rect.height;
rt.DOAnchorPos(new Vector2(0f,tweenDist),.2f);
}
示例4: AnimateIntro
/// <summary>
/// Plays the intro animation for the menu.
/// </summary>
private void AnimateIntro( RectTransform sliding, CanvasGroup fading )
{
//Disable input
allowInput = false;
//Set starting values
sliding.anchoredPosition = new Vector2 ( -sliding.rect.width, 0 );
fading.alpha = 0;
//Start animation
Sequence s = DOTween.Sequence ( )
.Append ( sliding.DOAnchorPos ( Vector2.zero, SLIDE_TIME ) )
.Append ( fading.DOFade ( 1, FADE_TIME ) )
.OnComplete ( () =>
{
//Enable input
allowInput = true;
} )
.SetRecyclable ( )
.Play ( );
}
示例5: TweenIn
void TweenIn(RectTransform rt)
{
rt.DOAnchorPos(new Vector2(0f,0f),.2f);
}