Pages

Saturday, May 12, 2012

Overview of 3D Animation in WPF

Basically i am aware of the 2D animation in WPF. It is an excellent feature in WPF technology. We have set of libraries for this to achieve the perfect animation for an object. Before to depth into the animations , we should clearly know about the DependencyProperties in WPF. Because animation is the special characteristics of the DependencyProperty. We can animate only DependencyProperties in WPF.

I just has put the below code to demonstrate the 2D animation.

<Button>
   <Button.Triggers>
      <EventTrigger RoutedEvent="Button.Click">
         <BeginStoryboard>
            <Storyboard TargetProperty="Opacity">
               <DoubleAnimation From="1"
                                To="0"
                                Duration="0:0:5" />
            </Storyboard>
         </BeginStoryboard>
      </EventTrigger>
   </Button.Triggers>
</Button>
In the above code i just animate the Opacity property of the Button we click the button. As Opacity property is a double datatype, i used DoubleAnimation inside the storyboard to animate. WPF provides set of more than 20 animations [ ColorAnimation, DoubleAnimation, PointAnimation etc...] classes to make it easy to work with the animations.
If you are interested or new to learn the 3D animation in WPF. Please follow my below instructions carefully .. You will have better idea in this. There are more resources over the internet to learn 3D as well. The below blog gives the detail explanation about the 3D animation.
First thing you need to know in 3D is all the 3D content must exist in ViewPort3D. It actually controls all the 3D stuffs.
There are 4 important parts are inside the ViewPort3D
1. Camera view:-
It just defines what part of the 3D scene is viewable. That means it will be used to display the 3D content from the 2D layout bounds. Camera may be PerspectiveCamera and OrthographicCamera It defines the set of properties FarPlaneDistance, NearPlaneDistance and Position to view the 3D content in the different ways.
2. Geometry to define the shape of the object :-
It specially used to define the shape of the object in the ViewPort. We can render any multi-dimensional object using the Geometry property in the GeometryModel3D.
3. Material in the surface of the object:-
Normally material is a content that to be displayed in the surface of the object. This material can be added to the surface of the object using the Material property in the GeometryModel3D. We can put any UIElement in the surface of the object through material property. Because Material contains the Brush property to render any UIElement. 
4. Lighting effect to the surface:-
Shining effect in the surface of the object can be achieved through the Light. It has AmbientLight, DirectionalLight, PointLight and SpotLight to add shining effects.





No comments:

Post a Comment