Red de conocimiento informático - Problemas con los teléfonos móviles - ¿Qué animación utiliza la opacidad de WPF?

¿Qué animación utiliza la opacidad de WPF?

Puedes utilizar el método BeginAnimation() para cargar varias animaciones al mismo tiempo. El método BeginAnimation( ) casi siempre regresa inmediatamente, lo que le permite animar ambas propiedades al mismo tiempo usando un código como el siguiente:

DoubleAnimation widthAnimation = new DoubleAnimation();

widthAnimation. Desde = 160;

widthAnimation.To = this.Width - 30;

widthAnimation.Duration = TimeSpan.FromSeconds(5);

DoubleAnimation heightAnimation = nuevo DoubleAnimation ();

heightAnimation.From = 40;

heightAnimation.To = this.Height - 50;

heightAnimation.Duration = TimeSpan.FromSeconds(5 ) ;

cmdGrow.BeginAnimation(Button.WidthProperty, widthAnimation);

cmdGrow.BeginAnimation(Button.HeightProperty, heightAnimation);

En este ejemplo, dos Las animaciones no están sincronizadas. Esto significa que el ancho y el alto no crecerán exactamente en el mismo intervalo de tiempo (normalmente, verá que el botón aumenta primero en ancho y luego en alto). Puedes superar esta limitación creando animaciones vinculadas a la misma línea de tiempo.