Share via


AnimatedVisualPlayer.AnimationOptimization Proprietà

Definizione

Ottiene o imposta un valore che specifica il modo in cui le animazioni vengono memorizzate nella cache quando l'oggetto AnimatedVisualPlayer è inattiva (quando PlayAsync non è attivo).

public:
 property PlayerAnimationOptimization AnimationOptimization { PlayerAnimationOptimization get(); void set(PlayerAnimationOptimization value); };
/// [Microsoft.UI.Xaml.CustomAttributes.MUXPropertyChangedCallback(enable=true)]
/// [Microsoft.UI.Xaml.CustomAttributes.MUXPropertyDefaultValue(value="winrt::PlayerAnimationOptimization::Latency")]
/// [get: Microsoft.UI.Xaml.CustomAttributes.MUXPropertyChangedCallback(enable=true)]
/// [get: Microsoft.UI.Xaml.CustomAttributes.MUXPropertyDefaultValue(value="winrt::PlayerAnimationOptimization::Latency")]
/// [set: Microsoft.UI.Xaml.CustomAttributes.MUXPropertyChangedCallback(enable=true)]
/// [set: Microsoft.UI.Xaml.CustomAttributes.MUXPropertyDefaultValue(value="winrt::PlayerAnimationOptimization::Latency")]
PlayerAnimationOptimization AnimationOptimization();

void AnimationOptimization(PlayerAnimationOptimization value);
[Microsoft.UI.Xaml.CustomAttributes.MUXPropertyChangedCallback(enable=true)]
[Microsoft.UI.Xaml.CustomAttributes.MUXPropertyDefaultValue(value="winrt::PlayerAnimationOptimization::Latency")]
public PlayerAnimationOptimization AnimationOptimization { [Microsoft.UI.Xaml.CustomAttributes.MUXPropertyChangedCallback(enable=true)] [Microsoft.UI.Xaml.CustomAttributes.MUXPropertyDefaultValue(value="winrt::PlayerAnimationOptimization::Latency")] get; [Microsoft.UI.Xaml.CustomAttributes.MUXPropertyChangedCallback(enable=true)] [Microsoft.UI.Xaml.CustomAttributes.MUXPropertyDefaultValue(value="winrt::PlayerAnimationOptimization::Latency")] set; }
Public Property AnimationOptimization As PlayerAnimationOptimization

Valore della proprietà

Valore che specifica il modo in cui le animazioni vengono memorizzate nella cache quando l'oggetto AnimatedVisualPlayer è inattiva (quando PlayAsync non è attivo). Il valore predefinito è Latency.

Attributi
Microsoft.UI.Xaml.CustomAttributes.MUXPropertyChangedCallbackAttribute Microsoft.UI.Xaml.CustomAttributes.MUXPropertyDefaultValueAttribute

Esempio

Se si dispone di un'animazione che inizia su un clic, inizializzare la proprietà su Resources. Impostare AnimationOptimization quindi su Latency quando il mouse entra nel controllo e torna a Resources quando il mouse lascia il controllo. Ciò garantisce che l'animazione inizi immediatamente a fare clic senza usare le risorse inutilmente.

Se si chiama PlayAsync prima che vengano caricate le animazioni, il lettore non inizierà fino a quando tutte le animazioni non vengono caricate completamente.

private void Player_PointerEntered(object sender, PointerRoutedEventArgs e)
{
    myanimatedvisualplayer.AnimationOptimization = AnimationOptimization.Latency;
}
async private void Player_PointerExited(object sender, PointerRoutedEventArgs e)
{              
    myanimatedvisualplayer.AnimationOptimization = AnimationOptimization.Resources;
}
async private void Player_OnClick(object sender, PointerRoutedEventArgs e)
{              
    myanimatedvisualplayer.PlayAsync(0.0, 1.0);
}

Commenti

Se si imposta l'oggetto o AnimationOptimization del lettore, il lettore rinvierà l'elaborazione Source del file di origine fino all'elaborazione del layout.

Si applica a

Vedi anche