Implicit​Animation​Collection Implicit​Animation​Collection Implicit​Animation​Collection Class

Definition

A collection of animations triggered when a condition is met.

Implicit Animations will help drive animations for an application using triggers as way to start animations. Implicit animation helps decouple kicking off animation from app logic. Composition does the work of executing animations based on trigger execution. App developers define animations which they want to execute, and the events that trigger these animations. Composition then executes these animations when the appropriate trigger conditions are met.

public sealed class ImplicitAnimationCollection : CompositionObject, IIterable, IMap, IImplicitAnimationCollectionpublic sealed class ImplicitAnimationCollection : CompositionObject, IEnumerable, IDictionary, IImplicitAnimationCollectionPublic NotInheritable Class ImplicitAnimationCollection Inherits CompositionObject Implements IEnumerable, IDictionary, IImplicitAnimationCollection
Inheritance
ImplicitAnimationCollectionImplicitAnimationCollectionImplicitAnimationCollection
Attributes
Windows 10 requirements
Device family
Windows 10 Anniversary Edition (introduced v10.0.14393.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v3)

Inherited Members

Inherited methods

Inherited properties

Remarks

Implicit Animations provide a convenient way for developers to create and execute animations without managing them. Implicit animations provide a way of automatically starting animations when an associated property is changed.

Triggers

Condition act as triggers for ImplicitAnimationCollection. These triggers are CompositionObject animatable properties. For Windows 10 Anniversary Update only Visual animatable properties are supported as triggers.

this.FinalValue

This is a special keyword within “Composition Expressions system” that developers can use to template their animations and let the platform bind it to the target property’s API value.

Animations will support this.FinalValue keyword as a valid keyword to signify the final value of a target property for an animation.

  • Implicit Animations – The this.FinalValue will be set to the last value that the corresponding target property was directly assigned to. For instance, when the visual’s Offset property is directly assigned to, implicit animations that target the Offset property will have this.FinalValue set to the new Offset value, of type Vector3. Other implicit animations that target different properties, say Size , will still be able to use the this.FinalValue in the template, and in that case this.FinalValue will be set to the current value of the Size property, of type Vector2. Note that in the latter case this.FinalValue will be the same as this.StartingValue . This provides a well-defined behavior and makes it easy for the developers to author the animation templates as this.FinalValue will always be resolved to a valid value, regardless of which property has triggered the change.
  • Explicit Animations: By default it will have the same behavior as the implicit animation’s case, where this.FinalValue will be set to the last value that the property was directly set to. For example, animations that target the Size property will have this.FinalValue resolved to the last known Size value on the API layer. In other words, this.FinalValue will be the same as this.StartingValue . The developer will be able to override that behavior and set this.FinalValue to a different value by setting it as an animation parameter explicitly.

Events and target properties for ImplicitAnimationCollection and CompositionAnimationGroup

ImplicitAnimationCollection lets you add triggers which implicit animation will monitor for changes and kick off related animations as provided by the developer. ImplicitAnimationCollection supports all Visual animatable properties which are also used as target properties for animations. Target has to be defined on the animation or it will throw an exception.


implicitAnimationCollection[“Offset”] = offsetAnimationGroup;            

CompositionAnimationGroup contains a list of CompositionAnimation where they can be triggered as a single logical unit. Each CompositionAnimation in the group should have the target property set.


CompositionAnimationGroup.Add(opacityKeyFrameAnimation);
CompositionAnimationGroup.Insert(sizeKeyFrameAnimation);

ImplicitAnimationCollection supports the following properties on Visual:

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; 
  } 
} 

Properties

Item[TKey] Item[TKey] Item[TKey]

Gets or sets the element with the specified key.

This member is not implemented in C++TValue this[TKey key] { get; set; }Property Item(key As TKey) As TValue
Parameters
key
TKey TKey TKey

The key of the element to get or set.

Value
TValue TValue TValue

The element with the specified key.

Attributes
Exceptions
System.ArgumentNullException System.ArgumentNullException System.ArgumentNullException

key is null.

System.Collections.Generic.KeyNotFoundException System.Collections.Generic.KeyNotFoundException System.Collections.Generic.KeyNotFoundException

The property is retrieved and key is not found.

System.NotSupportedException System.NotSupportedException System.NotSupportedException

The property is set and the System.Collections.Generic.IDictionary`2 is read-only.

See Also
System.Collections.Generic.ICollection<T>.IsReadOnlySystem.Collections.Generic.ICollection<T>.IsReadOnlySystem.Collections.Generic.ICollection<T>.IsReadOnly

Keys Keys Keys

Gets an System.Collections.Generic.ICollection`1 containing the keys of the System.Collections.Generic.IDictionary`2.

This member is not implemented in C++ICollection<TKey> Keys { get; }ReadOnly Property Keys As ICollection(Of TKey)
Value
System.Collections.Generic.ICollection<TKey> System.Collections.Generic.ICollection<TKey> System.Collections.Generic.ICollection<TKey>

An System.Collections.Generic.ICollection`1 containing the keys of the object that implements System.Collections.Generic.IDictionary`2.

Attributes
See Also
System.Collections.Generic.ICollection<T>System.Collections.Generic.ICollection<T>System.Collections.Generic.ICollection<T>

Size Size Size

The size of the collection.

public unsigned short Size { get; }This member is not implemented in C#This member is not implemented in VB.Net
Value
uint uint uint

The size of the collection.

Attributes

Values Values Values

Gets an System.Collections.Generic.ICollection`1 containing the values in the System.Collections.Generic.IDictionary`2.

This member is not implemented in C++ICollection<TValue> Values { get; }ReadOnly Property Values As ICollection(Of TValue)
Value
System.Collections.Generic.ICollection<TValue> System.Collections.Generic.ICollection<TValue> System.Collections.Generic.ICollection<TValue>

An System.Collections.Generic.ICollection`1 containing the values in the object that implements System.Collections.Generic.IDictionary`2.

Attributes
See Also
System.Collections.Generic.ICollection<T>System.Collections.Generic.ICollection<T>System.Collections.Generic.ICollection<T>

Methods

Add(TKey, TValue) Add(TKey, TValue) Add(TKey, TValue)

Adds an element with the provided key and value to the System.Collections.Generic.IDictionary`2.

This member is not implemented in C++void Add(TKey key, TValue value)Sub Add(key As TKey, value As TValue)
Parameters
key
TKey TKey TKey

The object to use as the key of the element to add.

value
TValue TValue TValue

The object to use as the value of the element to add.

Attributes
Exceptions
System.ArgumentNullException System.ArgumentNullException System.ArgumentNullException

key is null.

System.ArgumentException System.ArgumentException System.ArgumentException

An element with the same key already exists in the System.Collections.Generic.IDictionary`2.

System.NotSupportedException System.NotSupportedException System.NotSupportedException

The System.Collections.Generic.IDictionary`2 is read-only.

See Also
System.Collections.Generic.ICollection<T>.IsReadOnlySystem.Collections.Generic.ICollection<T>.IsReadOnlySystem.Collections.Generic.ICollection<T>.IsReadOnly

Clear() Clear() Clear()

Removes all animations from the collection.

public void Clear()This member is not implemented in C#This member is not implemented in VB.Net
Attributes

ContainsKey(TKey) ContainsKey(TKey) ContainsKey(TKey)

Determines whether the System.Collections.Generic.IDictionary`2 contains an element with the specified key.

This member is not implemented in C++bool ContainsKey(TKey key)Function ContainsKey(key As TKey) As Boolean
Parameters
key
TKey TKey TKey

The key to locate in the System.Collections.Generic.IDictionary`2.

Returns
System.Boolean System.Boolean System.Boolean

true if the System.Collections.Generic.IDictionary`2 contains an element with the key; otherwise, false.

Attributes
Exceptions
System.ArgumentNullException System.ArgumentNullException System.ArgumentNullException

key is null.

First() First() First()

Retrieves the first animation in the collection.

public IIterator<IKeyValuePair<string, ICompositionAnimationBase>> First()This member is not implemented in C#This member is not implemented in VB.Net
Returns

Retrieves the first animation in the collection.

Attributes

GetEnumerator() GetEnumerator() GetEnumerator()

Returns an enumerator that iterates through the collection.

This member is not implemented in C++IEnumerator<T> GetEnumerator()Function GetEnumerator As IEnumerator(Of T)
Returns
System.Collections.Generic.IEnumerator<T> System.Collections.Generic.IEnumerator<T> System.Collections.Generic.IEnumerator<T>

An enumerator that can be used to iterate through the collection.

Attributes
See Also
System.Collections.Generic.IEnumerator<T>System.Collections.Generic.IEnumerator<T>System.Collections.Generic.IEnumerator<T>

GetView() GetView() GetView()

Returns a map view of the collection.

public IMapView<string, ICompositionAnimationBase> GetView()This member is not implemented in C#This member is not implemented in VB.Net
Returns

Returns a map view of the collection.

Attributes

HasKey(String) HasKey(String) HasKey(String)

Returns a boolean indicating whether the collection contains the specified key.

public PlatForm::Boolean HasKey(String key)This member is not implemented in C#This member is not implemented in VB.Net
Parameters
key
System.String System.String System.String

The key to check for.

Returns
bool bool bool

Returns true if the key is in the collection; otherwise returns false.

Attributes

Insert(String, ICompositionAnimationBase) Insert(String, ICompositionAnimationBase) Insert(String, ICompositionAnimationBase)

Inserts an animation into the collection.

public PlatForm::Boolean Insert(String key, ICompositionAnimationBase value)This member is not implemented in C#This member is not implemented in VB.Net
Parameters
key
System.String System.String System.String

The property the animation affects.

Returns
bool bool bool

Boolean value indicating whether the animation was successfully inserted.

Attributes

Lookup(String) Lookup(String) Lookup(String)

Retrieves the animation associated with the specified property.

public ICompositionAnimationBase Lookup(String key)This member is not implemented in C#This member is not implemented in VB.Net
Parameters
key
System.String System.String System.String

The property to lookup.

Returns

The value, if an item with the specified key exists. Use the HasKey method to determine whether the key exists.

Attributes

Remove(TKey) Remove(TKey) Remove(TKey)

Removes the element with the specified key from the System.Collections.Generic.IDictionary`2.

This member is not implemented in C++bool Remove(TKey key)Function Remove(key As TKey) As Boolean
Parameters
key
TKey TKey TKey

The key of the element to remove.

Returns
System.Boolean System.Boolean System.Boolean

true if the element is successfully removed; otherwise, false. This method also returns false if key was not found in the original System.Collections.Generic.IDictionary`2.

Attributes
Exceptions
System.ArgumentNullException System.ArgumentNullException System.ArgumentNullException

key is null.

System.NotSupportedException System.NotSupportedException System.NotSupportedException

The System.Collections.Generic.IDictionary`2 is read-only.

See Also
System.Collections.Generic.ICollection<T>.IsReadOnlySystem.Collections.Generic.ICollection<T>.IsReadOnlySystem.Collections.Generic.ICollection<T>.IsReadOnly

Remove(String) Remove(String) Remove(String)

Removes the specified animation from the collection.

public void Remove(String key)This member is not implemented in C#This member is not implemented in VB.Net
Parameters
key
System.String System.String System.String

The property the animation is assigned to.

Attributes

TryGetValue(TKey, out TValue) TryGetValue(TKey, out TValue) TryGetValue(TKey, out TValue)

Gets the value associated with the specified key.

This member is not implemented in C++bool TryGetValue(TKey key, out TValue value)Function TryGetValue(key As TKey, ByRef value As TValue) As Boolean
Parameters
key
TKey TKey TKey

The key whose value to get.

value
TValue TValue TValue

When this method returns, the value associated with the specified key, if the key is found; otherwise, the default value for the type of the value parameter. This parameter is passed uninitialized.

Returns
System.Boolean System.Boolean System.Boolean

true if the object that implements System.Collections.Generic.IDictionary`2 contains an element with the specified key; otherwise, false.

Attributes
Exceptions
System.ArgumentNullException System.ArgumentNullException System.ArgumentNullException

key is null.