예제 #1
0
        private void Start()
        {
            started = false;
            if (_instance == null)
            {
                _instance = this;
            }

            // get worldposition inside positions to check

            // middle of the canvas
            Vector2 viewportPosition = Camera.main.WorldToViewportPoint(canvas.transform.position);

            upInside  = (canvasRect.sizeDelta.y * canvasRect.localScale.y) * upperInsideHeight;
            lowInside = (canvasRect.sizeDelta.y * canvasRect.localScale.y) * lowerInsideHeight;
            upFade    = (canvasRect.sizeDelta.y * canvasRect.localScale.y) * upperFadeHeight;
            lowFade   = (canvasRect.sizeDelta.y * canvasRect.localScale.y) * lowerFadeHeight;

            UpdateScrollElements();

            if (useScollRectAsInsideArea)
            {
                //insideBounds = new Bounds();
                //RectTransform r = scrollRect.content;
                //insideBounds.center = scrollRect.content.transform.position;
                //insideBounds.size = new Vector3(r.rect.width, r.rect.height);
            }
        }
예제 #2
0
 // begins fade-in animation. Animator needs to have a "fadein" trigger and transitions using it.
 public void FadeIn()
 {
     if (canBeAnimated && !isFadedIn)
     {
         if (elementType == ElementType.editorLevel && UIScrollFade.IsInside(this.transform.position))
         {
             anim["scrollElementFadein"].speed = 1;
             anim["scrollElementFadein"].time  = 0F;
             anim.Play("scrollElementFadein");
         }
         else if (UIScrollFade.IsInside(this.transform.position))
         {
             anim["productFade"].speed = 1;
             anim["productFade"].time  = 0F;
             anim.Play("productFade");
         }
         isFadedIn = true;
     }
 }