Esempio n. 1
0
    IEnumerator RunClock()
    {
        System.Action MakeShape = () => {
            var randomColor = Color.Lerp(lightBlue, darkBlue, Random.Range(0f, 1f));
            var anim        = NoteFactory.CreateRectInViewport(
                x: Random.Range(0, 9) / 10f + 0.1f,
                y: Random.Range(0, 9) / 10f + 0.1f,
                width: 0.02f,
                height: 0.9f,
                color: randomColor,
                level: ShapeZLevel.Front);
            Keyframe[] kff = KeyframeHelper.CreateKeyframes(
                0, 0,
                Beat * 4, 1,
                Beat * 8, 1,
                Beat * 12, 0
                );

            anim.pivot = new Vector2(0, -1.5f);
            //anim.velocity = new Vector2(Random.Range(-1f, 1f), Random.Range(-1f, 1f));
            anim.angularVelocity = 15f;

            anim.DestroyIn(Beat * 13);
            anim.AddAnimationCurve(AnimationKeyPath.Opacity, new AnimationCurve(kff));
        };

        // until measure 40
        foreach (var rest in Loop(64, 0, 0, 8))
        {
            MakeShape();
            yield return(rest);
        }
    }
Esempio n. 2
0
    IEnumerator RunDiagonalLines()
    {
        System.Action MakeShape = () => {
            var randomColor = Color.Lerp(darkBlue, blue, Random.value); // closer to red
            var anim        = NoteFactory.CreateRectInViewport(
                x: Random.value, y: Random.value, width: Random.Range(0.2f, 0.5f), height: 0.001f, color: randomColor, rotation: Random.value * 360);
            var        maxOpacity = Random.Range(0.5f, 1f);
            Keyframe[] kff        = KeyframeHelper.CreateKeyframes(
                0, 0,
                Beat, maxOpacity,
                Beat * 20, maxOpacity,
                Beat * 30, 0
                );

            anim.DestroyIn(Beat * 40);
            anim.AddAnimationCurve(AnimationKeyPath.Opacity, new AnimationCurve(kff));
        };

        foreach (var rest in Loop(16, 0, 0, 4))
        {
            MakeShape();
            yield return(rest);
        }

        yield return(Rest(8));

        foreach (var rest in Loop(16, 0, 0, 2))
        {
            MakeShape();
            yield return(rest);
        }
    }
Esempio n. 3
0
    IEnumerator RunBackground()
    {
        System.Action MakeShape = () => {
            var randomColor = Color.Lerp(Color.white, lightBeige, Random.Range(0.8f, 1f));
            var anim        = NoteFactory.CreateRectInViewport(
                x: Random.Range(0, 9) / 10f + 0.1f,
                y: Random.Range(0, 9) / 10f + 0.1f,
                width: Random.Range(0.46f, 0.63f),
                height: Random.Range(0.42f, 0.60f),
                color: randomColor,
                level: ShapeZLevel.Back / 1000f);
            Keyframe[] kff = KeyframeHelper.CreateKeyframes(
                0, 0,
                Beat * 8, Random.Range(0.8f, 0.9f),
                Beat * 16, Random.Range(0.8f, 0.9f),
                Beat * 32, 0
                );

            anim.DestroyIn(Beat * 33);
            anim.AddAnimationCurve(AnimationKeyPath.Opacity, new AnimationCurve(kff));
        };

        // until measure 40
        foreach (var rest in Loop(64, 0, 1, 0))
        {
            MakeShape();
            yield return(rest);
        }
    }
Esempio n. 4
0
    IEnumerator RunSquareBeats()
    {
        Color[]       colors    = { orange, red, purple };
        System.Action MakeShape = () => {
            var randomColor = Color.Lerp(red, blue, Random.Range(0.5f, 1f));
            var anim        = NoteFactory.CreateRectInViewport(
                x: Random.Range(0, 9) / 10f + 0.1f, y: Random.Range(0, 9) / 10f + 0.1f, width: Random.Range(0.06f, 0.13f), height: Random.Range(0.12f, 0.20f), color: randomColor, level: ShapeZLevel.Back / 1000f);
            Keyframe[] kff = KeyframeHelper.CreateKeyframes(
                0, 0,
                Beat, 1,
                Beat * 3, 1,
                Beat * 4, 0
                );

            anim.DestroyIn(Beat * 6);
            anim.AddAnimationCurve(AnimationKeyPath.Opacity, new AnimationCurve(kff));
        };

        // until measure 40
        foreach (var rest in Loop(64, 0, 0, 1))
        {
            MakeShape();
            yield return(rest);
        }
    }
Esempio n. 5
0
    IEnumerator RunHorizontalLines()
    {
        yield return(Rest(8));

        System.Action MakeShape = () => {
            var randomColor = Color.Lerp(orange, red, Random.value); // closer to red
            var anim        = NoteFactory.CreateRectInViewport(
                x: 0.5f, y: Random.Range(0, 10) / 10f, width: 1f, height: 0.03f, color: randomColor);
            var        maxOpacity = Random.Range(0.7f, 1f);
            Keyframe[] kff        = KeyframeHelper.CreateKeyframes(
                0, 0,
                Beat * 2, maxOpacity,
                Beat * 6, maxOpacity,
                Beat * 8, 0
                );
            Debug.Log(anim.position);

            anim.DestroyIn(Beat * 10);
            anim.AddAnimationCurve(AnimationKeyPath.Opacity, new AnimationCurve(kff));
        };

        foreach (var rest in Loop(32, 0, 0, 2))
        {
            MakeShape();
            yield return(rest);
        }

        yield return(Rest(8));

        foreach (var rest in Loop(16, 0, 0, 2))
        {
            MakeShape();
            yield return(rest);
        }
    }
Esempio n. 6
0
    IEnumerator RunShapes4()
    {
        yield return(Rest(24));

        foreach (var i in Times(1000))
        {
            foreach (var _ in Times(1))
            {
                var randomColor = Color.Lerp(orange, red, Random.value); // closer to red
                var anim        = NoteFactory.CreateRectInViewport(
                    x: 0.5f, y: Random.Range(0, 10) / 10f, width: 0.7f, height: 0.1f, color: randomColor, rotation: Random.value * 360);
                var        maxOpacity = Random.Range(0.5f, 1f);
                Keyframe[] kff        = KeyframeHelper.CreateKeyframes(
                    0, 0,
                    Beat, maxOpacity,
                    Beat * 2, maxOpacity,
                    Beat * 3, 0
                    );

                anim.DestroyIn(Beat * 4);
                anim.AddAnimationCurve(AnimationKeyPath.Opacity, new AnimationCurve(kff));
            }
            yield return(Rest(0, 4f));
        }
    }
Esempio n. 7
0
    IEnumerator RunDiagonalLines()
    {
        System.Action MakeShape = () => {
            //var randomColor = Color.Lerp(orange, red, Random.value); // closer to red
            var randomColor = colors.Shuffle().First();
            var anim        = NoteFactory.CreateRectInViewport(
                x: 0.5f, y: Random.Range(0, 10) / 10f, width: 0.7f, height: 0.1f, color: randomColor, rotation: Random.value * 360);
            var        maxOpacity = Random.Range(1f, 1f);
            Keyframe[] kff        = KeyframeHelper.CreateKeyframes(
                0, 0,
                Beat, randomColor.a,
                Beat * 2, randomColor.a,
                Beat * 3, 0
                );

            anim.DestroyIn(Beat * 4);
            anim.AddAnimationCurve(AnimationKeyPath.Opacity, new AnimationCurve(kff));
        };

        foreach (var rest in Loop(1000000, 0, 1, 2))
        {
            MakeShape();
            yield return(rest);
        }
    }
Esempio n. 8
0
    IEnumerator RunSquareBeats()
    {
        //Color[] colors = {orange, red, purple};
        float[]       heights   = { 0.08f, 0.2f, 0.13f };
        System.Action MakeShape = () => {
            var randomColor = colors.Shuffle().First();
            //var randomColor = Color.Lerp(red, blue, Random.Range(0.5f, 1f));
            var randHeight = RandomHelper.Pick(heights);
            var anim       = NoteFactory.CreateRectInViewport(
                x: Random.Range(0, 9) / 10f + 0.1f, y: Random.Range(0, 9) / 10f + 0.1f, width: randHeight / 1.6f, height: randHeight, color: randomColor, level: ShapeZLevel.Back / 1000f);
            Keyframe[] kff = KeyframeHelper.CreateKeyframes(
                0, 0,
                Beat, randomColor.a,
                Beat * 6f, randomColor.a,
                Beat * 7, 0
                );

            anim.DestroyIn(Beat * 8);
            anim.AddAnimationCurve(AnimationKeyPath.Opacity, new AnimationCurve(kff));
        };

        // until measure 40
        foreach (var rest in Loop(10000000, 0, 2, 1))
        {
            MakeShape();
            yield return(rest);
        }
    }
Esempio n. 9
0
    IEnumerator RunShapes()
    {
        foreach (var i in Times(100))
        {
            var randomColor = Color.Lerp(red, blue, Random.value); // closer to red
            var anim        = NoteFactory.CreateRectInViewport(
                x: Random.value, y: Random.value, width: Random.value * 0.3f, height: Random.value * 0.3f, color: randomColor);
            Keyframe[] kff = KeyframeHelper.CreateKeyframes(
                0, 0,
                10, 1,
                20, 1,
                30, 0
                );

            anim.AddAnimationCurve(AnimationKeyPath.Opacity, new AnimationCurve(kff));
            anim.DestroyIn(31);
            yield return(Rest(1, 0));
        }
    }
Esempio n. 10
0
    IEnumerator RunShapes2()
    {
        Color[] colors = { orange, red, purple };
        // until measure 40
        foreach (var i in Times(1000))
        {
            var randomColor = Color.Lerp(red, blue, Random.Range(0.5f, 1f));
            var anim        = NoteFactory.CreateRectInViewport(
                x: Random.Range(0, 9) / 10f + 0.1f, y: Random.Range(0, 9) / 10f + 0.1f, width: 0.13f, height: 0.2f, color: randomColor, level: ShapeZLevel.Back + i / 1000f);
            Keyframe[] kff = KeyframeHelper.CreateKeyframes(
                0, 0,
                Beat, 1,
                Beat * 3, 1,
                Beat * 4, 0
                );

            anim.DestroyIn(Beat * 6);
            anim.AddAnimationCurve(AnimationKeyPath.Opacity, new AnimationCurve(kff));
            yield return(Rest(0, 1f));
        }
    }