Exemplo n.º 1
0
        public void CreateAnimation(
            VisualElement element,
            CarouselPathAnimationData data,
            int frames,
            int delay)
        {
            double num1;

            if (data.SpecialHandling)
            {
                double d    = (double)element.GetValue(CarouselItemsContainer.CarouselLocationProperty);
                double num2 = double.IsNaN(d) ? 0.0 : d;
                ValueMapper.MapperRange target = this.ranges.GetTarget(data.To.Value);
                num1      = !data.From.HasValue || double.IsNegativeInfinity(data.From.Value) ? num2 - target.Length : num2 + target.Length;
                data.From = new double?();
            }
            else if (!data.From.HasValue)
            {
                double d = (double)element.GetValue(CarouselItemsContainer.CarouselLocationProperty);
                num1 = double.IsNaN(d) ? 0.0 : d;
            }
            else
            {
                num1      = this.ranges.MapInTarget(data.From.Value);
                data.From = new double?();
            }
            if (!data.To.HasValue)
            {
                data.To = new double?(double.PositiveInfinity);
            }
            double num3 = this.ranges.MapInTarget(data.To.Value);

            if (num1 != num3)
            {
                new PropertySetting(CarouselItemsContainer.CarouselLocationProperty, (object)num1).ApplyValue((RadObject)element);
            }
            AnimatedPropertySetting animatedPropertySetting = new AnimatedPropertySetting(CarouselItemsContainer.CarouselLocationProperty, (object)num1, (object)num3, frames, delay);

            data.CurrentAnimation = animatedPropertySetting;
        }
Exemplo n.º 2
0
 public void Add(ValueMapper.MapperRange source, ValueMapper.MapperRange target)
 {
     this.ranges.Add(new ValueMapper.RangePair(source, target));
 }
Exemplo n.º 3
0
 public RangePair(ValueMapper.MapperRange source, ValueMapper.MapperRange target)
 {
     this.source = source;
     this.target = target;
 }
Exemplo n.º 4
0
        public void CreateAnimation(VisualElement element, CarouselPathAnimationData data, int frames, int delay)
        {
            double fromValue = 0;
            double toValue   = 0;

            if (data.SpecialHandling)
            {
                double value = (double)element.GetValue(CarouselItemsContainer.CarouselLocationProperty);

                fromValue = double.IsNaN(value) ? 0 : value;

                ValueMapper.MapperRange range = this.ranges.GetTarget(data.To.Value);
                if (data.From == null || double.IsNegativeInfinity(data.From.Value))
                {
                    fromValue -= range.Length;
                }
                else
                {
                    fromValue += range.Length;
                }

                data.From = null;
            }
            else
            {
                if (data.From == null)
                {
                    double value = (double)element.GetValue(CarouselItemsContainer.CarouselLocationProperty);
                    //ValueMapper.MapperRange range = this.ranges.GetTarget(data.To.Value);
                    fromValue = double.IsNaN(value) ? 0 : value;
                }
                else
                {
                    fromValue = this.ranges.MapInTarget(data.From.Value);

                    data.From = null;
                }
            }


            if (data.To == null)
            {
                data.To = double.PositiveInfinity;
                //throw new Exception("Wrong target value for animation!");
            }
            //else
            {
                toValue = this.ranges.MapInTarget(data.To.Value);
            }

            if (fromValue != toValue)
            {
                PropertySetting pos = new PropertySetting(CarouselItemsContainer.CarouselLocationProperty,
                                                          fromValue
                                                          );

                pos.ApplyValue(element);
            }

            AnimatedPropertySetting animation =
                new AnimatedPropertySetting(CarouselItemsContainer.CarouselLocationProperty,
                                            fromValue, toValue,
                                            frames, delay
                                            );

            data.CurrentAnimation = animation;
        }