最近再做一个UWP的音乐播放器,今天实现了歌词动画,不是滚动的,滚动的慢慢研究
思路:在右边放了三个textBlock,设置 textBlock的effect属性
<TextBlock.Effect>
<BlurEffect Radius="0"></BlurEffect>
</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();