예제 #1
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);
        }
    }
예제 #2
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);
        }
    }
예제 #3
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);
        }
    }
예제 #4
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);
        }
    }
예제 #5
0
    IEnumerator RunCircles()
    {
        Color[]       colors     = { orange, red, purple };
        System.Action MakeCircle = () => {
            var        randomColor = Color.Lerp(peach, blue, Random.Range(0.0f, 0.5f));
            var        diameter    = CameraHelper.Height * Random.Range(0.7f, 0.8f);
            var        cp          = new CircleProperty(color: randomColor, diameter: diameter, center: CameraHelper.RandomPositionNearCenter(diameter / 2));
            var        anim        = NoteFactory.CreateCircle(cp);
            Keyframe[] kff         = KeyframeHelper.CreateKeyframes(
                0, 0,
                Beat * 4, 1,
                Beat * 6, 1,
                Beat * 8, 0
                );

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

        // until measure 40
        foreach (var rest in Loop(64, 0, 2, 0))
        {
            MakeCircle();
            yield return(rest);
        }
    }
예제 #6
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);
        }
    }
예제 #7
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));
        }
    }
예제 #8
0
    IEnumerator RunCircles()
    {
        System.Action MakeCircle = () => {
            var        randomColor = colors.Shuffle().First();
            var        diameter    = CameraHelper.Height * Random.Range(0.7f, 0.8f);
            var        cp          = new CircleProperty(color: randomColor, diameter: diameter, center: CameraHelper.RandomPositionNearCenter(diameter / 2));
            var        anim        = NoteFactory.CreateCircle(cp);
            Keyframe[] kff         = KeyframeHelper.CreateKeyframes(
                0, 0,
                Beat * 1, randomColor.a,
                Beat * 7, randomColor.a,
                Beat * 8, 0
                );

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

        // until measure 40
        foreach (var rest in Loop(100000000, 0, 2, 0.25f))
        {
            MakeCircle();
            yield return(rest);
        }
    }
예제 #9
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);
        }
    }
예제 #10
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);
        }
    }
예제 #11
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));
        }
    }
예제 #12
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));
        }
    }
예제 #13
0
 public static AnimationCurve FromPairs(params float[] pairs)
 {
     return(new AnimationCurve(KeyframeHelper.CreateKeyframes(pairs)));
 }