tailieunhanh - programming windows phone 7 phần 3

Các lĩnh vực trong lớp Game1 chủ yếu liên quan đến các biến cần thiết vào vị trí đó bitmap trên màn hình: Dự án XnaAccelerometer bao gồm bởi một pixel bitmap đặt tên bao gồm một vòng tròn màu đỏ: XNA dự án: XnaAccelerometer File: (trích đoạn cho thấy các lĩnh vực) | Image Source Images RadialGradientBrush GradientStop Offset 0 Color White GradientStop Offset Color White GradientStop Offset 1 Color Transparent Radi alGradientBrush Image Notice that the RadialGradientBrush is opaque in the center and continues to be opaque until a radius of at which point the gradient goes to fully transparent at the edge of the circle. Here s the result a very nice effect that looks much fancier than the few lines of XAML would seem to imply Here s a popular technique that uses two identical elements but one of them gets both a ScaleTransform to flip it upside down and an OpacityMask to make it fade out Image Source Images Stretch None VerticalAlignment Top Image Source Images Stretch None VerticalAlignment Top RenderTransformOrigin 1 ScaleTransform ScaleY -1 ransform LinearGradientBrush StartPoint 0 0 EndPoint 0 1 GradientStop Offset 0 Color 00000000 GradientStop Offset 1 Color 40000000 LinearGradientBrush Image The two Image elements are the same size and aligned at the top and center. Normally the second one would be positioned on top of the other. But the second one has a RenderTransform set to a ScaleTransform that flips the image around the horizontal axis. The 189 RenderTransformOrigin is set at 1 which is the bottom of the element. This causes the scaling to flip the image around its bottom edge. Then a LinearGradientBrush is applied to the OpacityMask property to make the reflected image fade out Notice that the GradientStop values apply to the unreflected image so that full transparency the 00000000 value seems to be at the top of the picture and then is reflected to the bottom of the composite display. It is often little touches like these that make a program s visuals pop out just a little more and endear themselves to the .

TÀI LIỆU MỚI ĐĂNG