我需要一个在UWP或Winui中的文本块上动画前景刷的示例
我想在某些东西变化时为文本的颜色做动画。我找不到任何代码示例(除了使用故事板的示例,我想避免的示例)。我发现了这一点:
var animation = _compositor.CreateColorKeyFrameAnimation();
animation.InsertKeyFrame(0.0f, Color.FromArgb(255, 0, 255, 0));
animation.InsertKeyFrame(1.0f, Colors.Purple);
targetVisual.Brush.StartAnimation("Color", animation);
但是不知道如何将这个概念连接到文本块上普通的旧前景刷。
I want to animate the color of text when something changes. I can't find any code examples (other than ones that use the Storyboard, which I want to avoid). I found this:
var animation = _compositor.CreateColorKeyFrameAnimation();
animation.InsertKeyFrame(0.0f, Color.FromArgb(255, 0, 255, 0));
animation.InsertKeyFrame(1.0f, Colors.Purple);
targetVisual.Brush.StartAnimation("Color", animation);
But can't figure out how to connect this concept to a plain, old foreground brush on a TextBlock.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以尝试以下代码:
You could try the following code: