This is a mirror of official site: http://jasper-net.blogspot.com/

Beginning Silverlight - PlaneProjection

| Sunday, October 24, 2010
In a way this could be a continuation of my look into transitions in Silverlight because what this post is going to cover is a perspective transform.

Silverlight does not have a toolkit for 3-D drawing but this perspective transform gives you the opportunity to simulate 3-D.  Like the other transforms it takes the existing element and changes how it is drawn only this one makes it look like it is on a 3-D surface.

1.  Setting up the Project.

For this project I have created a Silverlight 3 application hosted in an ASP.NET web site and added a small image to the ClientBin directory.
The silverlight application itself consists of a 400x400 point UserControl with a Grid as its root layout container.  In the middle of the Grid I have placed the image.

2.  The PlaneProjection.

Similar to how you add a Transform to an Element you must put the planeprojection inside the projection property.

3554.07BeginningSilverlightPlaneProjection.jpg

Once you have added opening and closing tags for the property, you can define the planeprojection.

3324.08BeginningSilverlightPlaneProjection.jpg

The planeprojection class lets you rotate an element along three axes*.  The x, y and z.

(* I will admit that I did have to look up what the plural of axis was.  Axes still doesn’t look right but I know it is.)

The way the element rotates around the axis gives the illusion of 3-D space.  I have used and image in this example, but you can apply a planeprojection to any element.

The x-axis runs horizontally through the middle of the element which makes the top of the element seem close or further away depending on the rotation angle.

Read more: vbcity

Posted via email from .NET Info

0 comments: