TAILIEUCHUNG - Foundation Silverlight 3 Animation- P14

Foundation Silverlight 3 Animation- P14: 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. | KINEMATICS 27. After the MainPage constructor add a function called CreateTentacles that accepts an integer argument named howMany. The passed integer will be used to determine how many tentacles should be drawn on the screen. private void CreateTentacles int howMany tor int i 0 i howMany i 28. Inside the tor loop generate some random numbers. We ll randomize almost the whole process. Start with a random number for the number of segments. That s followed by declaring a speed variable setting it to 0 and then generating a random number between and .04. The while loop is there to avoid tentacles that don t move. Next come variables for the base segment s range a random multiplier and random initial rotation that should generally keep the tentacles pointing downward. int rngSegments 6 10 double rngSpeed 0 while rngSpeed 0 rngSpeed -4 4 I double rngRange 5 60 double rngMult 5 50 double rngRotate o 180 29. Next add the following code to instance the Tentacle object based on the random numbers that were just generated. The new instance of the Tentacle is then scaled randomly between .5 and .8 before being positioned and added to the main canvas. The last line adds the new Tentacle object to the List of Tentacles. Tentacle nextTentacle new Tentacle rngSegments rngSpeed rngRange rngMult rngRotate 5 8 I nextTentacle 2- 50 nextTentacle 150 nextTentacle nextTentacle 30. To call the newly created function we ll add code to the MainPage constructor. Start by initializing the Tentacles List. Next call the new function and pass it the number of tentacles you d like created Tentacles new List Tentacle CreateTentacles 6 31. The tentacles still need to be made to move so add the Completed event handler to the Move storyboard and start the storyboard .

TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã 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.