Пример #1
0
 public static IObservable <double> LowPass(
     this IObservable <double> targets,
     double amount    = 0.5,
     double tolerance = double.Epsilon)
 {
     return(targets.Animate((from, to) =>
                            Application
                            .PerFrame
                            .Scan(from, (current, frame) => to * (1 - amount) + current * amount)
                            .TakeWhile(result => Math.Abs(result - to) > tolerance)
                            .Concat(Observable.Return(to))));
 }
Пример #2
0
        public static IObservable <double> QuintEaseOut(
            this IObservable <double> targets,
            TimeSpan duration)
        {
            const double fps = 60.0;
            var          durationInFrames = (int)(duration.TotalSeconds * fps);

            return(targets.Animate((from, to) =>
            {
                var easingFunc = QuintEaseOut(durationInFrames, from, to);
                return Application
                .PerFrame
                .Select((i, j) => (long)j)
                .Take(durationInFrames)
                .Select(easingFunc)
                .Concat(Observable.Return(to));
            }));
        }