protected override Storyboard PrepareItemAnimation(UIFlow3D owner, int index, UIFlow3D.ElementAnimationType type)
        {
            // Initialize storyboard
            Storyboard sb = (owner.InternalResources["ItemAnimator2"] as Storyboard).Clone();

            owner.PrepareTemplateStoryboard(sb, index);

            // Child animations
            Rotation3DAnimationUsingKeyFrames rotAnim = sb.Children[0] as Rotation3DAnimationUsingKeyFrames;
            DoubleAnimationUsingKeyFrames     xAnim   = sb.Children[1] as DoubleAnimationUsingKeyFrames;
            DoubleAnimationUsingKeyFrames     yAnim   = sb.Children[2] as DoubleAnimationUsingKeyFrames;
            DoubleAnimationUsingKeyFrames     zAnim   = sb.Children[3] as DoubleAnimationUsingKeyFrames;

            SplineRotation3DKeyFrame rotKf = rotAnim.KeyFrames[0] as SplineRotation3DKeyFrame;

            switch (type)
            {
            case UIFlow3D.ElementAnimationType.Left:
                (rotKf.Value as AxisAngleRotation3D).Angle = owner.TiltAngle;
                xAnim.KeyFrames[0].Value = -1 * owner.ItemGap * (owner.SelectedIndex - index) - owner.FrontItemGap;

                break;

            case UIFlow3D.ElementAnimationType.Right:
                (rotKf.Value as AxisAngleRotation3D).Angle = -1 * owner.TiltAngle;
                xAnim.KeyFrames[0].Value = owner.ItemGap * (index - owner.SelectedIndex) + owner.FrontItemGap;

                break;

            case UIFlow3D.ElementAnimationType.Selection:
                (rotKf.Value as AxisAngleRotation3D).Angle = 0;
                xAnim.KeyFrames[0].Value = 0;
                zAnim.KeyFrames[0].Value = owner.PopoutDistance;

                break;
            }

            return(sb);
        }
Beispiel #2
0
 protected virtual Storyboard PrepareItemAnimation(UIFlow3D owner, int index, UIFlow3D.ElementAnimationType type)
 {
     return(null);
 }
Beispiel #3
0
        protected override Storyboard PrepareItemAnimation(UIFlow3D owner, int index, UIFlow3D.ElementAnimationType type)
        {
            // Initialize storyboard
            Storyboard sb = (owner.InternalResources["ItemAnimator"] as Storyboard).Clone();

            owner.PrepareTemplateStoryboard(sb, index);

            // Child animations
            Rotation3DAnimation rotAnim = sb.Children[0] as Rotation3DAnimation;
            DoubleAnimation     xAnim   = sb.Children[1] as DoubleAnimation;
            DoubleAnimation     yAnim   = sb.Children[2] as DoubleAnimation;
            DoubleAnimation     zAnim   = sb.Children[3] as DoubleAnimation;

            switch (type)
            {
            case UIFlow3D.ElementAnimationType.Left:
                (rotAnim.To as AxisAngleRotation3D).Angle = owner.TiltAngle;
                (rotAnim.To as AxisAngleRotation3D).Axis  = new Vector3D(0, 0, 1);
                xAnim.To = -1 * owner.ItemGap * (owner.SelectedIndex - index);
                yAnim.To = -1 * owner.ItemGap * (owner.SelectedIndex - index);
                zAnim.To = -1 * owner.ItemGap * (owner.SelectedIndex - index);

                break;

            case UIFlow3D.ElementAnimationType.Right:
                (rotAnim.To as AxisAngleRotation3D).Angle = owner.TiltAngle;
                (rotAnim.To as AxisAngleRotation3D).Axis  = new Vector3D(0, 0, 1);
                xAnim.To = owner.ItemGap * (index - owner.SelectedIndex);
                yAnim.To = -1 * owner.ItemGap * (index - owner.SelectedIndex);
                zAnim.To = owner.ItemGap * (index - owner.SelectedIndex);

                break;

            case UIFlow3D.ElementAnimationType.Selection:
                xAnim.To = -1 * (owner.ItemGap + owner.PopoutDistance);
                yAnim.To = owner.ItemGap;
                break;
            }

            return(sb);
        }