Condividi tramite


CompositionObject.StartAnimation Metodo

Definizione

Overload

StartAnimation(String, CompositionAnimation)

Connette un'animazione con la proprietà specificata dell'oggetto e avvia l'animazione.

StartAnimation(String, CompositionAnimation, AnimationController)

Connette un'animazione con la proprietà specificata dell'oggetto e avvia l'animazione.

StartAnimation(String, CompositionAnimation)

Connette un'animazione con la proprietà specificata dell'oggetto e avvia l'animazione.

public:
 virtual void StartAnimation(Platform::String ^ propertyName, CompositionAnimation ^ animation) = StartAnimation;
void StartAnimation(winrt::hstring const& propertyName, CompositionAnimation const& animation);
public void StartAnimation(string propertyName, CompositionAnimation animation);
function startAnimation(propertyName, animation)
Public Sub StartAnimation (propertyName As String, animation As CompositionAnimation)

Parametri

propertyName
String

Platform::String

winrt::hstring

Proprietà da associare all'animazione.

animation
CompositionAnimation

Animazione da associare alla proprietà specificata.

Esempio

void AnimatingVisualOffset(Visual targetVisual) 
{ 
    var animation = _compositor.CreateVector3KeyFrameAnimation(); 

    // 
    // Define specific easing functions. 
    // 


    var linear = _compositor.CreateLinearEasingFunction(); 

    var easeIn = _compositor.CreateCubicBezierEasingFunction( 
            new Vector2(0.5f, 0.0f), new Vector2(1.0f, 1.0f)); 

    var easeOut = _compositor.CreateCubicBezierEasingFunction( 
            new Vector2(0.0f, 0.0f), new Vector2(0.5f, 1.0f)); 

    // 
    // Add a set of key frames to describe how the Offset should change over time.   
    // 

    animation.InsertKeyFrame(0.00f, new Vector3(100.0f, 100.0f, 0.0f)); 
    animation.InsertKeyFrame(0.25f, new Vector3(300.0f, 100.0f, 0.0f), easeIn); 
    animation.InsertKeyFrame(0.50f, new Vector3(300.0f, 300.0f, 0.0f), linear); 
    animation.InsertKeyFrame(0.75f, new Vector3(100.0f, 300.0f, 0.0f), linear); 
    animation.InsertKeyFrame(1.00f, new Vector3(100.0f, 100.0f, 0.0f), easeOut); 

    // 
    // The animation curve defined by the key frames will scale to match the duration. 
    // 

    animation.Duration = TimeSpan.FromMilliseconds(4000); 

    targetVisual.StartAnimation("Offset", animation); 
}     

Commenti

Se un'animazione è già associata alla proprietà di un oggetto quando viene chiamata StartAnimation, l'animazione applicata precedente verrà disconnessa e verrà assegnata la nuova animazione. Analogamente, l'impostazione della proprietà causerà la disconnessione dell'animazione precedente e il nuovo valore della proprietà avrà effetto.

La tabella seguente mostra l'elenco delle proprietà animabili:

Oggetto Nome proprietà Tipo di proprietà
Oggetto visivo AnchorPoint Vector2
--- CenterPoint Vector3
--- Offset Vector3
--- Opacità Scalare
--- Orientamento Vector4
--- RotationAngle Scalare
--- RotationAxis Vector3
--- Dimensione Vector2
--- TransformMatrix Matrix4x4
InsetClip BottomInset Scalare
--- LeftInset Scalare
--- RightInset Scalare
--- TopInset Scalare
CompositionColorBrush Color Windows.UI.Color
CompositionPropertySet Set di proprietà specificate dallo sviluppatore.

Inoltre, le proprietà di alcuni effetti nell'oggetto CompositionEffectBrush possono essere animate:

Nome effetto Nome proprietà Tipo di proprietà
SaturazioneEffect Saturazione Scalare
ColorSourceEffect Colore Vector4
AritmeticaComposite Offset Scalare
--- Source1Amount Scalare
--- Source2Amount Scalare
--- MultipliAmount Scalare
Transform2D TransformMatrix Matrix3x2
ContrastoEffect Si confronti Float
EsposizioneEffect Esposizione Float
HueRotationEffect Angle Float
SepiaEffect Intensità Float
TemperatureAndTintEffect Temperatura Float
--- Tinta Float
GammaTransferEffect RedAmplitude Float
--- RedExponent Float
--- RedOffset Float
--- GreenAmplitude Float
--- GreenExponent Float
--- GreenOffset Float
--- BlueAmplitude Float
--- BlueExponent Float
--- BlueOffset Float
--- AlfaAmplitude Float
--- AlphaExponent Float
--- AlphaOffset Float

Si applica a

StartAnimation(String, CompositionAnimation, AnimationController)

Connette un'animazione con la proprietà specificata dell'oggetto e avvia l'animazione.

public:
 virtual void StartAnimation(Platform::String ^ propertyName, CompositionAnimation ^ animation, AnimationController ^ animationController) = StartAnimation;
/// [Windows.Foundation.Metadata.Overload("StartAnimationWithController")]
void StartAnimation(winrt::hstring const& propertyName, CompositionAnimation const& animation, AnimationController const& animationController);
[Windows.Foundation.Metadata.Overload("StartAnimationWithController")]
public void StartAnimation(string propertyName, CompositionAnimation animation, AnimationController animationController);
function startAnimation(propertyName, animation, animationController)
Public Sub StartAnimation (propertyName As String, animation As CompositionAnimation, animationController As AnimationController)

Parametri

propertyName
String

Platform::String

winrt::hstring

Proprietà da associare all'animazione.

animation
CompositionAnimation

Animazione da associare alla proprietà specificata.

animationController
AnimationController

Controller di animazione da associare all'animazione.

Attributi

Commenti

Il animationController parametro consente di associare più animazioni alla proprietà Progress di un singolo controller, che richiede meno oggetti ExpressionAnimation rispetto all'associazione di più proprietà dell'animazione Progress a una proprietà CompositionObject.

Si applica a