tailieunhanh - Foundation Silverlight 3 Animation- P13

Foundation Silverlight 3 Animation- P13: 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. | COLLISIONS double DX whichBall - theLine double DY whichBall - theLine double X1 DX Cosine DY Sine double Y1 DY Cosine -DX Sine double VX1 Cosine Sine double VY1 Cosine - Sine it Y1 - I 2 Y1 - I 2 VY1 Restitution double X Cosine X1- Sine Yl double Y Cosine Y1 Sine Xi Cosine VX1 - Sine VY1 Cosine VY1 Sine VX1 whichBallj theLine X whichBallj theLine Y Press F5 to compile and run the program again. This time the ball drops hits the line bounces and drops off the line as you would expect it to. However after hitting the edge of the application and rolling back toward the line the ball moves inside the right boundary and then appears to jump as the code calculates the collision again. This issue is easily corrected. 19. Locate the if statement that performs the collision reaction calculation it will look like this it Yl - I 2 . Change it so that it includes an and function like the code shown following. The Yl VY1 tests the rotated position of the ball to see if it is less than the velocity of the ball. When above the line the ball s rotated y position is negative so it will be less than the ball s y velocity which is positive as the ball drops. Once below the line and inside the line s boundaries the ball s rotated y position becomes positive and is greater than the ball s y velocity so no collision takes place. it Yl - I 2 Yl VY1 Now when you compile and run the program the ball will roll under the line as expected. Play around with the angle of the line a little bit and see what kind of effect it has on the ball bouncing. Take a few minutes and add a slider to the application that allows you to change the angle of the line while the application is running. If you

crossorigin="anonymous">
Đã 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.