Example #1
0
    public IEnumerator MoveTo(Vector2 target, float duration, int type)
    {
        float   t                = 0;
        Vector2 start            = rectTransform.anchoredPosition;
        float   distancePosition = Vector2.Distance(start, target);
        Vector2 unit             = Vector3.Normalize(target - start);

        while (t < duration)
        {
            t += Time.deltaTime;
            if (t > duration)
            {
                t = duration;
            }
            float traveled = 0;
            if (type == 0) //In
            {
                traveled = Easing.EaseInCubic(t, 0, distancePosition, duration);
            }
            else if (type == 1) //Out
            {
                traveled = Easing.EaseOutCubic(t, 0, distancePosition, duration);
            }
            else if (type == 2) //InOut
            {
                traveled = Easing.EaseInOutCubic(t, 0, distancePosition, duration);
            }
            rectTransform.anchoredPosition = start + unit * traveled;

            yield return(null);
        }
    }
Example #2
0
    public override void Render(PostProcessRenderContext context)
    {
        var sheet = context.propertySheets.Get(Shader.Find("Custom/Warp"));

        settings.warp.Override(GlobalState.I.Warp);
        sheet.properties.SetFloat("_Blend", Easing.EaseInCubic(0, 1, GlobalState.I.Warp));
        context.command.BlitFullscreenTriangle(context.source, context.destination, sheet, 0);
    }
Example #3
0
        protected override void BatchUpdate(Microsoft.Xna.Framework.GameTime gameTime)
        {
            base.BatchUpdate(gameTime);

            pColor.A = (byte)Easing.Sin(t, 10f, 50f, .5f);
            //pColor.R = (byte)(Easing.Linear(t, 0, 255f) * (float)color.R);
            //pColor.G = (byte)(Easing.Linear(t, 255f, 0) * (float)color.G);
            effectOrigin.X = Easing.Linear(t, 0, r1 * 50);            //r2 * 2;
            //particleCount = (int)Easing.Sin(t, 0, 10000, .5f);
            rotSpeed      = Easing.EaseInCubic(t, 0f, -20f);
            particleCount = (int)Easing.Linear(t, 5000f, 500f);
        }
        protected override void BatchUpdate(Microsoft.Xna.Framework.GameTime gameTime)
        {
            base.BatchUpdate(gameTime);

            float a = Easing.Linear(t, 0.35f, -0.3f);

            pColor = new Color(a, a, a, a);

            effectOrigin.X = 10f * r0;// Easing.Linear(t, 0, r1 * 90);//r2 * 2;
            //particleCount = (int)Easing.Sin(t, 0, 10000, .5f);
            rotSpeed      = Easing.EaseInCubic(t, 0f, -20f);
            particleCount = (int)Easing.Linear(t, 0f, 20f);
        }
Example #5
0
    public IEnumerator pullInScore(float duration, BoardSoundsEffect se)
    {
        float t = 0;

        while (t < duration)
        {
            t += Time.deltaTime;
            if (t > duration)
            {
                t = duration;
            }
            float x     = Easing.EaseInCubic(t, 0, 70, duration);
            float alpha = Easing.EaseInCubic(t, 0, 1, duration);

            turnScoreRectTransform.anchoredPosition = new Vector2(70 - x, 0);
            turnScoreText.color = new Color(1, 1, 1, 1 - alpha);
            yield return(null);
        }
        score                += turnScore;
        scoreText.text        = score.ToString();
        turnScoreText.enabled = false;
        se.audioSource.PlayOneShot(se.gain);
        scoreRectTransform.localScale = new Vector2(1.6f, 1.6f);
        t = 0;
        while (t < duration)
        {
            t += Time.deltaTime;
            if (t > duration)
            {
                t = duration;
            }
            float x = Easing.EaseOutCubic(t, 0, 0.6f, duration);
            scoreRectTransform.localScale = new Vector2(1.6f - x, 1.6f - x);

            yield return(null);
        }
    }