Bir nechta xususiyatlarni animatsiya qilish
Bitta animatsiya faqat bitta obyekt xususiyati bilan ishlashi mumkin. Ammo,
agar biz bir vaqtning
o'zida bir nechta xususiyatni jonlantirishimiz kerak bo'lsa, biz har biri uchun o'z
animatsiya
ob'ektimizni o'rnatishimiz mumkin:
15
16
MessageBox.Show(
"Анимация завершена"
);
}
1
2
3
4
5
6
7
8
9
10
o'n bir
12
13
14
//
анимация для ширины
DoubleAnimation widthAnimation =
new
DoubleAnimation();
widthAnimation.From = helloButton.ActualWidth;
widthAnimation.To = 150;
widthAnimation.Duration = TimeSpan.FromSeconds(5);
//
анимация для высоты
DoubleAnimation heightAnimation =
new
DoubleAnimation();
heightAnimation.From = helloButton.ActualHeight;
heightAnimation.To = 60;
heightAnimation.Duration = TimeSpan.FromSeconds(5);
helloButton.BeginAnimation(Button.WidthProperty, widthAnimation);
helloButton.BeginAnimation(Button.HeightProperty, heightAnimation);