protected override double EaseInCore(double normalizedTime)
        {
            double exponent = Exponent;

            return(DoubleUtils.IsZero(exponent) ?
                   normalizedTime : (Math.Exp(exponent * normalizedTime) - 1.0) / (Math.Exp(exponent) - 1.0));
        }
Example #2
0
        protected override double EaseInCore(double normalizedTime)
        {
            double oscillations = Math.Max(0.0, Oscillations);
            double springiness  = Math.Max(0.0, Springiness);
            double exponent     = DoubleUtils.IsZero(springiness) ?
                                  normalizedTime : (Math.Exp(springiness * normalizedTime) - 1.0) / (Math.Exp(springiness) - 1.0);

            return(exponent * (Math.Sin((Math.PI * 2.0 * oscillations + Math.PI * 0.5) * normalizedTime)));
        }
Example #3
0
        public TileBlockPanel(Size size, IPattern pattern, bool measureToActualSize)
        {
            _size = size;
            _measureToActualSize = measureToActualSize;

            var patternElement = pattern.CreateElement();

            if (patternElement == null)
            {
                return;
            }

            patternElement.Measure(XamlConstants.InfiniteSize);

            var imagePattern = patternElement as Image;
            var bmp          = imagePattern.Return(i => i.Source).As <WriteableBitmap>();

            var patternSize = bmp.Return(b => new Size(b.PixelWidth, b.PixelHeight), patternElement.DesiredSize);

            var w = patternSize.Width;
            var h = patternSize.Height;

            if (DoubleUtils.IsZero(w) || DoubleUtils.IsZero(h))
            {
                return;
            }

            var xCount = 1 + ((int)size.Width) / (int)w;
            var yCount = 1 + ((int)size.Height) / (int)h;

            for (var x = 0; x < xCount; x++)
            {
                for (var y = 0; y < yCount; y++)
                {
                    var element = pattern.CreateElement();

                    element.Measure(patternSize);
                    Children.Add(element);
                    SetArrangeRect(element, new Rect(new Point(x * w, y * h), patternSize));
                }
            }

            _actualSize = new Size(xCount * w, yCount * h);
        }
Example #4
0
 public static bool IsZero(this double self, int precision)
 {
     return(DoubleUtils.IsZero(self, precision));
 }
Example #5
0
 public static bool IsZero(this double self)
 {
     return(DoubleUtils.IsZero(self));
 }