开发者

How to accelerate WPF fade in/out animation

开发者 https://www.devze.com 2023-03-27 18:32 出处:网络
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 s

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?


The maximization issue sounds like the computer might have performance issues, and the Duration issue exists because you set it to 0, a zero second animation is instant, of course it is not smooth.

0

精彩评论

暂无评论...
验证码 换一张
取 消