Skip to content

Latest commit

 

History

History
62 lines (43 loc) · 1.76 KB

compositionobject_implicitanimations.md

File metadata and controls

62 lines (43 loc) · 1.76 KB
-api-id -api-type
P:Windows.UI.Composition.CompositionObject.ImplicitAnimations
winrt property

Windows.UI.Composition.CompositionObject.ImplicitAnimations

-description

The collection of implicit animations attached to this object.

-property-value

The collection of implicit animations attached to this object.

-remarks

-examples

class PropertyAnimation 
{ 
  PropertyAnimation(Compositor compositor, SpriteVisual heroVisual, SpriteVisual listVisual) 
  { 
    // Define ImplicitAnimationCollection 
    ImplicitAnimationCollection implicitAnimations =  compositor.CreateImplicitAnimationCollection(); 

    // Trigger animation when the “Offset” property changes. 
    implicitAnimations["Offset"] = CreateAnimation(compositor); 

    // Assign ImplicitAnimations to a visual. Unlike Visual.Children,     
    // ImplicitAnimations can be shared by multiple visuals so that they  
    // share the same implicit animation behavior (same as Visual.Clip). 
    heroVisual.ImplicitAnimations = implicitAnimations; 

    // ImplicitAnimations can be shared among visuals  
    listVisual.ImplicitAnimations = implicitAnimations; 

    listVisual.Offset = new Vector3(20f, 20f, 20f); 
  } 

  Vector3KeyFrameAnimation CreateAnimation(Compositor compositor) 
  { 
    Vector3KeyFrameAnimation animation = compositor.CreateVector3KeyFrameAnimation(); 
    animation.InsertExpressionKeyFrame(0f, "this.StartingValue"); 
    animation.InsertExpressionKeyFrame(1f, "this.FinalValue"); 
    animation.Target =Offset; 
    animation.Duration = TimeSpan.FromSeconds(0.25); 
    return animation; 
  } 
} 
          
          

-see-also