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

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

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

2019-11-10 21:26:08
字體:
供稿:網(wǎng)友

一、故事板

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

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

③故事面板的定義如下:

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

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

<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ā)器實例

<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ā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 团风县| 巫溪县| 安龙县| 五河县| 延川县| 汕尾市| 馆陶县| 乐都县| 邢台县| 出国| 舞钢市| 潮安县| 晋中市| 博乐市| 青铜峡市| 施秉县| 闵行区| 旬阳县| 岱山县| 济南市| 湖南省| 昭平县| 高台县| 龙山县| 景德镇市| 阳原县| 将乐县| 梓潼县| 清河县| 石渠县| 海伦市| 呼玛县| 改则县| 延川县| 四会市| 互助| 喜德县| 通化市| 会宁县| 平湖市| 廊坊市|