示例#1
0
        public override IRender Render(float dt)
        {
            float barValue = 0;

            if (_featureCache.IsBeat())
            {
                _beatPeriod        = _featureCache.GetBeatPeriod();
                _remainingBeatTime = _beatPeriod;
            }
            else if (_remainingBeatTime > 0)
            {
                _remainingBeatTime = Math.Max(_remainingBeatTime - dt, 0);
                barValue           = (1f - _remainingBeatTime / _beatPeriod);
            }

            int barSize = (int)(Width / 2 * barValue);

            using (var canvas = _render.CreateCanvas())
            {
                canvas.Clear();

                var paint = new SKPaint
                {
                    IsAntialias = true,
                    Color       = _color,
                    Style       = SKPaintStyle.Fill
                };

                canvas.DrawRect(Width / 2, 0, barSize, Height, paint);
                canvas.DrawRect(Width / 2 - barSize, 0, barSize, Height, paint);
                paint.Dispose();
            }

            return(_render);
        }
示例#2
0
        /*	In this method you will be able to render your effect. It will be called for
         *      each frame of your project, assuming this layer is enabled. */
        public override IRender Render(float dt)
        {
            /*  Create a new color on each beat. */
            if (_featureCache.IsBeat())
            {
                _color = _api.CreateRandomColor();
            }

            /*  Map every pixel in the render to the configured color */
            using (var canvas = _render.CreateCanvas())
                canvas.Clear(_color);

            return(_render);
        }
示例#3
0
        /*	In this method you will be able to render your effect. It will be called for
         *      each frame of your project, assuming this layer is enabled. */
        public override IRender Render(float dt)
        {
            /*	Add a new droplet with random color on each beat. */
            if (_featureCache.IsBeat())
            {
                var color = _api.CreateRandomColor();
                _waveSimulation.AddDrop(Width / 2, color);
            }

            /* Reset all pixels on the render. */
            _render.Clear();

            /* Update the wave simulation. */
            _waveSimulation.Update(dt);

            /* Render the wave simulation */
            _waveSimulation.Render(_render);

            return(_render);
        }