コード例 #1
0
    public void DoFadeOut()
    {
        var            curve       = CurveFactory.Create(1f, 0f);
        Action <float> fadeOut     = (t) => canvasGroup.alpha = curve.Evaluate(t);
        Action <float> scaleCanvas = (t) => obj.transform.localScale = new Vector3(curve.Evaluate(t), curve.Evaluate(t), curve.Evaluate(t));
        Action <float> combined    = fadeOut + scaleCanvas;

        StartCoroutine(CoroutineFactory.Create(duration, combined));
    }
    public void Shake()
    {
        button.interactable = false;
        phraseBox.text      = phrases.Random();

        var alphaFade = CurveFactory.Create(0f, 1f);
        var scaleFade = CurveFactory.Create(0.5f, 1f);

        Action <float> alphaTick = (t) => phraseBox.SetAlpha(alphaFade.Evaluate(t));
        Action <float> scaleTick = (t) => phraseBox.SetScale(scaleFade.Evaluate(t));


        StartCoroutine(CoroutineFactory.Create(1f, alphaTick + scaleTick, () => button.interactable = true));
    }
コード例 #3
0
 public void DoFadeOut()
 {
     StartCoroutine(Fade(CurveFactory.Create(0f, 1f)));
 }