コード例 #1
0
        /// <summary>
        /// Creates a new instance of this animation that is the reverse of this instance.
        /// </summary>
        /// <returns>A new instance of this animation that is the reverse of this instance.</returns>
        public override RadAnimation CreateOpposite()
        {
            RadTileAnimation opposite = base.CreateOpposite() as RadTileAnimation;

            opposite.PerspectiveAngleY = -1 * opposite.PerspectiveAngleY;
            opposite.PerspectiveAngleX = -1 * opposite.PerspectiveAngleX;
            return(opposite);
        }
コード例 #2
0
        /// <summary>
        /// Core update routine.
        /// </summary>
        /// <param name="context">The context that holds information about the animation.</param>
        protected override void UpdateAnimationOverride(AnimationContext context)
        {
            if (context == null)
            {
                return;
            }

            this.containerToAnimate = RadTileAnimation.GetContainerToAnimate(context.Target);
            if (this.containerToAnimate == null)
            {
                // TODO - try cast the context.Target to ITemsControl or panel
                return;
            }

            this.itemsToAnimate = this.GetItemsToAnimate();
            if (this.InOutAnimationMode == InOutAnimationMode.Out)
            {
                this.elementToDelay = RadTileAnimation.GetElementToDelay(context.Target);
                if (this.elementToDelay == null)
                {
                    this.elementToDelay = this.FindElementToDelay();
                }

                // move the delayed element to the end of the sequence
                if (this.elementToDelay != null && this.itemsToAnimate.Remove(this.elementToDelay))
                {
                    this.itemsToAnimate.Add(this.elementToDelay);
                }
            }

            for (int i = 0; i < this.itemsToAnimate.Count; i++)
            {
                FrameworkElement itemToAnimate = this.itemsToAnimate[i];

                TimeSpan animationDelay = TimeSpan.FromMilliseconds((this.SequentialItemDelay.TotalMilliseconds * i) + this.InitialDelay.TotalMilliseconds);

                if (this.InOutAnimationMode == InOutAnimationMode.Out && itemToAnimate == this.elementToDelay)
                {
                    animationDelay = animationDelay.Add(this.SelectedItemDelay);
                }

                this.ApplyItemProjectionAnimation(itemToAnimate, context, animationDelay);

                this.ApplyItemOpacityAnimation(itemToAnimate, context, animationDelay);
            }

            base.UpdateAnimationOverride(context);
        }