At MIX 08 there was a cool WPF demonstration that used some of the features of WPF that appeared in .NET Framework V3.5 Service Pack 1 such as custom effects with pixel shaders and so on.
The application looked like this;
and it presented what looked like a floating 3D plane which you could manipulate by clicking on it with the left mouse button in order to “knock” it backwards and forwards on “springs” around the screen. The surface of that plane could then be filled with an image, a video or a live control (using a VisualBrush) and then both standard and custom effects from WPF could be applied over the top of the content.
I really liked this demo and I’ve used it a lot in the meantime to demonstrate those WPF features although it’s always been in binary form as I never managed to find the source code for the project and I’m not sure that it’s out on the public web anywhere for download.
With the advent of Silverlight 3 and, specifically with new features such as;
- Pixel shaders
- Perspective transformations
- The ability to run outside of the browser
- Easing animations
I thought it might be fun to see if I could build an approximation of that WPF demo using Silverlight 3 and it did turn out to be a lot of fun 🙂
Here’s a screenshot of my mocked up version of the application running outside of the browser on my local machine;
Whilst this application is not nearly as rich as the original application, that’s a lot more to do with my skills and/or the amount of time I put into the application and a lot less to do with Silverlight itself. There are a few areas where it pales compared to the original;
- The graphics – I drew the backdrop and the orange bits myself in Expression Design and so they’re not exactly stunning 🙂
- The physics engine. There isn’t one! 🙂 It’s really quite cool that anything that appears to be done by a physics engine here is just being done by an easing animation in Silverlight 3.
Regardless, I thought I’d publish the application for you to experiment with and also the source code for you to take a look at and perhaps take further in the future.
You can run the application from here.
You can download the application source code from here.
A quick note: this application contains a video file. I chose to embed that in the XAP file in order to make my life easier so if you run the application then you’ll notice that it takes a little while to start up because it’s downloading the XAP with a WMV file in it. If you download the source then you can change the way that works if you like.
Note – I just saw the MIX09 keynote and saw that ScottGu had a similar application to this one. This is _not_ the application that Scott used and ( frankly ) it’s not as rich as the app that he had but it might help you with having a look at some source 🙂
This is one of a series of posts taking a quick look at Silverlight 3 – expect them to be a little “rough and ready” and that they’ll get expanded on as I’ve had more time to work with Silverlight 3.