コード例 #1
0
ファイル: Demo.cs プロジェクト: MatijaBrown/SilkyNvg
        private void DrawSpinner(float cx, float cy, float r, float t)
        {
            float a0 = 0.0f + t * 6.0f;
            float a1 = MathF.PI + t * 6.0f;
            float r0 = r;
            float r1 = r * 0.75f;

            _nvg.Save();

            _nvg.BeginPath();
            _nvg.Arc(cx, cy, r0, a0, a1, Winding.Cw);
            _nvg.Arc(cx, cy, r1, a1, a0, Winding.Ccw);
            _nvg.ClosePath();
            float ax    = cx + MathF.Cos(a0) * (r0 + r1) * 0.5f;
            float ay    = cy + MathF.Sin(a0) * (r0 + r1) * 0.5f;
            float bx    = cx + MathF.Cos(a0) * (r0 + r1) * 0.5f;
            float by    = cy + MathF.Sin(a0) * (r0 + r1) * 0.5f;
            Paint paint = _nvg.LinearGradient(ax, ay, bx, by, _nvg.Rgba(0, 0, 0, 0), _nvg.Rgba(0, 0, 0, 128));

            _nvg.FillPaint(paint);
            _nvg.Fill();

            _nvg.Restore();
        }