Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

OpacityAnimation class

Applies to Windows only

Provides methods that enable you to retrieve the parameters of an opacity (fade in or fade out) animation.

Syntax


public ref class OpacityAnimation sealed : IPropertyAnimation

Attributes

[DualApiPartition()]
[MarshalingBehavior(Agile)]
[Version(0x06020000)]

Members

The OpacityAnimation class has these types of members:

Methods

The OpacityAnimation class inherits methods from the Object class (C#/VB/C++).

Properties

The OpacityAnimation class has these properties.

PropertyAccess typeDescription

Control1

Read-onlyGets the location of the first control point for the cubic Bézier curve that describes how the opacity should animate over time.

Control2

Read-onlyGets the location of the second control point for the cubic Bézier curve that describes how the opacity should animate over time.

Delay

Read-onlyGets the amount of time between when the opacity animation is instructed to begin and when that animation actually begins to draw.

Duration

Read-onlyGets the amount of time over which the opacity animation should be performed. This does not include the delay.

FinalOpacity

Read-onlyGets the object's final opacity.

InitialOpacity

Read-onlyGets the object's initial opacity.

Type

Read-onlyGets the type of animation represented by this object.

 

Examples

To obtain an instance of the OpacityAnimation class, you first obtain the collection of animations in the animation description, and then walk that array of animations to find any that are of type opacity. The following example shows this process. The effect and target parameters are assumed to have been previously assigned.



var animationDescription = new Windows.UI.Core.AnimationMetrics.AnimationDescription(effect, target);

var animations = animationDescription.animations;
for (var i = 0; i < animations.size; i++) {
    var animation = animations[i];

    switch (animation.type) {
        case animationMetrics.PropertyAnimationType.scale:
            // Retrieve scale animation metrics
            break;
        case animationMetrics.PropertyAnimationType.translation:
            // Retrieve translation animation metrics
            break;
        case animationMetrics.PropertyAnimationType.opacity:
            
            // Retrieve scale animation metrics
            break;
    }
}

The following example shows the C# version of the same code.



using Windows.UI.Core.AnimationMetrics;

AnimationDescription animationDescription = new AnimationDescription(effect, target);
foreach (var animation in animationDescription.Animations)
{
    switch (animation.Type)
    {
        case PropertyAnimationType.Scale:
            {
                ScaleAnimation scale = animation as ScaleAnimation;
                // Retrieve scale animation metrics.
            }
            break;
        case PropertyAnimationType.Translation:
            {
                TranslationAnimation scale = animation as TranslationAnimation;
                // Retrieve translation animation metrics.
            }
            break;
        case PropertyAnimationType.Opacity:
            {
                OpacityAnimation opacity = animation as OpacityAnimation;
                // Retrieve opacity animation metrics.
            }
            break;
    }
}

Requirements

Minimum supported client

Windows 8 [Windows Store apps, desktop apps]

Minimum supported server

Windows Server 2012 [Windows Store apps, desktop apps]

Minimum supported phone

None supported

Namespace

Windows.UI.Core.AnimationMetrics
Windows::UI::Core::AnimationMetrics [C++]

Metadata

Windows.winmd

See also

Animation metrics sample
AnimationDescription

 

 

Show:
© 2014 Microsoft