2. Add
xmlns:my="clr-namespace:Primitive3DSurfaces;assembly=Primitive3DSurfaces"
3.
<Grid>
<Grid.Background>
<LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
<LinearGradientBrush.GradientStops>
<GradientStop Color="Black" Offset="0"/>
<GradientStop Color="DarkBlue" Offset="1"/>
</LinearGradientBrush.GradientStops>
</LinearGradientBrush>
</Grid.Background>
<Viewport3D Grid.Column="0" Grid.Row="0">
<Viewport3D.Camera>
<PerspectiveCamera Position="0,0,-8" UpDirection="0,1,0" LookDirection="0,0,1" FieldOfView="45" NearPlaneDistance="0.125"/>
</Viewport3D.Camera>
<Viewport3D.Children>
<ModelVisual3D>
<ModelVisual3D.Content>
<DirectionalLight Color="White" Direction="0,0,1" />
</ModelVisual3D.Content>
</ModelVisual3D>
<ModelVisual3D>
<ModelVisual3D.Transform>
<RotateTransform3D>
<RotateTransform3D.Rotation>
<AxisAngleRotation3D x:Name="rotation" Angle="0" Axis="0,1,0" />
</RotateTransform3D.Rotation>
</RotateTransform3D>
</ModelVisual3D.Transform>
<my:Sphere3D>
<ModelVisual3D.Transform>
<TranslateTransform3D OffsetX="0" OffsetY="0" OffsetZ="0" />
</ModelVisual3D.Transform>
<my:Sphere3D.Material>
<DiffuseMaterial>
<DiffuseMaterial.Brush>
<ImageBrush ImageSource="earthspec1k.jpg" />
</DiffuseMaterial.Brush>
</DiffuseMaterial>
</my:Sphere3D.Material>
</my:Sphere3D>
</ModelVisual3D>
</Viewport3D.Children>
</Viewport3D>
</Grid>
4. Add storyboard
<Window.Triggers>
<EventTrigger RoutedEvent="Window.Loaded" >
<BeginStoryboard>
<Storyboard Name="myStoryBoard">
<DoubleAnimation
Storyboard.TargetName="rotation"
Storyboard.TargetProperty="Angle"
From="0" To="360" Duration="0:0:10" RepeatBehavior="Forever"/>
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</Window.Triggers>
5.
5. VS2010CS範例下載