Exemplo n.º 1
0
        public MotionPathAdorner(AdornerSet adornerSet)
            : base(adornerSet)
        {
            this.motionPath = new MotionPath();
            DesignerContext designerContext = this.DesignerContext;

            this.TryGetTranslateAnimationProperties();
            this.leftAnimationProperty = designerContext.ActiveSceneViewModel.AnimationEditor.GetAnimationProperty((SceneNode)this.Element, new PropertyReference((ReferenceStep)this.Element.Platform.Metadata.ResolveProperty(CanvasElement.LeftProperty)));
            this.topAnimationProperty  = designerContext.ActiveSceneViewModel.AnimationEditor.GetAnimationProperty((SceneNode)this.Element, new PropertyReference((ReferenceStep)this.Element.Platform.Metadata.ResolveProperty(CanvasElement.TopProperty)));
        }
Exemplo n.º 2
0
        public void MoveToTime(double time)
        {
            if (time < 0.0)
            {
                throw new ArgumentException("negative times are not valid");
            }
            if (Tolerances.LessThan(time, this.lastEvaluatedTime))
            {
                throw new ArgumentException("Evaluating backward in time is not supported. Call Reset() first");
            }
            this.lastEvaluatedTime = time;
            if (time >= this.curSegmentStartTime && time < this.curSegmentEndTime)
            {
                return;
            }
            while (time > this.curSegmentEndTime)
            {
                this.curSegmentStartTime  = this.curSegmentStartTime == -1.0 ? 0.0 : this.curSegmentEndTime;
                this.curSegmentStartValue = this.curSegmentEndValue;
                if (this.keyFrameEnumerator.MoveNext())
                {
                    this.easingFunction = (IEasingFunctionDefinition)null;
                    this.keySpline      = (KeySpline)null;
                    switch (this.keyFrameEnumerator.Current.InterpolationType)
                    {
                    case KeyFrameInterpolationType.Discrete:
                        this.keySpline = (KeySpline)null;
                        break;

                    case KeyFrameInterpolationType.Spline:
                        this.keySpline = this.keyFrameEnumerator.Current.KeySpline;
                        if (this.keySpline == null)
                        {
                            this.keySpline = ForwardAnimationEvaluator.linearKeySpline;
                            break;
                        }
                        break;

                    case KeyFrameInterpolationType.Linear:
                        this.keySpline = ForwardAnimationEvaluator.linearKeySpline;
                        break;

                    case KeyFrameInterpolationType.Easing:
                        this.easingFunction = this.keyFrameEnumerator.Current.EasingFunction;
                        if (this.easingFunction == null)
                        {
                            this.keySpline = ForwardAnimationEvaluator.linearKeySpline;
                            break;
                        }
                        break;

                    default:
                        this.keySpline = (KeySpline)null;
                        break;
                    }
                    this.curSegmentEndTime  = this.keyFrameEnumerator.Current.Time;
                    this.curSegmentEndValue = new double?(MotionPath.GetKeyframeValue(this.keyFrameEnumerator.Current));
                }
                else
                {
                    this.keySpline          = (KeySpline)null;
                    this.curSegmentEndTime  = double.PositiveInfinity;
                    this.curSegmentEndValue = new double?();
                }
            }
            if (this.curSegmentStartValue.HasValue && this.curSegmentEndValue.HasValue)
            {
                this.valueInterpolator = (DoubleInterpolator) new LinearDoubleInterpolator(this.curSegmentStartValue.Value, this.curSegmentEndValue.Value);
            }
            else
            {
                this.valueInterpolator = (DoubleInterpolator)null;
            }
        }