Пример #1
0
        /// <inheritdoc />
        public override void OnUpdate(float delta)
        {
            if (GetKey(Key.Enter).Pressed)
            {
                time = 0;
                dir  = true;
                Noise.Seed();
            }

            time += 0.01f * (dir ? 1 : -1);

            if (time <= 0 || time >= 360)
            {
                dir = !dir;
            }


            for (int i = 0; i < ScreenWidth; i++)
            {
                for (int j = 0; j < ScreenHeight; j++)
                {
                    float x = (float)i / ScreenWidth;
                    float y = (float)j / ScreenWidth;

                    float noise = Noise.FBM(x, y, time);
                    noise = noise / 2 + 1;

                    Pixel p = Pixel.FromHsv(noise * Mathf.PingPong(time, 3), noise, noise * 0.8f);

                    Draw(i, j, p);
                }
            }
        }