国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學院 > 開發設計 > 正文

第15章 動畫基礎(2)——故事板、觸發器

2019-11-10 18:58:06
字體:
來源:轉載
供稿:網友

一、故事板

①故事板是增強型的時間線,可用來分組多個動畫,而且具有動畫播放的能力(暫停、停止以及改變播放位置)。

②一個故事面板中可以放置多個動畫,并且每個動畫可用于不同的元素和屬性。

③故事面板的定義如下:

<Storyboard>    <DoubleAnimation         Storyboard.TargetName="cmdGrow"         Storyboard.TargetPRoperty="Width"        To="250"         Duration="0:0:5">    </DoubleAnimation></Storyboard>二、何處定義觸發器可以在以下4個位置定義觸發器:

在樣式中(Styles.Triggers)在控件模版中(ControlTemplate.Triggers)在數據模版中(DataTemplate.Triggers)直接在元素中定義事件觸發器(FrameworkElement.Triggers),僅支持事件觸發器。三、直接在元素中定義事件觸發器觸發器實例

<Button Padding="10" Name="cmdGrow" Height="40" Width="160"        HorizontalAlignment="Center" VerticalAlignment="Center">    <Button.Triggers>        <EventTrigger>            <BeginStoryboard>                <Storyboard>                    <DoubleAnimation                         Storyboard.TargetProperty="Width"                        To="250"                         Duration="0:0:5">                    </DoubleAnimation>                </Storyboard>            </BeginStoryboard>        </EventTrigger>    </Button.Triggers>    <Button.Content>        Click and Make Me Grow    </Button.Content></Button>四、在樣式中定義觸發器實例

<Window x:Class="Animation.AnimationInStyle"    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"        Title="AnimationInStyle" Height="300" Width="300"    >    <Window.Resources>        <Style x:Key="GrowButtonStyle">            <Style.Triggers>                <Trigger Property="Button.IsPressed" Value="True">                    <Trigger.EnterActions>                        <BeginStoryboard>                            <Storyboard>                                <DoubleAnimation                                     Storyboard.TargetName="cmdGrow"                                     Storyboard.TargetProperty="Width"                                    To="250"                                     Duration="0:0:5">                                </DoubleAnimation>                            </Storyboard>                        </BeginStoryboard>                    </Trigger.EnterActions>                </Trigger>            </Style.Triggers>        </Style>    </Window.Resources>    <Button Padding="10" Name="cmdGrow" Height="40" Width="160" Style="{StaticResource GrowButtonStyle}"            HorizontalAlignment="Center" VerticalAlignment="Center">            Click and Make Me Grow        </Button></Window>


發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 新宁县| 石首市| 天全县| 固安县| 衡水市| 闽侯县| 武川县| 棋牌| 大理市| 治县。| 吴旗县| 上饶市| 稷山县| 冕宁县| 泸定县| 搜索| 舟曲县| 银川市| 永宁县| 张家界市| 高雄市| 镇康县| 峨眉山市| 宝山区| 买车| 玉门市| 缙云县| 水城县| 商南县| 图木舒克市| 凤台县| 新龙县| 北海市| 皮山县| 固阳县| 仲巴县| 阜南县| 长宁县| 辽宁省| 叙永县| 沙雅县|