Esempio n. 1
0
        /// <summary>Starts animating the named property and target value.</summary>
        /// <param name="property">The property to update. May be an alias or composite.</param>
        /// <param name="value">The target value of the property.</param>
        /// <param name="updateCss">True if this property should update CSS/ the screen when it's progressed.</param>
        private void Animate(CssProperty property, Css.Value value, bool updateCss)
        {
            // Check if this property is already animated - if so, interrupt it and override with our new values.
            // There won't be many actively animated properties, so looping through the update queue is fast anyway.
            AnimatedProperty animProperty = GetAnimatedProperty(Animating, property);

            if (animProperty != null)
            {
                animProperty.Animate(this, value, TimeCurve, updateCss);
            }
            else
            {
                // Otherwise we want to create one or more AnimatedProperties and stick them into the queue.

                // Get or create the initial value:
                Css.Value hostValue;
                Css.Value rawValue = property.GetOrCreateValue(Animating, ComputedStyle, false, out hostValue);

                if (rawValue is Css.ValueSet)
                {
                    // A special case is when animating a value set. Each one needs to actually animate separately.
                    // E.g. padding:40px 20px; then animating to just padding:30px;

                    for (int i = 0; i < rawValue.Count; i++)
                    {
                        // Create it now:
                        animProperty = new AnimatedProperty(this, property.GetAliased(i, true));

                        // Setup the value:
                        animProperty.SetupValue(hostValue, rawValue[i]);

                        // Get the target value:
                        Css.Value target = (value is Css.ValueSet) ? value[i] : value;

                        // Animate it now:
                        animProperty.Animate(this, target, TimeCurve, updateCss);

                        animProperty.AddToQueue();
                    }
                }
                else
                {
                    // Create it now:
                    animProperty = new AnimatedProperty(this, property);

                    // Setup the value:
                    animProperty.SetupValue(hostValue, rawValue);

                    // Animate it now:
                    animProperty.Animate(this, value, TimeCurve, updateCss);

                    animProperty.AddToQueue();
                }
            }
        }
Esempio n. 2
0
        /// <summary>Starts animating the named property and target value. Must not be composite properties.
        /// (e.g. color-overlay-r instead of color-overlay)</summary>
        /// <param name="property">The property to update.</param>
        /// <param name="innerIndex">The inner index of the property to update.</param>
        /// <param name="value">The target value of the property.</param>
        /// <param name="updateCss">True if this property should update CSS/ the screen when it's progressed.</param>
        private void Animate(CssProperty property, int innerIndex, Css.Value value, bool updateCss)
        {
            // Check if this property is already animated - if so, interrupt it and override with our new values.
            // There won't be many actively animated properties, so looping through the update queue is fast anyway.
            AnimatedProperty animProperty = GetAnimatedProperty(Animating, property, innerIndex);

            if (animProperty != null)
            {
                animProperty.Animate(this, value, ConstantSpeedTime, TimeToAccelerateFor, TimeToDecelerateFor, updateCss);
            }
            else
            {
                // Otherwise we want to create a new AnimatedProperty and stick it into the queue:
                animProperty = new AnimatedProperty(this, property, innerIndex, value, ConstantSpeedTime, TimeToAccelerateFor, TimeToDecelerateFor, updateCss);
                animProperty.AddToQueue();
            }
        }
		/// <summary>Starts animating the named property and target value. Must not be composite properties.
		/// (e.g. color-overlay-r instead of color-overlay)</summary>
		/// <param name="property">The property to update.</param>
		/// <param name="innerIndex">The inner index of the property to update.</param>
		/// <param name="value">The target value of the property.</param>
		/// <param name="updateCss">True if this property should update CSS/ the screen when it's progressed.</param>
		private void Animate(CssProperty property,int innerIndex,Css.Value value,bool updateCss){
			// Check if this property is already animated - if so, interrupt it and override with our new values.
			// There won't be many actively animated properties, so looping through the update queue is fast anyway.
			AnimatedProperty animProperty=GetAnimatedProperty(Animating,property,innerIndex);
			
			if(animProperty!=null){
				animProperty.Animate(this,value,ConstantSpeedTime,TimeToAccelerateFor,TimeToDecelerateFor,updateCss);
			}else{
				// Otherwise we want to create a new AnimatedProperty and stick it into the queue:
				animProperty=new AnimatedProperty(this,property,innerIndex,value,ConstantSpeedTime,TimeToAccelerateFor,TimeToDecelerateFor,updateCss);
				animProperty.AddToQueue();
			}
		}