Does the Windows Composition API support 2.5D projected rotation?kivy 2.5d scene - graphics api with drawing/uix apiChange animation speed after it is startedComposition animation on a visual sub channelRotate soft on screen buttons on windows phone UWPUWP mail API - from non-UWP project (but desktop-bridge)using Composition API to draw objects on XAML Canvas with C++ UWP applicationDoes UWP Composition Api support color replacement?Storyboard Animation of UIElement.PlaneProjection Broken When Composition API Used at AllHow to make backside of Windows Composition UI ElementVisual different from front when rotated?Offset values for Windows Composition Visual not getting correctly initialized

Is it inappropriate for a student to attend their mentor's dissertation defense?

If human space travel is limited by the G force vulnerability, is there a way to counter G forces?

How to determine what difficulty is right for the game?

Do I have a twin with permutated remainders?

Why is consensus so controversial in Britain?

Fully-Firstable Anagram Sets

Why is 150k or 200k jobs considered good when there's 300k+ births a month?

NMaximize is not converging to a solution

Why can't we play rap on piano?

Why "Having chlorophyll without photosynthesis is actually very dangerous" and "like living with a bomb"?

Can I make popcorn with any corn?

What does the "remote control" for a QF-4 look like?

Which country benefited the most from UN Security Council vetoes?

Codimension of non-flat locus

Perform and show arithmetic with LuaLaTeX

Client team has low performances and low technical skills: we always fix their work and now they stop collaborate with us. How to solve?

Watching something be written to a file live with tail

How can bays and straits be determined in a procedurally generated map?

Does an object always see its latest internal state irrespective of thread?

How does one intimidate enemies without having the capacity for violence?

How to format long polynomial?

Meaning of に in 本当に

How can I make my BBEG immortal short of making them a Lich or Vampire?

Why do I get two different answers for this counting problem?



Does the Windows Composition API support 2.5D projected rotation?


kivy 2.5d scene - graphics api with drawing/uix apiChange animation speed after it is startedComposition animation on a visual sub channelRotate soft on screen buttons on windows phone UWPUWP mail API - from non-UWP project (but desktop-bridge)using Composition API to draw objects on XAML Canvas with C++ UWP applicationDoes UWP Composition Api support color replacement?Storyboard Animation of UIElement.PlaneProjection Broken When Composition API Used at AllHow to make backside of Windows Composition UI ElementVisual different from front when rotated?Offset values for Windows Composition Visual not getting correctly initialized






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















I have started to use the Windows Composition API in UWP applications to animate elements of the UI.



Visual elements expose RotationAngleInDegrees and RotationAngle properties as well as a RotationAxis property.



When I animate a rectangular object's RotationAngleInDegrees value around the Y axis, the rectangle rotates as I would expect but in a 2D application window, it does not appear to be displaying with a 2.5D projection.



Is there a way to get the 2.5D projection effect on rotations with the composition api?










share|improve this question




























    0















    I have started to use the Windows Composition API in UWP applications to animate elements of the UI.



    Visual elements expose RotationAngleInDegrees and RotationAngle properties as well as a RotationAxis property.



    When I animate a rectangular object's RotationAngleInDegrees value around the Y axis, the rectangle rotates as I would expect but in a 2D application window, it does not appear to be displaying with a 2.5D projection.



    Is there a way to get the 2.5D projection effect on rotations with the composition api?










    share|improve this question
























      0












      0








      0








      I have started to use the Windows Composition API in UWP applications to animate elements of the UI.



      Visual elements expose RotationAngleInDegrees and RotationAngle properties as well as a RotationAxis property.



      When I animate a rectangular object's RotationAngleInDegrees value around the Y axis, the rectangle rotates as I would expect but in a 2D application window, it does not appear to be displaying with a 2.5D projection.



      Is there a way to get the 2.5D projection effect on rotations with the composition api?










      share|improve this question














      I have started to use the Windows Composition API in UWP applications to animate elements of the UI.



      Visual elements expose RotationAngleInDegrees and RotationAngle properties as well as a RotationAxis property.



      When I animate a rectangular object's RotationAngleInDegrees value around the Y axis, the rectangle rotates as I would expect but in a 2D application window, it does not appear to be displaying with a 2.5D projection.



      Is there a way to get the 2.5D projection effect on rotations with the composition api?







      animation uwp rotation windows-composition-api 2.5d






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Mar 6 at 1:52









      HoloSheepHoloSheep

      519




      519






















          2 Answers
          2






          active

          oldest

          votes


















          1














          It depends to the effect that you want to have. There is a fluent design app sample on GitHub and here is the link. You will be able to download the demo from the store. And you can get some idea from depth samples. For example, flip to reveal shows a way to rotate a image card and you can find source code from here. For more details please check the sample and the demo.



          In general, the animation is to rotate based on X axis:




          rectanglevisual.RotationAxis = new System.Numerics.Vector3(1f, 0f, 0f);




          And then use rotate animation to rotate based on RotationAngleInDegrees.



          It is also possible for you to do this directly on XAML platform by using PlaneProjection from image control.






          share|improve this answer

























          • Thanks @BarryWang for pointing me to a sample. I was already using an animation based on RotationAngleInDegrees to rotate a card around the Y axis. However by default that rotation does not apply a perspective projection. The secrete seems to be that for the 2.5D projection effect you also need to apply a TransformMatrix to the page.

            – HoloSheep
            Mar 7 at 19:50











          • @HoloSheep Exactly. If that effect is what you want, the TransformMatrix is actually the answer.

            – Barry Wang - MSFT
            Mar 8 at 2:13


















          0














          As the sample that @BarryWang pointed me to demonstrates it is necessary to apply a TransformMatrix to the page (or a parenting container) before executing the animation to get the 2.5D effect with rotation or other spatial transformation animations with the composition api.



           private void UpdatePerspective()

          Visual visual = ElementCompositionPreview.GetElementVisual(MainPanel);

          // Get the size of the area we are enabling perspective for
          Vector2 sizeList = new Vector2((float)MainPanel.ActualWidth, (float)MainPanel.ActualHeight);

          // Setup the perspective transform.
          Matrix4x4 perspective = new Matrix4x4(

          1.0f, 0.0f, 0.0f, 0.0f,

          0.0f, 1.0f, 0.0f, 0.0f,

          0.0f, 0.0f, 1.0f, -1.0f / sizeList.X,

          0.0f, 0.0f, 0.0f, 1.0f);

          // Set the parent transform to apply perspective to all children
          visual.TransformMatrix =

          Matrix4x4.CreateTranslation(-sizeList.X / 2, -sizeList.Y / 2, 0f) * // Translate to origin

          perspective * // Apply perspective at origin

          Matrix4x4.CreateTranslation(sizeList.X / 2, sizeList.Y / 2, 0f); // Translate back to original position






          share|improve this answer


















          • 1





            You should also be able to do this using XAML's PerspectiveTransform3D property ` <Grid x:Name="RootGrid" > <Grid.Transform3D> <PerspectiveTransform3D Depth="1000" /> </Grid.Transform3D> .... </Grid> `

            – Johnny Westlake
            Mar 7 at 22:08












          • @JohnnyWestlake, awesome, I didn't realize that was in Windows 10 XAML or that it also worked in conjunction with the Composition APIs.

            – HoloSheep
            Mar 8 at 0:24











          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55014325%2fdoes-the-windows-composition-api-support-2-5d-projected-rotation%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          2 Answers
          2






          active

          oldest

          votes








          2 Answers
          2






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          1














          It depends to the effect that you want to have. There is a fluent design app sample on GitHub and here is the link. You will be able to download the demo from the store. And you can get some idea from depth samples. For example, flip to reveal shows a way to rotate a image card and you can find source code from here. For more details please check the sample and the demo.



          In general, the animation is to rotate based on X axis:




          rectanglevisual.RotationAxis = new System.Numerics.Vector3(1f, 0f, 0f);




          And then use rotate animation to rotate based on RotationAngleInDegrees.



          It is also possible for you to do this directly on XAML platform by using PlaneProjection from image control.






          share|improve this answer

























          • Thanks @BarryWang for pointing me to a sample. I was already using an animation based on RotationAngleInDegrees to rotate a card around the Y axis. However by default that rotation does not apply a perspective projection. The secrete seems to be that for the 2.5D projection effect you also need to apply a TransformMatrix to the page.

            – HoloSheep
            Mar 7 at 19:50











          • @HoloSheep Exactly. If that effect is what you want, the TransformMatrix is actually the answer.

            – Barry Wang - MSFT
            Mar 8 at 2:13















          1














          It depends to the effect that you want to have. There is a fluent design app sample on GitHub and here is the link. You will be able to download the demo from the store. And you can get some idea from depth samples. For example, flip to reveal shows a way to rotate a image card and you can find source code from here. For more details please check the sample and the demo.



          In general, the animation is to rotate based on X axis:




          rectanglevisual.RotationAxis = new System.Numerics.Vector3(1f, 0f, 0f);




          And then use rotate animation to rotate based on RotationAngleInDegrees.



          It is also possible for you to do this directly on XAML platform by using PlaneProjection from image control.






          share|improve this answer

























          • Thanks @BarryWang for pointing me to a sample. I was already using an animation based on RotationAngleInDegrees to rotate a card around the Y axis. However by default that rotation does not apply a perspective projection. The secrete seems to be that for the 2.5D projection effect you also need to apply a TransformMatrix to the page.

            – HoloSheep
            Mar 7 at 19:50











          • @HoloSheep Exactly. If that effect is what you want, the TransformMatrix is actually the answer.

            – Barry Wang - MSFT
            Mar 8 at 2:13













          1












          1








          1







          It depends to the effect that you want to have. There is a fluent design app sample on GitHub and here is the link. You will be able to download the demo from the store. And you can get some idea from depth samples. For example, flip to reveal shows a way to rotate a image card and you can find source code from here. For more details please check the sample and the demo.



          In general, the animation is to rotate based on X axis:




          rectanglevisual.RotationAxis = new System.Numerics.Vector3(1f, 0f, 0f);




          And then use rotate animation to rotate based on RotationAngleInDegrees.



          It is also possible for you to do this directly on XAML platform by using PlaneProjection from image control.






          share|improve this answer















          It depends to the effect that you want to have. There is a fluent design app sample on GitHub and here is the link. You will be able to download the demo from the store. And you can get some idea from depth samples. For example, flip to reveal shows a way to rotate a image card and you can find source code from here. For more details please check the sample and the demo.



          In general, the animation is to rotate based on X axis:




          rectanglevisual.RotationAxis = new System.Numerics.Vector3(1f, 0f, 0f);




          And then use rotate animation to rotate based on RotationAngleInDegrees.



          It is also possible for you to do this directly on XAML platform by using PlaneProjection from image control.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Mar 8 at 2:23

























          answered Mar 6 at 8:02









          Barry Wang - MSFTBarry Wang - MSFT

          8891312




          8891312












          • Thanks @BarryWang for pointing me to a sample. I was already using an animation based on RotationAngleInDegrees to rotate a card around the Y axis. However by default that rotation does not apply a perspective projection. The secrete seems to be that for the 2.5D projection effect you also need to apply a TransformMatrix to the page.

            – HoloSheep
            Mar 7 at 19:50











          • @HoloSheep Exactly. If that effect is what you want, the TransformMatrix is actually the answer.

            – Barry Wang - MSFT
            Mar 8 at 2:13

















          • Thanks @BarryWang for pointing me to a sample. I was already using an animation based on RotationAngleInDegrees to rotate a card around the Y axis. However by default that rotation does not apply a perspective projection. The secrete seems to be that for the 2.5D projection effect you also need to apply a TransformMatrix to the page.

            – HoloSheep
            Mar 7 at 19:50











          • @HoloSheep Exactly. If that effect is what you want, the TransformMatrix is actually the answer.

            – Barry Wang - MSFT
            Mar 8 at 2:13
















          Thanks @BarryWang for pointing me to a sample. I was already using an animation based on RotationAngleInDegrees to rotate a card around the Y axis. However by default that rotation does not apply a perspective projection. The secrete seems to be that for the 2.5D projection effect you also need to apply a TransformMatrix to the page.

          – HoloSheep
          Mar 7 at 19:50





          Thanks @BarryWang for pointing me to a sample. I was already using an animation based on RotationAngleInDegrees to rotate a card around the Y axis. However by default that rotation does not apply a perspective projection. The secrete seems to be that for the 2.5D projection effect you also need to apply a TransformMatrix to the page.

          – HoloSheep
          Mar 7 at 19:50













          @HoloSheep Exactly. If that effect is what you want, the TransformMatrix is actually the answer.

          – Barry Wang - MSFT
          Mar 8 at 2:13





          @HoloSheep Exactly. If that effect is what you want, the TransformMatrix is actually the answer.

          – Barry Wang - MSFT
          Mar 8 at 2:13













          0














          As the sample that @BarryWang pointed me to demonstrates it is necessary to apply a TransformMatrix to the page (or a parenting container) before executing the animation to get the 2.5D effect with rotation or other spatial transformation animations with the composition api.



           private void UpdatePerspective()

          Visual visual = ElementCompositionPreview.GetElementVisual(MainPanel);

          // Get the size of the area we are enabling perspective for
          Vector2 sizeList = new Vector2((float)MainPanel.ActualWidth, (float)MainPanel.ActualHeight);

          // Setup the perspective transform.
          Matrix4x4 perspective = new Matrix4x4(

          1.0f, 0.0f, 0.0f, 0.0f,

          0.0f, 1.0f, 0.0f, 0.0f,

          0.0f, 0.0f, 1.0f, -1.0f / sizeList.X,

          0.0f, 0.0f, 0.0f, 1.0f);

          // Set the parent transform to apply perspective to all children
          visual.TransformMatrix =

          Matrix4x4.CreateTranslation(-sizeList.X / 2, -sizeList.Y / 2, 0f) * // Translate to origin

          perspective * // Apply perspective at origin

          Matrix4x4.CreateTranslation(sizeList.X / 2, sizeList.Y / 2, 0f); // Translate back to original position






          share|improve this answer


















          • 1





            You should also be able to do this using XAML's PerspectiveTransform3D property ` <Grid x:Name="RootGrid" > <Grid.Transform3D> <PerspectiveTransform3D Depth="1000" /> </Grid.Transform3D> .... </Grid> `

            – Johnny Westlake
            Mar 7 at 22:08












          • @JohnnyWestlake, awesome, I didn't realize that was in Windows 10 XAML or that it also worked in conjunction with the Composition APIs.

            – HoloSheep
            Mar 8 at 0:24















          0














          As the sample that @BarryWang pointed me to demonstrates it is necessary to apply a TransformMatrix to the page (or a parenting container) before executing the animation to get the 2.5D effect with rotation or other spatial transformation animations with the composition api.



           private void UpdatePerspective()

          Visual visual = ElementCompositionPreview.GetElementVisual(MainPanel);

          // Get the size of the area we are enabling perspective for
          Vector2 sizeList = new Vector2((float)MainPanel.ActualWidth, (float)MainPanel.ActualHeight);

          // Setup the perspective transform.
          Matrix4x4 perspective = new Matrix4x4(

          1.0f, 0.0f, 0.0f, 0.0f,

          0.0f, 1.0f, 0.0f, 0.0f,

          0.0f, 0.0f, 1.0f, -1.0f / sizeList.X,

          0.0f, 0.0f, 0.0f, 1.0f);

          // Set the parent transform to apply perspective to all children
          visual.TransformMatrix =

          Matrix4x4.CreateTranslation(-sizeList.X / 2, -sizeList.Y / 2, 0f) * // Translate to origin

          perspective * // Apply perspective at origin

          Matrix4x4.CreateTranslation(sizeList.X / 2, sizeList.Y / 2, 0f); // Translate back to original position






          share|improve this answer


















          • 1





            You should also be able to do this using XAML's PerspectiveTransform3D property ` <Grid x:Name="RootGrid" > <Grid.Transform3D> <PerspectiveTransform3D Depth="1000" /> </Grid.Transform3D> .... </Grid> `

            – Johnny Westlake
            Mar 7 at 22:08












          • @JohnnyWestlake, awesome, I didn't realize that was in Windows 10 XAML or that it also worked in conjunction with the Composition APIs.

            – HoloSheep
            Mar 8 at 0:24













          0












          0








          0







          As the sample that @BarryWang pointed me to demonstrates it is necessary to apply a TransformMatrix to the page (or a parenting container) before executing the animation to get the 2.5D effect with rotation or other spatial transformation animations with the composition api.



           private void UpdatePerspective()

          Visual visual = ElementCompositionPreview.GetElementVisual(MainPanel);

          // Get the size of the area we are enabling perspective for
          Vector2 sizeList = new Vector2((float)MainPanel.ActualWidth, (float)MainPanel.ActualHeight);

          // Setup the perspective transform.
          Matrix4x4 perspective = new Matrix4x4(

          1.0f, 0.0f, 0.0f, 0.0f,

          0.0f, 1.0f, 0.0f, 0.0f,

          0.0f, 0.0f, 1.0f, -1.0f / sizeList.X,

          0.0f, 0.0f, 0.0f, 1.0f);

          // Set the parent transform to apply perspective to all children
          visual.TransformMatrix =

          Matrix4x4.CreateTranslation(-sizeList.X / 2, -sizeList.Y / 2, 0f) * // Translate to origin

          perspective * // Apply perspective at origin

          Matrix4x4.CreateTranslation(sizeList.X / 2, sizeList.Y / 2, 0f); // Translate back to original position






          share|improve this answer













          As the sample that @BarryWang pointed me to demonstrates it is necessary to apply a TransformMatrix to the page (or a parenting container) before executing the animation to get the 2.5D effect with rotation or other spatial transformation animations with the composition api.



           private void UpdatePerspective()

          Visual visual = ElementCompositionPreview.GetElementVisual(MainPanel);

          // Get the size of the area we are enabling perspective for
          Vector2 sizeList = new Vector2((float)MainPanel.ActualWidth, (float)MainPanel.ActualHeight);

          // Setup the perspective transform.
          Matrix4x4 perspective = new Matrix4x4(

          1.0f, 0.0f, 0.0f, 0.0f,

          0.0f, 1.0f, 0.0f, 0.0f,

          0.0f, 0.0f, 1.0f, -1.0f / sizeList.X,

          0.0f, 0.0f, 0.0f, 1.0f);

          // Set the parent transform to apply perspective to all children
          visual.TransformMatrix =

          Matrix4x4.CreateTranslation(-sizeList.X / 2, -sizeList.Y / 2, 0f) * // Translate to origin

          perspective * // Apply perspective at origin

          Matrix4x4.CreateTranslation(sizeList.X / 2, sizeList.Y / 2, 0f); // Translate back to original position







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Mar 7 at 19:56









          HoloSheepHoloSheep

          519




          519







          • 1





            You should also be able to do this using XAML's PerspectiveTransform3D property ` <Grid x:Name="RootGrid" > <Grid.Transform3D> <PerspectiveTransform3D Depth="1000" /> </Grid.Transform3D> .... </Grid> `

            – Johnny Westlake
            Mar 7 at 22:08












          • @JohnnyWestlake, awesome, I didn't realize that was in Windows 10 XAML or that it also worked in conjunction with the Composition APIs.

            – HoloSheep
            Mar 8 at 0:24












          • 1





            You should also be able to do this using XAML's PerspectiveTransform3D property ` <Grid x:Name="RootGrid" > <Grid.Transform3D> <PerspectiveTransform3D Depth="1000" /> </Grid.Transform3D> .... </Grid> `

            – Johnny Westlake
            Mar 7 at 22:08












          • @JohnnyWestlake, awesome, I didn't realize that was in Windows 10 XAML or that it also worked in conjunction with the Composition APIs.

            – HoloSheep
            Mar 8 at 0:24







          1




          1





          You should also be able to do this using XAML's PerspectiveTransform3D property ` <Grid x:Name="RootGrid" > <Grid.Transform3D> <PerspectiveTransform3D Depth="1000" /> </Grid.Transform3D> .... </Grid> `

          – Johnny Westlake
          Mar 7 at 22:08






          You should also be able to do this using XAML's PerspectiveTransform3D property ` <Grid x:Name="RootGrid" > <Grid.Transform3D> <PerspectiveTransform3D Depth="1000" /> </Grid.Transform3D> .... </Grid> `

          – Johnny Westlake
          Mar 7 at 22:08














          @JohnnyWestlake, awesome, I didn't realize that was in Windows 10 XAML or that it also worked in conjunction with the Composition APIs.

          – HoloSheep
          Mar 8 at 0:24





          @JohnnyWestlake, awesome, I didn't realize that was in Windows 10 XAML or that it also worked in conjunction with the Composition APIs.

          – HoloSheep
          Mar 8 at 0:24

















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55014325%2fdoes-the-windows-composition-api-support-2-5d-projected-rotation%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          1928 у кіно

          Захаров Федір Захарович

          Ель Греко