예제 #1
0
 private BlobItem CreateBlob()
 {
     return(new BlobItem
     {
         Position = (float)_rand.NextDouble() * Width,
         Life = _maxBlobLife,
         MaxLife = _maxBlobLife,
         MaxSize = _maxBlobSize,
         Color = _api.CreateRandomColor(),
     });
 }
예제 #2
0
        public override void OnTrigger(uint triggerId, bool risingEdge)
        {
            if (!risingEdge)
            {
                return;
            }

            if ((TriggerId)triggerId == TriggerId.ChangeColorTrigger)
            {
                _color = _api.CreateRandomColor();
            }
        }
예제 #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)
        {
            /*  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);
        }
예제 #4
0
        /*	Every time a configured trigger is triggered, either manually by the user
         *      or due to a feature binding, this method will be called.*/
        public override void OnTrigger(uint triggerId, bool risingEdge)
        {
            /*	We only want to be triggerd on rising edges. */
            if (!risingEdge)
            {
                return;
            }

            /*	We've got triggered! Lets add a droplet to the wave simulation. */
            if ((TriggerId)triggerId == TriggerId.AddDrop)
            {
                var color = _api.CreateRandomColor();
                _waveSimulation.AddDrop(Width / 2f, color);
            }
        }
예제 #5
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);
        }