public void AnimateAreaLight(int start, int end)
        {
            var animation = new Animation()
            {
                FrameCount = 400,
            };

            start = start == 0 ? 1 : start;
            end   = end == 0 ? animation.FrameCount : end;

            var tuning = new BonusAreaLight(animation);

            for (int x = start; x < end + 1; x++)
            {
                animation.CurrentFrame = x;
                var canvas = tuning.Animate();

                PpmOutput.WriteToFile($"world{x}.ppm", canvas.GetPPMContent(), false);
            }
        }
示例#2
0
        public ExercisePage(ConsoleProgram program)
            : base("Exercises", program)
        {
            AddOption(new Option("Chapter One", () =>
            {
                var chapter = new ChapterOne();
                chapter.Run();
                Input.ReadString("Press [Enter] to navigate home");
                Program.NavigateTo <ExercisePage>();
            }));

            AddOption(new Option("Chapter Two", () =>
            {
                var chapter = new ChapterTwo();
                chapter.Run();
                Input.ReadString("Press [Enter] to navigate home");
                Program.NavigateTo <ExercisePage>();
            }));

            AddOption(new Option("Chapter Three", () => program.NavigateTo <ChapterThreePage>()));

            AddOption(new Option("Chapter Four", () =>
            {
                var chapter = new ChapterFour();
                chapter.Run();
                Input.ReadString("Press [Enter] to navigate home");
                Program.NavigateTo <ExercisePage>();
            }));

            AddOption(new Option("Chapter Five", () => Program.NavigateTo <ChapterFivePage>()));

            AddOption(new Option("Chapter Six", () => Program.NavigateTo <ChapterSixPage>()));

            AddOption(new Option("Chapter Seven and Eight", () =>
            {
                var chapter = new ChapterSeven();
                chapter.Run();
                Input.ReadString("Press [Enter] to navigate home");
                Program.NavigateTo <ExercisePage>();
            }));

            AddOption(new Option("Chapter Nine", () =>
            {
                var animation = new Animation()
                {
                    FrameCount = 13,
                    StartFrame = 1
                };

                var chapter = new ChapterNine(animation);
                chapter.Run();
                Input.ReadString("Press [Enter] to navigate home");
                Program.NavigateTo <ExercisePage>();
            }));

            AddOption(new Option("Chapter Thirteen", () =>
            {
                var chapter = new ChapterThirteen();
                chapter.Run();
                Input.ReadString("Press [Enter] to navigate home");
                Program.NavigateTo <ExercisePage>();
            }));

            AddOption(new Option("Chapter Fourteen", () =>
            {
                var chapter = new ChapterFourteen();
                chapter.Run();
                Input.ReadString("Press [Enter] to navigate home");
                Program.NavigateTo <ExercisePage>();
            }));

            AddOption(new Option("Chapter Fifteen", () =>
            {
                var chapter = new ChapterFifteen();
                chapter.Run();
                Input.ReadString("Press [Enter] to navigate home");
                Program.NavigateTo <ExercisePage>();
            }));

            AddOption(new Option("Bonus - Area Light", () =>
            {
                var bonus = new BonusAreaLight();

                var canvas = bonus.Run();
                PpmOutput.WriteToFile("world.ppm", canvas.GetPPMContent());

                Program.NavigateTo <ExercisePage>();
            }));
        }