Silverlight 3 Rotating Video Player
August 30th, 2009
Categories: Programming, Silverlight
Yesterday I wrote an article about creating a rotating video player using Silverlight 3 (see here) and I admit that there was an awful lot of text in it, so here is a list of numbered steps for you to follow with less of the rambling in between steps.
-
Create a new Silverlight 3 + website project (obviously) in Blend 3
-
Create 3 rows in the default grid layout
-
Add MediaElement control to top row
-
Add Slider control to middle row
-
Add two Button controls to bottom row
-
Set Slider maximum value to 360
-
Set MediaElement source to your video
-
Embedded in project or…
-
web address
-
-
Select Slider control, open Common Properties pane, right click Value textbox, select Data Binding
-
Select Element Property tab, click MediaElement control from left-hand list
-
Check “Use custom path expression” box and enter Projection.RotationY into the textbox
-
Expand Data Binding window and select TwoWay from the Binding Direction radio buttons
-
Select MediaElement, open Transform pane and make sure the X centre of rotation is 0.5 and Y is 1
-
Run application and you should be able to turn the video using the slider
-
Create a new storyboard called Down
-
Move to 1.5 seconds on timeline and set X value of Projection of the MediaElement to –90
-
Click the key frame on the time line to open the Easing pane
-
Select Bounce Out from drop down list
-
Select a Button control and open it’s event pane (small icon in the top left with a lightning bolt)
-
Enter FallDown into the Click text box and press enter
-
Type “Down.Begin();” in the new method
-
Run application and click the button to make the video fall over
-
Create a new storyboard called Up
-
Move to 1.5 second on timeline and set X value of Projection of the MediaElement to 0
-
If this is already 0, click the Add New Key Frame button on the timeline
-
-
Add a Bounce Out easing effect
-
Select the second Button control and create a click event for it and enter “Up.Begin();” into the new method
And there you have it! 25 steps to create a useless and impractical video player, at least I hope its only 25!
Leave a comment
| Trackback
