當前位置:編程學習大全網 - 編程軟體 - wpf opacity使用什麽動畫

wpf opacity使用什麽動畫

可以使用BeginAnimation( )方法同時加載多個動畫。BeginAnimation( )方法幾乎總是立即返回,從而可以使用類似下面的代碼同時為兩個屬性應用動畫:

DoubleAnimation widthAnimation = new DoubleAnimation();

widthAnimation.From = 160;

widthAnimation.To = this.Width - 30;

widthAnimation.Duration = TimeSpan.FromSeconds(5);

DoubleAnimation heightAnimation = new DoubleAnimation();

heightAnimation.From = 40;

heightAnimation.To = this.Height - 50;

heightAnimation.Duration = TimeSpan.FromSeconds(5);

cmdGrow.BeginAnimation(Button.WidthProperty, widthAnimation);

cmdGrow.BeginAnimation(Button.HeightProperty, heightAnimation);

在這個示例中,兩個動畫沒有被同步。這意味著寬度和高度不會準確地在相同的時間間隔內增長(通常,將會看到按鈕先增加寬度緊接著增加高度)。可以通過創建綁定到同壹個時間線的動畫,突破這壹限制。

  • 上一篇:泰拉瑞亞心燈怎麽做?
  • 下一篇:大學生中真的有黑客嗎?
  • copyright 2024編程學習大全網