public override IRender Render(float dt) { var chromas = _featureCache.GetChromas(); using (var canvas = _render.CreateCanvas()) { canvas.Clear(); for (int i = 0; i < NumBars; i++) { if (chromas[i] >= _threshold) { var paint = new SKPaint { IsAntialias = true, Color = _color.WithScale(chromas[i]), Style = SKPaintStyle.Fill }; int x0 = i * _barSize; canvas.DrawRect(x0, 0, _barSize, Height, paint); paint.Dispose(); } } } return(_render); }
public override IRender Render(float dt) { _render.Clear(); _render.Map((x, y) => { float xt = (float)x / Width - 0.5f; float yt = (float)y / Height - 0.5f; float z = _a * (float)Math.Sin(_n * Math.PI * xt) * (float)Math.Sin(_m * Math.PI * yt) + _b * (float)Math.Sin(_m * Math.PI * xt) * (float)Math.Sin(_n * Math.PI * yt); float v = 1 - z * z; return(_color.WithScale(v)); }); return(_render); }
public override IRender Render(float dt) { if (_flashDuration > MaxFlashDuration) { _color = new SKColor(0, 0, 0); } else { _flashDuration += dt; _color = _color.WithScale(1f - _flashDuration / MaxFlashDuration); } using (var canvas = _render.CreateCanvas()) canvas.Clear(_color); return(_render); }
public override IRender Render(float dt) { var spectrum = _featureCache.GetMagnitudeSpectrum(Width / 2, 100, 4000); for (int x = 0; x < Width / 2; x++) { var color = _color.WithScale(spectrum[x]); for (int y = 0; y < Height; y++) { _render[Width / 2 + x, y] = color; _render[Width / 2 - x, y] = color; } } return(_render); }