[UWP] [XAML]为什么RotationY =" 90"使用PlaneProjection时仍然可见? [英] [UWP][XAML]Why is RotationY="90" Still Visible When Using PlaneProjection?

查看:67
本文介绍了[UWP] [XAML]为什么RotationY =" 90"使用PlaneProjection时仍然可见?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用程序中有以下XAML:

I have the following XAML in my app:

<ContentPresenter Canvas.ZIndex="60" Content="MY CONTENT">
	<ContentPresenter.RenderTransform><TranslateTransform X="0"/></ContentPresenter.RenderTransform>
	<ContentPresenter.Projection><PlaneProjection RotationY="90" GlobalOffsetX="0" CenterOfRotationX="1"/></ContentPresenter.Projection>
</ContentPresenter>


当我使用此代码时,该元素仍然可见(部分投影,但足够清晰,您可以毫无困难地阅读内容)。当我转过90度时,我希望隐藏一些东西。如果我将CenterOfRotation更改为0.5,则会隐藏它。 I
我猜这是试图模拟PlaneProjection所用的3D效果的副作用,但有什么办法可以避免它吗?我希望在项目被投射到足够隐蔽时更改内容,但是当没有隐藏90时,我有
麻烦这样做。



Nathan Sokalski njsokalski@hotmail.com http://www.nathansokalski.com/

When I use this code, the element is still visible (partially projected, but clear enough that you can read the content with no trouble). I would expect something to be hidden when turned 90 degrees. If I change the CenterOfRotation to 0.5, it is hidden. I am going to guess that this is a side effect of the attempt to simulate the 3D effect that PlaneProjection is used for, but is there any way I can avoid it? I want to change the content when the item is projected far enough to become hidden, but I am having trouble doing this when 90 is not hidden.


Nathan Sokalski njsokalski@hotmail.com http://www.nathansokalski.com/

推荐答案

Parallax!

Parallax!

如果物体旋转90度并在相机上居中,那么它将不可见,但是当它向左移动相机或相机向右移动时,物体的前后角度是不同的,它可以可见。您可以通过在桌子上放一本书来在现实世界中证明这一点
。如果你站在那里并看着它,你可以看到脊椎而不是盖子。当您向左或向右移动时,您将能够看到封面。

If the object is rotated 90 degrees and centered on the camera then it won't be visible, but as it moves camera left or camera right the angle to the front and back of the object is different and it can be seen. You can demonstrate this in the real world by standing a book on end on your table. If you stand in line with it and look at it you can see the spine but not the cover. As you move left or right you'll be able to see the cover.

对于您的特定值,您将对象本身置于相机的中心。将CenterOfRotationX设置为1会围绕其摄像机右侧旋转,因此90度旋转结束时所有内容都与对象的右侧对齐。值得注意的是:
这是在相机右侧。将旋转中心更改为0.5会导致项目围绕其中心旋转,因此所有内容最终都与对象的中心对齐。由于这是与相机对齐,你只看到边缘(因为它是
2D边缘不可见)。

For your specific values, you have the object itself centered on the camera. Setting the CenterOfRotationX to 1 rotates around its camera-right side, so the 90 degree rotation ends up with everything lined up with the right side of the object. Significantly: this is to the right of the camera. Changing the center of rotation to 0.5 causes the item to rotate around its center, so everything ends up lined up with the center of the object. Since this is lined up with the camera you only see the edge (and since it's 2D the edge isn't visible).

要旋转以便项目隐藏你将需要选择旋转角度,以使项目最终与摄像机一致到旋转中心。

To rotate so that the item is hidden you'll need to choose the rotation angle so that the item ends up in line with the camera to its center of rotation.

您还可以使用Matrix3DProjection来更好地控制投影和透视。

You can also use a Matrix3DProjection to get more control over the projection and perspective.


这篇关于[UWP] [XAML]为什么RotationY =&quot; 90&quot;使用PlaneProjection时仍然可见?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆