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

首頁 > 學(xué)院 > 開發(fā)設(shè)計(jì) > 正文

第15章 動(dòng)畫基礎(chǔ)(2)——故事板、觸發(fā)器

2019-11-10 18:32:28
字體:
供稿:網(wǎng)友

一、故事板

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

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

③故事面板的定義如下:

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

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

<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>四、在樣式中定義觸發(fā)器實(shí)例

<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>


發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 乐陵市| 延安市| 宿州市| 中卫市| 南陵县| 将乐县| 金川县| 金川县| 新田县| 晋江市| 宝应县| 遵义县| 乌拉特中旗| 安多县| 蓝田县| 天门市| 明溪县| 古浪县| 中山市| 博野县| 丹寨县| 曲沃县| 炎陵县| 康定县| 郑州市| 黑河市| 磐石市| 平和县| 延边| 徐闻县| 襄樊市| 太谷县| 历史| 会同县| 丰宁| 即墨市| 双柏县| 大新县| 山丹县| 南溪县| 鹤壁市|