locked
PlaneProjection Suddenly Not Working

    Question

  • Alright Everyone,

    I have something a little odd going on and need your help.  I have been working on a Windows store app over the past year.  The app is using a plane projection to rotate a simple textblock.  It's basically doing a flip.  This piece has been working fine in the application the better part of six months, maybe more.  After updating to 8.1 a few weeks ago, this simple little animation stopped working.  Sometimes it would rotate, most of the time it would not.  Yet the other animations in the same storyboard were working fine.  I copied the plane projection animation into a new project, with nothing but a button to start the storyboard and a textblock to rotate.  The issue was still present.  This was a VS 2012 Express project. So I created a VS 2013 project and it didn't work right either.  Now in playing with these simpler projects, I observed something.  Those times it seemed to be working, I was moving the mouse.  So if I click the start button and immediate move the mouse, the textblock would rotate.  If I just clicked the button, leaving the mouse alone, it would not rotate.  Now in the debugger I was able to determine that the storyboard is indeed running, and firing a completion event when it finished.  And it ran to completion, regardless of the duration I set.  So, it seems as if the mouse movement is tickling something.  Again, I had no problem with this until the 8.1 update.  So it seems something has changed.  Also note that the problem occurs using DoubleAnimation as well as DoubleAnimationUsingKeyFrames.  And I can animate other transforms such as scaling without an issue.  The problem seems limited to a PlaneProjection.  Any ideas?  Below is a code snippet of the animation being performed.

            public MainPage()
            {
                this.InitializeComponent();

                storyboard = new Storyboard();
                storyboard.Completed += OnStoryboard_Completed;
                TextBlock1.Projection = new PlaneProjection();
            }

            void OnStoryboard_Completed(object sender, object e)
            {
                storyboard.Stop();
                storyboard.Children.Clear();
            }

            private void AnimateButton_Click(object sender, RoutedEventArgs e)
            {

                DoubleAnimationUsingKeyFrames doubleAnimator = new DoubleAnimationUsingKeyFrames();
                doubleAnimator.BeginTime = TimeSpan.FromSeconds(0);
                doubleAnimator.Duration = TimeSpan.FromSeconds(2);

                LinearDoubleKeyFrame linearDoubleKeyFrame = new LinearDoubleKeyFrame();
                linearDoubleKeyFrame.KeyTime = KeyTime.FromTimeSpan(TimeSpan.FromSeconds(.8));
                linearDoubleKeyFrame.Value = -90;
                doubleAnimator.KeyFrames.Add(linearDoubleKeyFrame);

                DiscreteDoubleKeyFrame discreteDoubleKeyFrame = new DiscreteDoubleKeyFrame();
                discreteDoubleKeyFrame.KeyTime = KeyTime.FromTimeSpan(TimeSpan.FromSeconds(1.4));
                discreteDoubleKeyFrame.Value = 90;
                doubleAnimator.KeyFrames.Add(discreteDoubleKeyFrame);

                linearDoubleKeyFrame = new LinearDoubleKeyFrame();
                linearDoubleKeyFrame.KeyTime = KeyTime.FromTimeSpan(TimeSpan.FromSeconds(1.9));
                linearDoubleKeyFrame.Value = 0;
                doubleAnimator.KeyFrames.Add(linearDoubleKeyFrame);

                Storyboard.SetTarget(doubleAnimator, TextBlock1.Projection);
                Storyboard.SetTargetProperty(doubleAnimator, "RotationY");
                storyboard.Children.Add(doubleAnimator);

                storyboard.Duration = doubleAnimator.Duration;
                storyboard.Begin( );
            }

    Monday, May 26, 2014 1:38 AM

Answers

  • Hi Sean

    Problem solved?

    We have some great news for you.

    Below is the xaml that created automatically by Blend:

                               <Storyboard x:Name="Storyboard1">
                                             <DoubleAnimationUsingKeyFrames BeginTime="0" Duration="2" Storyboard.TargetProperty="(UIElement.Projection).(PlaneProjection.RotationY)" Storyboard.TargetName="textBlock">
                                                           <LinearDoubleKeyFrame KeyTime="0:0:0.8" Value="-90"/>
                                                           <DiscreteDoubleKeyFrame KeyTime="0:0:1.4" Value="90"/>
                                                           <LinearDoubleKeyFrame KeyTime="0:0:1.9" Value="0"/>
                                                           
                                             </DoubleAnimationUsingKeyFrames>
                                             <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(TextBlock.FontFamily)" Storyboard.TargetName="textBlock">
                                                           <DiscreteObjectKeyFrame KeyTime="0:0:0.4">
                                                                         <DiscreteObjectKeyFrame.Value>
                                                                                       <FontFamily>Global User Interface</FontFamily>
                                                                         </DiscreteObjectKeyFrame.Value>
                                                           </DiscreteObjectKeyFrame>
                                                           <DiscreteObjectKeyFrame KeyTime="0:0:1.4">
                                                                         <DiscreteObjectKeyFrame.Value>
                                                                                       <FontFamily>Global User Interface</FontFamily>
                                                                         </DiscreteObjectKeyFrame.Value>
                                                           </DiscreteObjectKeyFrame>
                                             </ObjectAnimationUsingKeyFrames>
                               </Storyboard>
    

    The Font Family animation is the one that we are missing in the code, let's add them and should works fine now.

            private void Button_Click(object sender, RoutedEventArgs e)
            {
                TextBlock1.Projection = new PlaneProjection();
                DoubleAnimationUsingKeyFrames doubleAnimator = new DoubleAnimationUsingKeyFrames();
                doubleAnimator.BeginTime = TimeSpan.FromSeconds(0);
                doubleAnimator.Duration = TimeSpan.FromSeconds(2);
    
                LinearDoubleKeyFrame linearDoubleKeyFrame = new LinearDoubleKeyFrame();
                linearDoubleKeyFrame.KeyTime = KeyTime.FromTimeSpan(TimeSpan.FromSeconds(.8));
                linearDoubleKeyFrame.Value = -90;
                doubleAnimator.KeyFrames.Add(linearDoubleKeyFrame);
    
                DiscreteDoubleKeyFrame discreteDoubleKeyFrame = new DiscreteDoubleKeyFrame();
                discreteDoubleKeyFrame.KeyTime = KeyTime.FromTimeSpan(TimeSpan.FromSeconds(1.4));
                discreteDoubleKeyFrame.Value = 90;
                doubleAnimator.KeyFrames.Add(discreteDoubleKeyFrame);
    
                linearDoubleKeyFrame = new LinearDoubleKeyFrame();
                linearDoubleKeyFrame.KeyTime = KeyTime.FromTimeSpan(TimeSpan.FromSeconds(1.9));
                linearDoubleKeyFrame.Value = 0;
                doubleAnimator.KeyFrames.Add(linearDoubleKeyFrame);
    
                Storyboard.SetTarget(doubleAnimator, TextBlock1.Projection);
                Storyboard.SetTargetProperty(doubleAnimator, "RotationY");
                storyboard.Children.Add(doubleAnimator);
    
                ObjectAnimationUsingKeyFrames oAnim = new ObjectAnimationUsingKeyFrames();
                DiscreteObjectKeyFrame dokf = new DiscreteObjectKeyFrame();
                dokf.KeyTime = KeyTime.FromTimeSpan(TimeSpan.FromSeconds(0.4));
                dokf.Value = "<FontFamily>Global User Interface</FontFamily>";
                oAnim.KeyFrames.Add(dokf);
    
                dokf = new DiscreteObjectKeyFrame();
                dokf.KeyTime = KeyTime.FromTimeSpan(TimeSpan.FromSeconds(1.8));
                dokf.Value = "<FontFamily>Global User Interface</FontFamily>";
                oAnim.KeyFrames.Add(dokf);
    
                Storyboard.SetTarget(oAnim, textBlock);
                Storyboard.SetTargetProperty(oAnim, "FontFamily");
                storyboard.Children.Add(oAnim);
    
                storyboard.Duration = doubleAnimator.Duration;
                storyboard.Begin();
                Debug.WriteLine("storyboard.Begin()");
    
    
            }
    

    --James


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    Thursday, June 26, 2014 11:05 AM
    Moderator

All replies

  • Hi,

    I can reproduce your problem. That's may be a bug. I will ask senior engineer to check it. Please wait some days. If I have some information about it, I will reply to you as soon as possible.

    Best Wishes!


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey. Thanks<br/> MSDN Community Support<br/> <br/> Please remember to &quot;Mark as Answer&quot; the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    Tuesday, May 27, 2014 2:03 AM
  • Hi Sean

    Problem solved?

    We have some great news for you.

    Below is the xaml that created automatically by Blend:

                               <Storyboard x:Name="Storyboard1">
                                             <DoubleAnimationUsingKeyFrames BeginTime="0" Duration="2" Storyboard.TargetProperty="(UIElement.Projection).(PlaneProjection.RotationY)" Storyboard.TargetName="textBlock">
                                                           <LinearDoubleKeyFrame KeyTime="0:0:0.8" Value="-90"/>
                                                           <DiscreteDoubleKeyFrame KeyTime="0:0:1.4" Value="90"/>
                                                           <LinearDoubleKeyFrame KeyTime="0:0:1.9" Value="0"/>
                                                           
                                             </DoubleAnimationUsingKeyFrames>
                                             <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(TextBlock.FontFamily)" Storyboard.TargetName="textBlock">
                                                           <DiscreteObjectKeyFrame KeyTime="0:0:0.4">
                                                                         <DiscreteObjectKeyFrame.Value>
                                                                                       <FontFamily>Global User Interface</FontFamily>
                                                                         </DiscreteObjectKeyFrame.Value>
                                                           </DiscreteObjectKeyFrame>
                                                           <DiscreteObjectKeyFrame KeyTime="0:0:1.4">
                                                                         <DiscreteObjectKeyFrame.Value>
                                                                                       <FontFamily>Global User Interface</FontFamily>
                                                                         </DiscreteObjectKeyFrame.Value>
                                                           </DiscreteObjectKeyFrame>
                                             </ObjectAnimationUsingKeyFrames>
                               </Storyboard>
    

    The Font Family animation is the one that we are missing in the code, let's add them and should works fine now.

            private void Button_Click(object sender, RoutedEventArgs e)
            {
                TextBlock1.Projection = new PlaneProjection();
                DoubleAnimationUsingKeyFrames doubleAnimator = new DoubleAnimationUsingKeyFrames();
                doubleAnimator.BeginTime = TimeSpan.FromSeconds(0);
                doubleAnimator.Duration = TimeSpan.FromSeconds(2);
    
                LinearDoubleKeyFrame linearDoubleKeyFrame = new LinearDoubleKeyFrame();
                linearDoubleKeyFrame.KeyTime = KeyTime.FromTimeSpan(TimeSpan.FromSeconds(.8));
                linearDoubleKeyFrame.Value = -90;
                doubleAnimator.KeyFrames.Add(linearDoubleKeyFrame);
    
                DiscreteDoubleKeyFrame discreteDoubleKeyFrame = new DiscreteDoubleKeyFrame();
                discreteDoubleKeyFrame.KeyTime = KeyTime.FromTimeSpan(TimeSpan.FromSeconds(1.4));
                discreteDoubleKeyFrame.Value = 90;
                doubleAnimator.KeyFrames.Add(discreteDoubleKeyFrame);
    
                linearDoubleKeyFrame = new LinearDoubleKeyFrame();
                linearDoubleKeyFrame.KeyTime = KeyTime.FromTimeSpan(TimeSpan.FromSeconds(1.9));
                linearDoubleKeyFrame.Value = 0;
                doubleAnimator.KeyFrames.Add(linearDoubleKeyFrame);
    
                Storyboard.SetTarget(doubleAnimator, TextBlock1.Projection);
                Storyboard.SetTargetProperty(doubleAnimator, "RotationY");
                storyboard.Children.Add(doubleAnimator);
    
                ObjectAnimationUsingKeyFrames oAnim = new ObjectAnimationUsingKeyFrames();
                DiscreteObjectKeyFrame dokf = new DiscreteObjectKeyFrame();
                dokf.KeyTime = KeyTime.FromTimeSpan(TimeSpan.FromSeconds(0.4));
                dokf.Value = "<FontFamily>Global User Interface</FontFamily>";
                oAnim.KeyFrames.Add(dokf);
    
                dokf = new DiscreteObjectKeyFrame();
                dokf.KeyTime = KeyTime.FromTimeSpan(TimeSpan.FromSeconds(1.8));
                dokf.Value = "<FontFamily>Global User Interface</FontFamily>";
                oAnim.KeyFrames.Add(dokf);
    
                Storyboard.SetTarget(oAnim, textBlock);
                Storyboard.SetTargetProperty(oAnim, "FontFamily");
                storyboard.Children.Add(oAnim);
    
                storyboard.Duration = doubleAnimator.Duration;
                storyboard.Begin();
                Debug.WriteLine("storyboard.Begin()");
    
    
            }
    

    --James


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    Thursday, June 26, 2014 11:05 AM
    Moderator
  • Hi everybody, I'm experiencing the exact same problem as Sean.

    However I noticed another strange behaviour, I tried my code on different machines (all of them were 8.1 Pro) and I noticed that some of them could not run the animation while other ones were able to play it without any problem.

    Adding the change of Font Family in the animation makes it work on every machine so I have some questions for you:

    1) Has this situation been acknowledged as a bug?

    2) Does it depend on Visual Studio or some Win 8.1 Library or what?

    3) When will it be addressed and corrected?

    Thanks for the help.

    Best regards.

    Tuesday, July 8, 2014 10:09 AM
  • Sorry, I think you can open a new question for your specific issue, the problem that raised by Sean should be solved, at least my code can works fine with my machine.

    --James


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    Tuesday, July 8, 2014 10:13 AM
    Moderator
  • I don't think another question is needed because I experienced the exact same problem as him and your tweak (cause it's a tweak!) made it work.

    This situation is obviously a bug since you forced an unnecessary change of Font Family to fix the animation.

    What I would like to understand better is what kind of bug is it?

    What element does it depend on?

    Tuesday, July 8, 2014 10:25 AM
  • Hi developer,

    I would not call it as a bug, let's say if we create a animation in Blend, here are the XAML that generated automatically by Blend:

    <Storyboard x:Name="Storyboard1">
            <DoubleAnimationUsingKeyFrames BeginTime="0" Duration="2" Storyboard.TargetProperty="(UIElement.Projection).(PlaneProjection.RotationY)" Storyboard.TargetName="textBlock">
                        <LinearDoubleKeyFrame KeyTime="0:0:0.8" Value="-90"/>
                        <DiscreteDoubleKeyFrame KeyTime="0:0:1.4" Value="90"/>
                        <LinearDoubleKeyFrame KeyTime="0:0:1.9" Value="0"/>
                                                           
            </DoubleAnimationUsingKeyFrames>
            <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(TextBlock.FontFamily)" Storyboard.TargetName="textBlock">
                        <DiscreteObjectKeyFrame KeyTime="0:0:0.4">
                                        <DiscreteObjectKeyFrame.Value>
                                                    <FontFamily>Global User Interface</FontFamily>
                                        </DiscreteObjectKeyFrame.Value>
                        </DiscreteObjectKeyFrame>
                        <DiscreteObjectKeyFrame KeyTime="0:0:1.4">
                                        <DiscreteObjectKeyFrame.Value>
                                                    <FontFamily>Global User Interface</FontFamily>
                                        </DiscreteObjectKeyFrame.Value>
                        </DiscreteObjectKeyFrame>
            </ObjectAnimationUsingKeyFrames>
    </Storyboard>
    

    Blend also animate the Font, that's why I add font animation in the code.

    --James


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    Wednesday, July 9, 2014 1:40 AM
    Moderator
  • HI All 

    Same problem for me and its been so long no fix avail in 8.1, luckly it works for 8.

    http://social.msdn.microsoft.com/Forums/en-US/winappswithcsharp/thread/7f431b1c-2a29-431e-8fcd-3830c1ca3142/#1e50813c-5c0a-4d23-a2d8-da435211f432

    Tuesday, October 28, 2014 2:30 AM
  • Err, that's *definitely* a bug. Creating a dummy FontFamily animation (which isn't actually animating anything) is a (weird) workaround, not a fix. I'll pass this link to someone on the XAML team to make sure they know about this. Though if Blend does the workaround then perhaps they do.
    Tuesday, January 20, 2015 9:21 PM