Windows 8 Store Apps學習(21) 動畫: ThemeTransition(過渡效果)

來源:互聯網
上載者:User

介紹

重新想象 Windows 8 Store Apps 之 動畫

ThemeTransition 的概述

EntranceThemeTransition - 頁面間跳轉時的過渡效果

ContentThemeTransition - 內容改變時的過渡效果

RepositionThemeTransition - 位置改變時的過渡效果

PopupThemeTransition - 彈出時的過渡效果

AddDeleteThemeTransition - 添加項或刪除項時的過渡效果

ReorderThemeTransition - 對集合中的元素重新排序時的過渡效果

PaneThemeTransition - 基於邊緣的較大 UI 滑入和滑出時的過渡效果

EdgeUIThemeTransition - 基於邊緣的較小 UI 滑入和滑出時的過渡效果

樣本

1、過渡效果的概述

Animation/ThemeTransition/Summary.xaml

<Page    x:Class="XamlDemo.Animation.ThemeTransition.Summary"    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"    xmlns:local="using:XamlDemo.Animation.ThemeTransition"    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"    mc:Ignorable="d">        <Grid Background="Transparent">        <StackPanel Margin="120 0 0 0">                <TextBlock Text="請參見本 xaml 中的注釋" FontSize="14.667" />                <!--                UIElement.Transitions - 指定 UIElement 的過渡動畫                                <Rectangle>                    <Rectangle.Transitions>                        <TransitionCollection>                            <EntranceThemeTransition/>                        </TransitionCollection>                    </Rectangle.Transitions>                </Rectangle>            -->                    <!--                Panel.ChildrenTransitions - 指定 Panel 的子項目們的過渡動畫                                <WrapGrid>                    <WrapGrid.ChildrenTransitions>                        <TransitionCollection>                            <EntranceThemeTransition/>                        </TransitionCollection>                    </WrapGrid.ChildrenTransitions>                </WrapGrid>            -->                    <!--                ItemsControl.ItemContainerTransitions - 指定 ItemsControl 的項容器的過渡動畫                                <ItemsControl>                    <ItemsControl.ItemContainerTransitions>                        <TransitionCollection>                            <EntranceThemeTransition/>                        </TransitionCollection>                    </ItemsControl.ItemContainerTransitions>                </ItemsControl>            -->                    <!--                ContentControl.ContentTransitions - 指定 ContentControl 的過渡動畫                                <ContentControl>                    <ContentControl.ContentTransitions>                        <TransitionCollection>                            <EntranceThemeTransition/>                        </TransitionCollection>                    </ContentControl.ContentTransitions>                </ContentControl>            -->                        </StackPanel>    </Grid></Page>

2、示範 EntranceThemeTransition

Animation/ThemeTransition/Entrance.xaml

<Page    x:Class="XamlDemo.Animation.ThemeTransition.Entrance"    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"    xmlns:local="using:XamlDemo.Animation.ThemeTransition"    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"    mc:Ignorable="d">        <Grid Background="Transparent">        <StackPanel Margin="120 0 0 0">                            <!--                EntranceThemeTransition - 頁面間跳轉時的過渡效果                    FromHorizontalOffset - 初始位置的水平位移量                    FromVerticalOffset - 初始位置的垂直位移量                    IsStaggeringEnabled - 當包含多個子項目時,是否需要錯開呈現它們            -->            <Frame Name="frame" Width="400" Height="100" HorizontalAlignment="Left" VerticalAlignment="Top">                <Frame.ContentTransitions>                    <TransitionCollection>                        <EntranceThemeTransition IsStaggeringEnabled="False" />                    </TransitionCollection>                </Frame.ContentTransitions>            </Frame>                <Button Name="btnGotoFrame1" Content="導航至 Frame1" Click="btnGotoFrame1_Click_1" Margin="0 10 0 0" />            <Button Name="btnGotoFrame2" Content="導航至 Frame2" Click="btnGotoFrame2_Click_1" Margin="0 10 0 0" />                <ItemsControl x:Name="itemsControl" Margin="0 10 0 0">                <ItemsControl.ItemsPanel>                    <ItemsPanelTemplate>                        <WrapGrid>                            <WrapGrid.ChildrenTransitions>                                <TransitionCollection>                                    <EntranceThemeTransition IsStaggeringEnabled="True" />                                </TransitionCollection>                            </WrapGrid.ChildrenTransitions>                        </WrapGrid>                    </ItemsPanelTemplate>                </ItemsControl.ItemsPanel>                <ItemsControl.Items>                    <Rectangle Width="100" Height="100" Fill="Red" />                    <Rectangle Width="100" Height="100" Fill="Green" />                    <Rectangle Width="100" Height="100" Fill="Blue" />                </ItemsControl.Items>                <ItemsControl.Template>                    <ControlTemplate>                        <Border BorderBrush="Orange" BorderThickness="1">                            <ItemsPresenter Margin="10" VerticalAlignment="Center" HorizontalAlignment="Center" />                        </Border>                    </ControlTemplate>                </ItemsControl.Template>            </ItemsControl>                        </StackPanel>    </Grid></Page>

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.