"Win 10 App development" perspective effect

Source: Internet
Author: User

The so-called perspective effect, is to simulate the "like" three-dimensional effect in the plane coordinate space. If the old week is not mistaken, previously wrote WP8 related content, the UWP in the perspective method also retains the previous do method, in fact, this thing is inherited from Silverlight. However, the UWP added some three-dimensional transformation related east, this old week will talk to everyone, today we still understand the perspective effect.

UIElement public base class for this visualization exposes a Projection property that can be used to set the object's pivot parameter, which is of type Projection, but Projection is an abstract class that cannot be used, and Projection The class has only one subclass of--planeprojection, so we're actually using planeprojection this guy.

This class exposes a bunch of properties, which appear to be a lot of properties, actually just a few groups:

1, rotation. including the angle of rotation around x, y, z three axes, here are three properties.

2, translation, there are two groups of translation, the local beginning of the movement is relative to the object itself, the same as x, Y, z three axes of the direction; the second group, which starts with global, is the displacement of the coordinate position relative to the screen coordinates and the amount of movement on the X, Y, z three axes. These two sets of coordinates are similar, only the reference frame is different, one is relative to the object itself, the other is relative to the screen coordinates.

3, the center point of rotation, frankly these several values starting with Centerofrotation are also the values on the x, Y, Z, three axes, setting the center point coordinates of the object rotation. Coordinates take a relative value, that is, the range of each value is 0 to 1, including 0 and 1, of course. For example, on the x-axis, 0 indicates that the center of rotation is at the leftmost end, and if 1 indicates that the center of rotation is at the right end of the object. If 0.5, indicates that the center of rotation is in the middle of the object.

So, when you look at a group, you find that there are not many properties for the Planeprojection class.

Then we want to understand is how the coordinate space is defined, in fact, it is not difficult, you see the old week for you to draw a whole universe the ugliest sketch.

There is no doubt that this picture is the most ugly in the history of human civilization, but you can know, suppose we stare intently at the screen, because there are beautiful women in the screen. At this point, the horizontal direction of the screen is the x axis, positive direction to the right, the vertical direction of the screen is the Y axis, positive direction upward. Yes, where's the z-axis? The positive direction of the Z axis is pointing at you, warning you not to look at, otherwise be careful of the arrows from the screen shot out, the arrow is facing your heart, it seems to look at the beauty is risky.

Now, do you understand the definition of the coordinate space? If you don't know, go back and turn on the display, then you stare at it and see it.

Since this perspective is so easy to use, let's not go into the code and see what the old week is for you.

Look at the rotation first.

Have you been to the sights in the photo? Pujiu, do not know the tourist map, there is time to play, there can also do acoustic reflection experiment, you clap under the tower, the voice will become a frog song.

Look at the pan again.

Well, the perspective is very simple, but the three-dimensional transformation is slightly more difficult, about the three-dimensional transformation, the back of the talk.

Sample source code download.

"Win 10 App development" perspective effect

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.