示例#1
0
    public IEnumerator ScaleWithTime(Transform extrudedCell, float timeToMove)
    {
        //  Debug.Log("here");
        var t = 0f;

        while (t < 1)
        {
            t += Time.deltaTime / timeToMove;
            float eased = Easings.BounceEaseOut(t);

            Vector3 targetScale = Vector3.one;
            extrudedCell.localScale = Vector3.Lerp(Vector3.zero, targetScale, eased);
            yield return(null);
        }

        //once it gets here, set true
        finishedAnimating = true;
        //let skyscraper script we already re aligned thisc ell
        //GetComponent<SkyscraperFromVoronoiCell>().cellReAligned = true;
        //alos, set parent cell at height of extruded cell
        //transform.position += Vector3.up *depth;//was mucking up splines
        //start build control
        GameObject.FindGameObjectWithTag("Code").GetComponent <BuildControl>().readyToBuild = true;

        if (showTints)
        {
            ShowTints();
        }
    }
示例#2
0
 // Token: 0x06000020 RID: 32 RVA: 0x00002754 File Offset: 0x00000954
 public static float BounceEaseInOut(float p)
 {
     if (p < 0.5f)
     {
         return(0.5f * Easings.BounceEaseIn(p * 2f));
     }
     return(0.5f * Easings.BounceEaseOut(p * 2f - 1f) + 0.5f);
 }
示例#3
0
    IEnumerator slide()
    {
        Vector3 targetPos;

        targetPos = panel.anchoredPosition;

        float startPos;
        float endPos;

        if (type == slideType.upDown)
        {
            startPos = panel.anchoredPosition.y;
        }
        else
        {
            startPos = panel.anchoredPosition.x;
        }

        if (toggle.isOn)
        {
            endPos = inPos;
        }
        else
        {
            endPos = outPos;
        }

        float startTime = Time.time;
        float progress  = 0;

        while (progress < 1)
        {
            progress = (Time.time - startTime) / slideTime;
            float easedProgress = Easings.BounceEaseOut(progress);
            float progressPos   = Mathf.Lerp(startPos, endPos, easedProgress);
            if (type == slideType.upDown)
            {
                targetPos.y = progressPos;
            }
            else
            {
                targetPos.x = progressPos;
            }

            panel.anchoredPosition = targetPos;
            yield return(null);
        }
    }
示例#4
0
 void Update()
 {
     if (roll)
     {
         float timeSinceStarted   = Time.time - timeInterpolationStarted;
         float percentageComplete = timeSinceStarted / interpolationDuration;
         transform.position = new Vector2(startPos.x + xOffset * Easings.QuadraticEaseOut(percentageComplete), startPos.y + yOffset * Easings.BounceEaseOut(percentageComplete));
         if (percentageComplete >= 1f)
         {
             Stop();
         }
     }
 }
示例#5
0
    // Token: 0x06000001 RID: 1 RVA: 0x00002050 File Offset: 0x00000250
    public static float Interpolate(float p, Easings.Functions function)
    {
        switch (function)
        {
        default:
            return(Easings.Linear(p));

        case Easings.Functions.QuadraticEaseIn:
            return(Easings.QuadraticEaseIn(p));

        case Easings.Functions.QuadraticEaseOut:
            return(Easings.QuadraticEaseOut(p));

        case Easings.Functions.QuadraticEaseInOut:
            return(Easings.QuadraticEaseInOut(p));

        case Easings.Functions.CubicEaseIn:
            return(Easings.CubicEaseIn(p));

        case Easings.Functions.CubicEaseOut:
            return(Easings.CubicEaseOut(p));

        case Easings.Functions.CubicEaseInOut:
            return(Easings.CubicEaseInOut(p));

        case Easings.Functions.QuarticEaseIn:
            return(Easings.QuarticEaseIn(p));

        case Easings.Functions.QuarticEaseOut:
            return(Easings.QuarticEaseOut(p));

        case Easings.Functions.QuarticEaseInOut:
            return(Easings.QuarticEaseInOut(p));

        case Easings.Functions.QuinticEaseIn:
            return(Easings.QuinticEaseIn(p));

        case Easings.Functions.QuinticEaseOut:
            return(Easings.QuinticEaseOut(p));

        case Easings.Functions.QuinticEaseInOut:
            return(Easings.QuinticEaseInOut(p));

        case Easings.Functions.SineEaseIn:
            return(Easings.SineEaseIn(p));

        case Easings.Functions.SineEaseOut:
            return(Easings.SineEaseOut(p));

        case Easings.Functions.SineEaseInOut:
            return(Easings.SineEaseInOut(p));

        case Easings.Functions.CircularEaseIn:
            return(Easings.CircularEaseIn(p));

        case Easings.Functions.CircularEaseOut:
            return(Easings.CircularEaseOut(p));

        case Easings.Functions.CircularEaseInOut:
            return(Easings.CircularEaseInOut(p));

        case Easings.Functions.ExponentialEaseIn:
            return(Easings.ExponentialEaseIn(p));

        case Easings.Functions.ExponentialEaseOut:
            return(Easings.ExponentialEaseOut(p));

        case Easings.Functions.ExponentialEaseInOut:
            return(Easings.ExponentialEaseInOut(p));

        case Easings.Functions.ElasticEaseIn:
            return(Easings.ElasticEaseIn(p));

        case Easings.Functions.ElasticEaseOut:
            return(Easings.ElasticEaseOut(p));

        case Easings.Functions.ElasticEaseInOut:
            return(Easings.ElasticEaseInOut(p));

        case Easings.Functions.BackEaseIn:
            return(Easings.BackEaseIn(p));

        case Easings.Functions.BackEaseOut:
            return(Easings.BackEaseOut(p));

        case Easings.Functions.BackEaseInOut:
            return(Easings.BackEaseInOut(p));

        case Easings.Functions.BounceEaseIn:
            return(Easings.BounceEaseIn(p));

        case Easings.Functions.BounceEaseOut:
            return(Easings.BounceEaseOut(p));

        case Easings.Functions.BounceEaseInOut:
            return(Easings.BounceEaseInOut(p));
        }
    }
示例#6
0
 // Token: 0x0600001E RID: 30 RVA: 0x000026C2 File Offset: 0x000008C2
 public static float BounceEaseIn(float p)
 {
     return(1f - Easings.BounceEaseOut(1f - p));
 }
示例#7
0
    // Update is called once per frame
    void Update()
    {
        if (personalLabel == null)
        {
            personalLabel = Instantiate(latexLabel);
            personalLabel.transform.parent = canvas.transform;
            personalLabel.GetComponent <TEXDraw>().text = labelText;
        }
        switch (state)
        {
        case OPEN:
            y = openY * scale;
            break;

        case CLOSED:
            y = closeY * scale;
            break;

        case OPENING:
            //y += Time.deltaTime * moveSpeed;

            timeLeft -= Time.deltaTime;
            y         = closeY * scale + Easings.BounceEaseOut((moveTimer - timeLeft) / moveTimer) * (openY * scale - closeY * scale);
            // if(y >= openY * scale)
            if (timeLeft <= 0)
            {
                y     = openY * scale;
                state = OPEN;
                if (onAnimEnd != null)
                {
                    onAnimEnd();
                }
            }
            break;

        case CLOSING:
            //y -= Time.deltaTime * moveSpeed;
            timeLeft -= Time.deltaTime;
            y         = openY * scale - Easings.BounceEaseOut((moveTimer - timeLeft) / moveTimer) * (openY * scale - closeY * scale);
            //if (y <= closeY * scale)

            if (timeLeft <= 0)
            {
                y     = closeY * scale;
                state = CLOSED;
                if (onAnimEnd != null)
                {
                    onAnimEnd();
                }
            }
            break;
        }
        Vector3 pos = top.transform.localPosition;

        pos.y = y;
        top.transform.localPosition = pos;

        pos   = bottom.transform.localPosition;
        pos.y = -y;
        bottom.transform.localPosition = pos;

        //latexLabel.transform.position = Camera.main.WorldToScreenPoint(pos);
        RectTransform rt = personalLabel.GetComponent <RectTransform>();


        pos += gameObject.transform.position;

        rt.position = Camera.main.WorldToScreenPoint(pos);
    }
示例#8
0
 public static float BounceEaseInOut(float p)
 {
     return((double)p < 0.5 ? 0.5f * Easings.BounceEaseIn(p * 2f) : (float)(0.5 * (double)Easings.BounceEaseOut((float)((double)p * 2.0 - 1.0)) + 0.5));
 }