WPF實(shí)現(xiàn)流光動(dòng)畫特效
更新時(shí)間:2022年04月21日 14:27:23 作者:農(nóng)碼一生
這篇文章介紹了WPF實(shí)現(xiàn)流光動(dòng)畫特效的方法,文中通過示例代碼介紹的非常詳細(xì)。對大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下
一、代碼
<Window.Resources> <!--外--> <Storyboard x:Key="Storyboard1" RepeatBehavior="Forever"> <PointAnimationUsingKeyFrames Storyboard.TargetProperty="(Shape.Stroke).(LinearGradientBrush.StartPoint)" Storyboard.TargetName="rectangle"> <EasingPointKeyFrame KeyTime="0:0:0.5" Value="0.855,0.148"/> <EasingPointKeyFrame KeyTime="0:0:1" Value="0.852,0.855"/> <EasingPointKeyFrame KeyTime="0:0:1.5" Value="0.148,0.855"/> <EasingPointKeyFrame KeyTime="0:0:2" Value="0.144,0.149"/> <EasingPointKeyFrame KeyTime="0:0:2.5" Value="0,0"/> </PointAnimationUsingKeyFrames> <PointAnimationUsingKeyFrames Storyboard.TargetProperty="(Shape.Stroke).(LinearGradientBrush.EndPoint)" Storyboard.TargetName="rectangle"> <EasingPointKeyFrame KeyTime="0:0:0.5" Value="0.145,0.852"/> <EasingPointKeyFrame KeyTime="0:0:1" Value="0.148,0.145"/> <EasingPointKeyFrame KeyTime="0:0:1.5" Value="0.852,0.145"/> <EasingPointKeyFrame KeyTime="0:0:2" Value="0.856,0.851"/> <EasingPointKeyFrame KeyTime="0:0:2.5" Value="0,1"/> </PointAnimationUsingKeyFrames> </Storyboard> <!--中--> <Storyboard x:Key="Storyboard2" RepeatBehavior="Forever"> <PointAnimationUsingKeyFrames Storyboard.TargetProperty="(Shape.Stroke).(LinearGradientBrush.StartPoint)" Storyboard.TargetName="rectangle1"> <EasingPointKeyFrame KeyTime="0:0:0.5" Value="0.855,0.148"/> <EasingPointKeyFrame KeyTime="0:0:1" Value="0.852,0.855"/> <EasingPointKeyFrame KeyTime="0:0:1.5" Value="0.148,0.855"/> <EasingPointKeyFrame KeyTime="0:0:2" Value="0.144,0.149"/> <EasingPointKeyFrame KeyTime="0:0:2.5" Value="0,0"/> </PointAnimationUsingKeyFrames> <PointAnimationUsingKeyFrames Storyboard.TargetProperty="(Shape.Stroke).(LinearGradientBrush.EndPoint)" Storyboard.TargetName="rectangle1"> <EasingPointKeyFrame KeyTime="0:0:0.5" Value="0.145,0.852"/> <EasingPointKeyFrame KeyTime="0:0:1" Value="0.148,0.145"/> <EasingPointKeyFrame KeyTime="0:0:1.5" Value="0.852,0.145"/> <EasingPointKeyFrame KeyTime="0:0:2" Value="0.856,0.851"/> <EasingPointKeyFrame KeyTime="0:0:2.5" Value="0,1"/> </PointAnimationUsingKeyFrames> </Storyboard> <!--內(nèi)--> <Storyboard x:Key="Storyboard3" RepeatBehavior="Forever"> <PointAnimationUsingKeyFrames Storyboard.TargetProperty="(Shape.Stroke).(LinearGradientBrush.StartPoint)" Storyboard.TargetName="rectangle2"> <EasingPointKeyFrame KeyTime="0:0:0.5" Value="0.855,0.148"/> <EasingPointKeyFrame KeyTime="0:0:1" Value="0.852,0.855"/> <EasingPointKeyFrame KeyTime="0:0:1.5" Value="0.148,0.855"/> <EasingPointKeyFrame KeyTime="0:0:2" Value="0.144,0.149"/> <EasingPointKeyFrame KeyTime="0:0:2.5" Value="0,0"/> </PointAnimationUsingKeyFrames> <PointAnimationUsingKeyFrames Storyboard.TargetProperty="(Shape.Stroke).(LinearGradientBrush.EndPoint)" Storyboard.TargetName="rectangle2"> <EasingPointKeyFrame KeyTime="0:0:0.5" Value="0.145,0.852"/> <EasingPointKeyFrame KeyTime="0:0:1" Value="0.148,0.145"/> <EasingPointKeyFrame KeyTime="0:0:1.5" Value="0.852,0.145"/> <EasingPointKeyFrame KeyTime="0:0:2" Value="0.856,0.851"/> <EasingPointKeyFrame KeyTime="0:0:2.5" Value="0,1"/> </PointAnimationUsingKeyFrames> </Storyboard> </Window.Resources> <Window.Triggers> <!--外--> <EventTrigger RoutedEvent="FrameworkElement.Loaded"> <BeginStoryboard Storyboard="{StaticResource Storyboard1}"/> </EventTrigger> <!--中--> <EventTrigger RoutedEvent="FrameworkElement.Loaded"> <BeginStoryboard Storyboard="{StaticResource Storyboard2}"/> </EventTrigger> <!--內(nèi)--> <EventTrigger RoutedEvent="FrameworkElement.Loaded"> <BeginStoryboard Storyboard="{StaticResource Storyboard3}"/> </EventTrigger> </Window.Triggers> <Grid> <!--外--> <Rectangle x:Name="rectangle" Width="300" Height="300" StrokeThickness="3"> <Rectangle.Stroke> <LinearGradientBrush Opacity="0.6"> <GradientStop Color="Transparent" Offset="0"/> <GradientStop Color="Violet" Offset="1"/> </LinearGradientBrush> </Rectangle.Stroke> </Rectangle> <!--中--> <Rectangle x:Name="rectangle1" Width="200" Height="200" StrokeThickness="3"> <Rectangle.Stroke> <LinearGradientBrush Opacity="0.6"> <GradientStop Color="Transparent" Offset="0"/> <GradientStop Color="Green" Offset="1"/> </LinearGradientBrush> </Rectangle.Stroke> </Rectangle> <!--內(nèi)--> <Rectangle x:Name="rectangle2" Width="100" Height="100" StrokeThickness="3"> <Rectangle.Stroke> <LinearGradientBrush Opacity="0.6"> <GradientStop Color="Transparent" Offset="0"/> <GradientStop Color="red" Offset="1"/> </LinearGradientBrush> </Rectangle.Stroke> </Rectangle> </Grid>
二、特效
到此這篇關(guān)于WPF實(shí)現(xiàn)流光動(dòng)畫特效的文章就介紹到這了。希望對大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。
您可能感興趣的文章:
- WPF實(shí)現(xiàn)3D翻牌式倒計(jì)時(shí)特效
- WPF實(shí)現(xiàn)時(shí)鐘特效
- WPF實(shí)現(xiàn)文本描邊+外發(fā)光效果的示例代碼
- WPF實(shí)現(xiàn)動(dòng)畫效果
- WPF實(shí)現(xiàn)3D粒子波浪效果
- WPF實(shí)現(xiàn)平面三角形3D運(yùn)動(dòng)效果
- WPF實(shí)現(xiàn)文字粒子閃爍動(dòng)畫效果
- WPF實(shí)現(xiàn)3D立方體波浪墻效果
- WPF實(shí)現(xiàn)進(jìn)度條實(shí)時(shí)更新效果
- WPF實(shí)現(xiàn)轉(zhuǎn)圈進(jìn)度條效果
相關(guān)文章
ASP.NET MVC5驗(yàn)證系列之客戶端驗(yàn)證
這篇文章主要為大家詳細(xì)介紹了ASP.NET MVC5驗(yàn)證系列之客戶端驗(yàn)證,感興趣的小伙伴們可以參考一下2016-07-07.NET微信公眾號(hào)開發(fā)之準(zhǔn)備工作
本文是.NET微信公眾號(hào)開發(fā)系列文章的第一篇,主要給大家簡單介紹下微信公眾號(hào)的一些操作,有需要的小伙伴可以參考下。2015-07-07asp.net+ajaxfileupload.js 實(shí)現(xiàn)文件異步上傳代碼分享
本文給大家分享一段asp.net基于ajaxfileupload.js實(shí)現(xiàn)文件異步上傳的代碼,本人項(xiàng)目中已經(jīng)在使用的代碼,小伙伴們可以直接移植到自己的項(xiàng)目中去。2014-11-11動(dòng)態(tài)加載Js代碼到Head標(biāo)簽中的腳本
我遇到了這樣的問題,請教google,結(jié)果大多數(shù)只是介紹那個(gè)注冊js的幾個(gè)函數(shù),而這幾個(gè)函數(shù)插入的js都在body里面,幸而在老外那里看到了這個(gè)代碼,其實(shí)比較簡單,但夠有用2009-01-01Asp.net 文件上傳類(取得文件后綴名,保存文件,加入文字水印)
Asp.net 取得文件后綴名,保存文件,加入文字水印的代碼類2008-11-11asp.net 用繼承方法實(shí)現(xiàn)頁面判斷session
在做ASP項(xiàng)目的時(shí)候,判斷用戶是否登陸常用的方法是在每個(gè)頁面判斷session是否存在,無奈用java的時(shí)候過濾器就用的不熟。。。還是用繼承吧。汗。。。2009-09-09