码迷,mamicode.com
首页 > Windows程序 > 详细

WPF制作歌词动画

时间:2017-02-25 01:09:41      阅读:260      评论:0      收藏:0      [点我收藏+]

标签:wpf   语句   .com   boa   radius   时间差   anim   nbsp   分享   

最近再做一个UWP的音乐播放器,今天实现了歌词动画,不是滚动的,滚动的慢慢研究
技术分享
思路:在右边放了三个textBlock,设置 textBlock的effect属性
<TextBlock.Effect>
                            <BlurEffect Radius="0"></BlurEffect>
                </TextBlock.Effect>
就是模糊效果。
中间的textBlock没有使用动画
动画播放时间就是歌词上一句跟下语句的时间差
下面放后台动画代码
 Storyboard DownLrcStory = new Storyboard();
                       
                        DoubleAnimation up = new DoubleAnimation(0, 30, new Duration(TimeSpan.FromSeconds(time)));
                        DoubleAnimation next = new DoubleAnimation(30, 0, new Duration(TimeSpan.FromSeconds(nextTime)));
                        up.RepeatBehavior = RepeatBehavior.Forever;
                        DownLrcStory.Children.Add(up);
                        DownLrcStory.Children.Add(next);
                        Storyboard.SetTarget(up, lrcDown);
                        Storyboard.SetTarget(next, lrcNext);
                        Storyboard.SetTargetProperty(up, new PropertyPath("Effect.Radius"));
                        Storyboard.SetTargetProperty(next, new PropertyPath("Effect.Radius"));
                        DownLrcStory.Begin();

 

技术分享

WPF制作歌词动画

标签:wpf   语句   .com   boa   radius   时间差   anim   nbsp   分享   

原文地址:http://www.cnblogs.com/wscar/p/6440705.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!