Đang chuẩn bị liên kết để tải về tài liệu:
Foundation Silverlight 3 Animation- P10

Không đóng trình duyệt đến khi xuất hiện nút TẢI XUỐNG

Foundation Silverlight 3 Animation- P10: Silverlight has really come a long way since I started using it. It’s kind of interesting to look back a mere two years (roughly) and think about how the workflow has changed. Of even more interest is the staggering speed at which new features are being added. In the time I’ve been using Silverlight, it has grown from a somewhat limited toolset to an ever-more-impressive technology that has really started to come into its own. | USING TRIGONOMETRY FOR ANIMATION 7. The MouseMove event handler code is shown in the following listing. The idea here is to only strum a string when the mouse is moved toward the bottom of the application. To do this we start by getting the current position of the mouse. We can then check the current mouse position against the last mouse position to determine which way the mouse is moving and if it has encountered the y position where a string is located. The first check says If the mouse is located at 344y or greater and the last mouse position was less than 344y meaning it was above the string then play that string s Vibrate storyboard. Each of the other five strings is checked the same way with the appropriate y value inserted for the tests. private void Page_MouseMove object sender MouseEventArgs e MousePosition e.GetPosition null it MousePosition.Y 344 LastMousePosition.Y 344 Stringl.Vibrate.Begin it MousePosition.Y 328 LastMousePosition.Y 328 String2.Vibrate.Begin it MousePosition.Y 312 LastMousePosition.Y 312 String3.Vibrate.Begin it MousePosition.Y 296 LastMousePosition.Y 296 String4.Vibrate.Begin it MousePosition.Y 280 LastMousePosition.Y 280 String5.Vibrate.Begin it MousePosition.Y 265 LastMousePosition.Y 265 String6.Vibrate.Begin LastMousePosition MousePosition When the application is run the guitar and strings are drawn in the application as shown in Figure 6-24. When the mouse is positioned above the strings and moved downward the strings will vibrate as they 251 CHAPTER 6 are encountered and continue to oscillate until the range dampening cuts the motion down enough to reset the string for the next pass. Ideally a range of y values would be provided to test for each string hit as it is possible to move the mouse over a string without a hit being registered. In addition a string should not be reset until the vibration has dampened enough to drop below the threshold set in the user control so you cannot continuously strum the strings. Figure 6-24. The .

Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.