「Windows VistaとWindows開発環境の進化」 (ITmedia, 2006/07/25) での XAML


環境: WinFX Beta 2

こんにちは、松崎です。

2006/07/25 に実施予定の「Windows VistaとWindows開発環境の進化」でご紹介するXAMLのソースコードでコード全体を解説できない分を以下に記載しておきます。

============================================
<!-- 3D のアニメーションとテキストの統合 -->

      <Grid.Resources>
        <Storyboard x:Key ="OnLoaded">
          <DoubleAnimation From="0" To="360" Duration="0:0:3" Storyboard.TargetName="MyRotation3D" Storyboard.TargetProperty="Angle" RepeatBehavior="Forever" />
        </Storyboard>
      </Grid.Resources>

      <Viewport3D>
        <Viewport3D.Camera>
          <PerspectiveCamera FarPlaneDistance="20" LookDirection="0,-0.65,-1" UpDirection="0,1,0" NearPlaneDistance="1" Position="0,2,3" FieldOfView="40" />
        </Viewport3D.Camera>
          <ModelVisual3D>
            <ModelVisual3D.Content>
              <Model3DGroup>
                  <AmbientLight Color="White" />
                  <GeometryModel3D>
                    <GeometryModel3D.Geometry>
                      <MeshGeometry3D TriangleIndices="0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35" Normals="0,0,-1 0,0,-1 0,0,-1 0,0,-1 0,0,-1 0,0,-1 0,0,1 0,0,1 0,0,1 0,0,1 0,0,1 0,0,1 0,-1,0 0,-1,0 0,-1,0 0,-1,0 0,-1,0 0,-1,0 1,0,0 1,0,0 1,0,0 1,0,0 1,0,0 1,0,0 0,1,0 0,1,0 0,1,0 0,1,0 0,1,0 0,1,0 -1,0,0 -1,0,0 -1,0,0 -1,0,0 -1,0,0 -1,0,0 " TextureCoordinates="1,1 1,0 0,0 0,0 0,1 1,1 0,1 1,1 1,0 1,0 0,0 0,1 0,1 1,1 1,0 1,0 0,0 0,1 1,1 1,0 0,0 0,0 0,1 1,1 1,0 0,0 0,1 0,1 1,1 1,0 0,0 0,1 1,1 1,1 1,0 0,0 " Positions="-0.5,-0.5,-0.5 -0.5,0.5,-0.5 0.5,0.5,-0.5 0.5,0.5,-0.5 0.5,-0.5,-0.5 -0.5,-0.5,-0.5 -0.5,-0.5,0.5 0.5,-0.5,0.5 0.5,0.5,0.5 0.5,0.5,0.5 -0.5,0.5,0.5 -0.5,-0.5,0.5 -0.5,-0.5,-0.5 0.5,-0.5,-0.5 0.5,-0.5,0.5 0.5,-0.5,0.5 -0.5,-0.5,0.5 -0.5,-0.5,-0.5 0.5,-0.5,-0.5 0.5,0.5,-0.5 0.5,0.5,0.5 0.5,0.5,0.5 0.5,-0.5,0.5 0.5,-0.5,-0.5 0.5,0.5,-0.5 -0.5,0.5,-0.5 -0.5,0.5,0.5 -0.5,0.5,0.5 0.5,0.5,0.5 0.5,0.5,-0.5 -0.5,0.5,-0.5 -0.5,-0.5,-0.5 -0.5,-0.5,0.5 -0.5,-0.5,0.5 -0.5,0.5,0.5 -0.5,0.5,-0.5 " />
                    </GeometryModel3D.Geometry>
                    <GeometryModel3D.Transform>
                      <RotateTransform3D>
                        <RotateTransform3D.Rotation>
                          <AxisAngleRotation3D x:Name="MyRotation3D" Angle="45" Axis="0 1 0" />
                        </RotateTransform3D.Rotation>
                      </RotateTransform3D>
                    </GeometryModel3D.Transform>
                    <GeometryModel3D.Material>
                      <DiffuseMaterial>
                        <DiffuseMaterial.Brush>
                          <VisualBrush>
                            <VisualBrush.Visual>
                              <TextBlock Text="Hello" />
                            </VisualBrush.Visual>
                          </VisualBrush>
                        </DiffuseMaterial.Brush>
                      </DiffuseMaterial>
                    </GeometryModel3D.Material>
                  </GeometryModel3D>
              </Model3DGroup>
            </ModelVisual3D.Content>
          </ModelVisual3D>
        <Viewport3D.Triggers>
          <EventTrigger RoutedEvent="Viewport3D.Loaded">
            <EventTrigger.Actions>
              <BeginStoryboard x:Name ="OnLoaded_BeginStoryboard" Storyboard ="{DynamicResource OnLoaded}"/>
            </EventTrigger.Actions>
          </EventTrigger>
        </Viewport3D.Triggers>
      </Viewport3D>

============================================

以上です


Comments (0)

Skip to main content