Example #1
0
 protected override void Update(CanvasContext2D context)
 {
     context.ClearRect(0, 0, 800, 600);
     if (!_finished)
     {
         _textElement.InnerHTML += GetNextLetter();
     }
 }
Example #2
0
        private void OnTick()
        {
            _fishesCanvasContext.ClearRect(0, 0, _width, _height);
            foreach (Fish fish in _fishes)
            {
                fish.Update();
            }

            QueueUpdate();
        }
Example #3
0
 protected override void Update(CanvasContext2D context)
 {
     context.ClearRect(0, 0, 800, 600);
     if (!_finished && (_nextLetter < Ticks || _keyPressed))
     {
         _textElement.InnerHTML += GetNextLetter();
         if (_nextLetter == 0 || _keyPressed)
         {
             _nextLetter = Ticks + 100;
         }
         else
         {
             _nextLetter += 100;
         }
     }
 }
        public void DrawHistogram(CanvasContext2D ctx)
        {
            ctx.ClearRect(0, 0, 255, 150);
            ctx.BeginPath();
            ctx.StrokeStyle = "rgba(255,255,255,255)";
            double logMax = Math.Log(HistogramMaxCount);

            for (int i = 0; i < Histogram.Length; i++)
            {
                double height = Math.Log(Histogram[i]) / logMax;
                if (height < 0)
                {
                    height = 0;
                }

                ctx.MoveTo(i, 150);
                ctx.LineTo(i, 150 - (height * 150));
                ctx.Stroke();
            }
        }