如何加速WPF淡入/淡出动画
我在淡入/淡出时通过窗口的不透明度变化实现了灯箱效果。当我将窗口最大化时,此效果有很大的延迟,或者当我使用持续时间属性时,不透明度变化不平滑。
我管理这个例如。就像这里:
DoubleAnimation animate = new DoubleAnimation();
animate.From = 1.0;
animate.To = 0.5;
animate.Duration = new Duration(TimeSpan.FromSeconds(0));
this.BeginAnimation(Window.OpacityProperty, animate); // main window
Window1 win = new Window1(); // new window to get focus
win.ShowDialog();
请告诉我,如果你知道,这种效果默认在 GPU 上起作用吗?如果没有,我可以以某种方式处理这个问题吗?
I implemented lightbox effect with window's opacity change whilst fading in/out. When I have my window maximized this effect has big delay or when I use duration property then opacity change is not smooth.
I manage this eg. with like here:
DoubleAnimation animate = new DoubleAnimation();
animate.From = 1.0;
animate.To = 0.5;
animate.Duration = new Duration(TimeSpan.FromSeconds(0));
this.BeginAnimation(Window.OpacityProperty, animate); // main window
Window1 win = new Window1(); // new window to get focus
win.ShowDialog();
Tell me please, if you know, does this effect works on GPU by default? If not, can I manage this somehow?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
最大化问题听起来像是计算机可能存在性能问题,并且存在
Duration
问题,因为您将其设置为0
,零秒动画是即时的,当然不是光滑的。The maximization issue sounds like the computer might have performance issues, and the
Duration
issue exists because you set it to0
, a zero second animation is instant, of course it is not smooth.