tailieunhanh - Foundation Silverlight 3 Animation- P8

Foundation Silverlight 3 Animation- P8: 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. | COORDINATES IN SILVERLIGHT 4. Next we ll code up the file. Start with a publicly accessible double to hold the application width. Following that add a private velocity integer variable and a Boolean that will be used to determine if the claw is in motion public double appWidth private int velocityX private bool clawMoving false 5. Inside the tram constructor add code to begin the tramTimer storyboard and create event handlers for the Completed event of the tramTimer storyboard and the Completed event of the clawDown storyboard. The clawDown storyboard contains an animation that opens the claw as it drops toward the bottom of the screen and then closes the claw and rises back up. new EventHandler tramTimer_Completed new EventHandler clawDown_Completed 6. Create the clawDown_Completed event handler function. The code that goes inside the function is simple. It does nothing more than switch our Boolean flag clawMoving to false. private void clawDown_Completed object sender EventArgs e false 7. Create the tramTimer_Completed event handler function. This function handles the motion and boundary checking for the tram object. At each completion cycle of the timer storyboard the tram is moved by the current value contained in the velocityX variable. Tests are done to see if either the left or right walls were hit and if so the direction of the velocity vector is reversed. The function finishes off by restarting the timer that is used to move the tram. private void tramTimer_Completed object sender EventArgs e this this velocityX check if hit right wall if this - 20 velocityX -1 check if hit left wall if this -5 velocityX -1 191 CHAPTER 5 8. Two more functions need to be added to this code-behind. The first SetTramVel will accept an integer argument. When called this .

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.