WPF實現(xiàn)3D翻牌式倒計時特效-創(chuàng)新互聯(lián)

本文實例為大家分享了WPF實現(xiàn)3D翻牌式倒計時的具體代碼,供大家參考,具體內(nèi)容如下

創(chuàng)新互聯(lián)建站專業(yè)為企業(yè)提供鄧州網(wǎng)站建設(shè)、鄧州做網(wǎng)站、鄧州網(wǎng)站設(shè)計、鄧州網(wǎng)站制作等企業(yè)網(wǎng)站建設(shè)、網(wǎng)頁設(shè)計與制作、鄧州企業(yè)網(wǎng)站模板建站服務(wù),十年鄧州做網(wǎng)站經(jīng)驗,不只是建網(wǎng)站,更提供有價值的思路和整體網(wǎng)絡(luò)服務(wù)。

實現(xiàn)效果如下:

WPF實現(xiàn)3D翻牌式倒計時特效

思路:使用自定義控件,設(shè)置一個背板 MyCardControlBottom,一個卡牌翻動的前部 MyCardControlFront,一個卡牌翻動后的背部 MyCardControlBack,另外實現(xiàn)卡牌翻動的MyCardControl;在主窗體中設(shè)置一計時器,根據(jù)卡牌上的數(shù)字和計時器時間啟動翻牌動作。

主要代碼:

1、自定義控件MyCardControlBottom

<UserControl x:Class="TurnOverCards.MyCardControlBottom"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
    x:Name="MyUserControl"
    Height="300" Width="200">
 <Border BorderThickness="0">
  <Border.Effect>
   <DropShadowEffect BlurRadius="20" Color="Gray" Direction="-90" ShadowDepth="10"></DropShadowEffect>
  </Border.Effect>
  <Border.Background>
   <RadialGradientBrush GradientOrigin="0.5,0.5" Center="0.5,0.5" RadiusX="0.75" RadiusY="0.65">
    <GradientStop Color="DimGray" Offset="0" />
    <GradientStop Color="Black" Offset="1" />
   </RadialGradientBrush>
  </Border.Background>
  <Grid>
   <Grid.RowDefinitions>
    <RowDefinition></RowDefinition>
    <RowDefinition></RowDefinition>
   </Grid.RowDefinitions>
   <TextBlock Grid.Row="0" Text="{Binding ElementName=MyUserControl,Path=BottomText}" FontFamily="Arial" Foreground="White" FontSize="150" FontWeight="Bold" HorizontalAlignment="Center" VerticalAlignment="Top" Margin="0,65,0,2">
    <TextBlock.Effect>
     <DropShadowEffect BlurRadius="10" Color="Black" Direction="-90" ShadowDepth="2"></DropShadowEffect>
    </TextBlock.Effect>
   </TextBlock>
   <TextBlock Grid.Row="1" Text="{Binding ElementName=MyUserControl,Path=BottomText}" FontFamily="Arial" Foreground="White" FontSize="150" FontWeight="Bold" HorizontalAlignment="Center" VerticalAlignment="Bottom" Margin="0,0,0,65">
    <TextBlock.Effect>
     <DropShadowEffect BlurRadius="10" Color="Black" Direction="-90" ShadowDepth="2"></DropShadowEffect>
    </TextBlock.Effect>
   </TextBlock>
  </Grid>
 </Border>
</UserControl>

文章標題:WPF實現(xiàn)3D翻牌式倒計時特效-創(chuàng)新互聯(lián)
網(wǎng)址分享:http://muchs.cn/article8/dshhip.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供App開發(fā)商城網(wǎng)站、品牌網(wǎng)站制作、網(wǎng)站建設(shè)網(wǎng)站內(nèi)鏈、網(wǎng)站設(shè)計公司

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

搜索引擎優(yōu)化