Пример #1
0
        public async Task DelayAsync(double ms)
        {
            DelayCount++;
            await app.PaintAndRecordKeyFrameAsync();

            await Time.CurrentTime.DelayAsync(ms);
        }
Пример #2
0
        public async Task TestAnimatorInTimeAsync()
        {
            var app           = new CliTestHarness(TestContext, 40, 1, true);
            var delayProvider = new KeyframeDelayProvider(app);

            app.InvokeNextCycle(() =>
            {
                var panel = app.LayoutRoot.Add(new SpaceTimePanel(40, 1));
                panel.SpaceTime.Start();
                app.SecondsBetweenKeyframes = panel.SpaceTime.Increment.TotalSeconds;
                panel.SpaceTime.Invoke(async() =>
                {
                    panel.RealTimeViewing.Enabled = false;
                    var element = panel.SpaceTime.Add(new SpacialElement());
                    element.ResizeTo(1, 1);
                    await app.PaintAndRecordKeyFrameAsync();

                    await Animator.AnimateAsync(new FloatAnimatorOptions()
                    {
                        From             = 0,
                        To               = panel.Width - 1,
                        Duration         = 3000,
                        Setter           = v => element.MoveTo(v, element.Top),
                        DelayProvider    = delayProvider,
                        AutoReverse      = true,
                        AutoReverseDelay = 1000,
                    });
                    panel.SpaceTime.Stop();
                    app.Stop();
                });
            });

            await app.Start();

            app.AssertThisTestMatchesLKG();
            Console.WriteLine(delayProvider.DelayCount + " delays");
            Console.WriteLine(app.TotalPaints + " paints");
            Console.WriteLine(app.TotalCycles + " cycles");
        }