Exemple #1
0
 void ShowAd()
 {
     Tween.AnchoredPosition(presby.rectTransform, new Vector2(20, 0), 0.4f, 0);
     Observable.Timer(System.TimeSpan.FromSeconds(8f))
     .Subscribe((x) => {
         Tween.AnchoredPosition(presby.rectTransform, new Vector2(-300, 0), 0.4f, 0);
     });
 }
Exemple #2
0
    public void ShowBox()
    {
        if (thisBoxState == BoxState.Shown)
        {
            return;
        }

        Tween.AnchoredPosition(rectTransform, shownPos, tweenTime, 0f, curve1);

        thisBoxState = BoxState.Shown;
    }
Exemple #3
0
    //private void Update()
    //{
    //    if (Input.GetKeyDown(KeyCode.Space))
    //    {
    //        if (thisBoxState == BoxState.Hidden)
    //        {
    //            ShowBox();
    //        }

    //        else if (thisBoxState == BoxState.Shown)
    //        {
    //            HideBox();
    //        }
    //    }
    //}

    public void HideBox()
    {
        if (thisBoxState == BoxState.Hidden)
        {
            return;
        }

        Tween.AnchoredPosition(rectTransform, hiddenPos, tweenTime, 0f, curve1);

        thisBoxState = BoxState.Hidden;
    }
Exemple #4
0
    void DoAnchoredPositionTween(TweenData data)
    {
        RectTransform rectTrans = transform.GetComponent <RectTransform>();

        if (rectTrans == null)
        {
            Debug.LogWarning("no rect transform on " + transform.name, gameObject);
            return;
        }
        Tween.AnchoredPosition(rectTrans, data.StartPos, data.EndPos, data.Duration, 0f, data.Curve, Tween.LoopType.None, null, OnTweenFinish);
    }
Exemple #5
0
    // toggles between in and out positions
    public void ToggleInOut()
    {
        Vector3 targetPos = isIn ? outPos : inPos;

        if (inPos != outPos)
        {
            Tween.AnchoredPosition(transform as RectTransform, targetPos, duration, 0, TweenCurveHelper.GetCurve(curveType), Tween.LoopType.None, null, OnTweenEnd, false);
        }

        float scale = isIn ? outScale : inScale;

        if (inScale != outScale)
        {
            Tween.LocalScale(transform, scale * Vector3.one, duration, 0, TweenCurveHelper.GetCurve(curveType), Tween.LoopType.None, null, OnTweenEnd, false);
        }
        onTweenBegin.Invoke();

        isIn = !isIn;
    }
 // Start is called before the first frame update
 void Start()
 {
     Tween.AnchoredPosition(myrect, new Vector2(myrect.anchoredPosition.x, 0), 1, 0, Tween.EaseOut, Tween.LoopType.None, null, () => Tween.AnchoredPosition(myrect, new Vector2(myrect.anchoredPosition.x, 142), 1, 6, Tween.EaseIn, Tween.LoopType.None, null, () => Destroy(this.gameObject), false), false);
 }