Windows Phone 8.1 旋转

<Page.Resources>
    <Storyboard x:Name="rotateX">
        <!--沿X轴方向旋转的面板-->
        <DoubleAnimation Storyboard.TargetName="planeProjection"
                             Storyboard.TargetProperty="RotationX"
                             From="0" To="360" Duration="0:0:5" />
    </Storyboard>
    <Storyboard x:Name="rotateY">
        <!--沿Y轴方向旋转的面板-->
        <DoubleAnimation Storyboard.TargetName="planeProjection"
                             Storyboard.TargetProperty="RotationY"
                             From="0" To="360" Duration="0:0:5" />
    </Storyboard>
    <Storyboard x:Name="rotateZ">
        <!--沿Z轴方向旋转的面板-->
        <DoubleAnimation Storyboard.TargetName="planeProjection"
                             Storyboard.TargetProperty="RotationZ"
                             From="0" To="360" Duration="0:0:5" />
    </Storyboard>
</Page.Resources>
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
    <Grid.RowDefinitions>
        <RowDefinition Height="Auto"/>
        <RowDefinition Height="*"/>
    </Grid.RowDefinitions>

    <StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="12,35,0,28">
        <TextBlock Text="我的应用程序" FontSize="20"  />
        <TextBlock Text="三维旋转" FontSize="60" />
    </StackPanel>

    <Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
        <Grid.RowDefinitions>
            <RowDefinition Height="*" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>

        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*" />
            <ColumnDefinition Width="*" />
            <ColumnDefinition Width="*" />
        </Grid.ColumnDefinitions>

        <TextBlock Name="txtblk"
                       Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="3"
                       Text="Oh,My God"
                       FontSize="60"
                       Foreground="Red"
                       HorizontalAlignment="Center"
                       VerticalAlignment="Center">
            <TextBlock.Projection>
                <PlaneProjection x:Name="planeProjection" />
            </TextBlock.Projection>
        </TextBlock>

        <Button Grid.Row="1" Grid.Column="0"
                    Content="旋转-X轴"
                    Click="RotateXClick" />

        <Button Grid.Row="1" Grid.Column="1"
                    Content="旋转-Y轴"
                    Click="RotateYClick" />

        <Button Grid.Row="1" Grid.Column="2"
                    Content="旋转-Z轴"
                    Click="RotateZClick" />

    </Grid>
</Grid>
public sealed partial class MainPage: Page {
    public MainPage() {
        this.InitializeComponent();
    }

    //沿X轴旋转
    private void RotateXClick(object sender, RoutedEventArgs args) {
        rotateX.Begin();
    }

    //沿Y轴旋转
    private void RotateYClick(object sender, RoutedEventArgs args) {
        rotateY.Begin();
    }

    //沿Z轴旋转
    private void RotateZClick(object sender, RoutedEventArgs args) {
        rotateZ.Begin();
    }

    protected override void OnNavigatedTo(NavigationEventArgs e) {}
}

网友评论

无吐槽,不精彩,期待您的参与。

吐槽几句

"(必填)"

"(选填)"

"(必填,不公开)"

(必填,最多100个字符。)

先说这么多吧