Exemplo n.º 1
0
        //[Inject]
        //protected HttpClient Http { get; set; }

        protected override void OnAfterRender()
        {
            _ctx = _canvas.CreateCanvas2d();
            Console.WriteLine("Canvas happening");
            _ctx.FillStyle = "green";
            _ctx.FillRect(10, 10, 50, 50);
        }
Exemplo n.º 2
0
        public void Frame()
        {
            _ctx = _canvas.CreateCanvas2d();
            Console.WriteLine("Canvas happening");

            if (first)
            {
                scene = new Scene(0, 500, 0, 500, new V(250, 250), new V(250, 0), 1, new Random());
                Console.WriteLine("Made the scene");

                charges = new ChargeSet();
                charges.AdjustCount(10, scene);
                charges.Mutate(1000000, 0, 0, scene);
                Console.WriteLine("Adjusted Count");

                particle = new Particle(scene.start);
                first    = false;
            }

            particle.PassTime(.1, charges);
            _ctx.FillStyle = "red";
            _ctx.FillRect(particle.location.x, particle.location.y, 5, 5);
            Console.WriteLine("Location: " + particle.location.x + " " + particle.location.y);

            foreach (Charge charge in charges.set)
            {
                Console.WriteLine("Draw Charge");
                _ctx.FillStyle = "gray";
                _ctx.FillRect(charge.location.x, charge.location.y, 5, 5);
            }

            if (scene.InBounds(particle.location))
            {
                Console.WriteLine("ping");
                Frame();
            }
        }