<Window x:Class="WpfAnimDreiDRotation.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:WpfAnimDreiDRotation"
        mc:Ignorable="d"
        Title="WpfAnimDreiDRotation" Height="300" Width="400">
    <Window.Resources>
        <Storyboard x:Key="SbRes" RepeatBehavior="Forever">
            <Rotation3DAnimation Storyboard.TargetName="Rt3d" 
                                 Storyboard.TargetProperty="Rotation" Duration="0:0:5"
                                 AutoReverse="True">
                <Rotation3DAnimation.From>
                    <AxisAngleRotation3D Axis="1,0,0" Angle="0" />
                </Rotation3DAnimation.From>
                <Rotation3DAnimation.To>
                    <AxisAngleRotation3D Axis="1,0,0" Angle="180" />
                </Rotation3DAnimation.To>
            </Rotation3DAnimation>
            <Rotation3DAnimation Storyboard.TargetName="Rt3d"
                                 Storyboard.TargetProperty="Rotation" Duration="0:0:5" 
                                 BeginTime="0:0:10" AutoReverse="True">
                <Rotation3DAnimation.From>
                    <AxisAngleRotation3D Axis="0,1,0" Angle="0" />
                </Rotation3DAnimation.From>
                <Rotation3DAnimation.To>
                    <AxisAngleRotation3D Axis="0,1,0" Angle="180" />
                </Rotation3DAnimation.To>
            </Rotation3DAnimation>
            <Rotation3DAnimation Storyboard.TargetName="Rt3d"
                                 Storyboard.TargetProperty="Rotation" Duration="0:0:5" 
                                 BeginTime="0:0:20" AutoReverse="True">
                <Rotation3DAnimation.From>
                    <AxisAngleRotation3D Axis="0,0,1" Angle="0" />
                </Rotation3DAnimation.From>
                <Rotation3DAnimation.To>
                    <AxisAngleRotation3D Axis="0,0,1" Angle="180" />
                </Rotation3DAnimation.To>
            </Rotation3DAnimation>
        </Storyboard>
    </Window.Resources>
    <Window.Triggers>
        <EventTrigger RoutedEvent="Loaded">
            <BeginStoryboard Storyboard="{StaticResource SbRes}" />
        </EventTrigger>
    </Window.Triggers>
    <Viewport3D>
        <Viewport3D.Camera>
            <OrthographicCamera Position="1,3,5" 
                                LookDirection="-1,-3,-5" Width="6"/>
        </Viewport3D.Camera>
        <Viewport3D.Children>
            <ModelVisual3D>
                <ModelVisual3D.Content>
                    <DirectionalLight Color="White" Direction="-1,-3,-5" />
                </ModelVisual3D.Content>
            </ModelVisual3D>
            <ModelVisual3D>
                <ModelVisual3D.Content>
                    <GeometryModel3D>
                        <GeometryModel3D.Geometry>
                            <MeshGeometry3D Positions =
                                            "-1,1,1 -1,-1,1 1,-1,1 1,1,1
                                            1,1,1 1,-1,1 1,-1,-1 1,1,-1
                                            -1,1,-1 -1,1,1 1,1,1 1,1,-1" 
                                            TriangleIndices="0,1,2 2,3,0 4,5,6
                                            6,7,4 8,9,10 10,11,8" />
                        </GeometryModel3D.Geometry>
                        <GeometryModel3D.Material>
                            <DiffuseMaterial Brush="LightGray" />
                        </GeometryModel3D.Material>
                        <GeometryModel3D.BackMaterial>
                            <DiffuseMaterial Brush="Red" />
                        </GeometryModel3D.BackMaterial>
                        <GeometryModel3D.Transform>
                            <RotateTransform3D x:Name="Rt3d" >
                                <RotateTransform3D.Rotation>
                                    <AxisAngleRotation3D />
                                </RotateTransform3D.Rotation>
                            </RotateTransform3D>
                        </GeometryModel3D.Transform>
                    </GeometryModel3D>
                </ModelVisual3D.Content>
            </ModelVisual3D>
        </Viewport3D.Children>
    </Viewport3D>
</Window>
