CompositionObject.StartAnimation メソッド

定義

オーバーロード

StartAnimation(String, CompositionAnimation)

アニメーションをオブジェクトの指定したプロパティに接続し、アニメーションを開始します。

StartAnimation(String, CompositionAnimation, AnimationController)

アニメーションをオブジェクトの指定したプロパティに接続し、アニメーションを開始します。

StartAnimation(String, CompositionAnimation)

アニメーションをオブジェクトの指定したプロパティに接続し、アニメーションを開始します。

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)

パラメーター

propertyName
String

Platform::String

winrt::hstring

アニメーションを関連付けるプロパティ。

animation
CompositionAnimation

指定したプロパティに関連付けるアニメーション。

Windows の要件

デバイス ファミリ
Windows 10 (10.0.10586.0 で導入)
API contract
Windows.Foundation.UniversalApiContract (v2.0 で導入)

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

注釈

StartAnimation が呼び出されたときにアニメーションがオブジェクトのプロパティに既にバインドされている場合、前に適用されたアニメーションは切断され、新しいアニメーションが割り当てられます。 同様に、 プロパティを直接設定すると、前のアニメーションが切断され、新しいプロパティ値が有効になります。

次の表に、アニメーション化可能なプロパティの一覧を示します。

Object プロパティ名 プロパティの種類
Visual AnchorPoint Vector2
CenterPoint Vector3
Offset Vector3
Opacity スカラー
Orientation Vector4
RotationAngle スカラー
RotationAxis Vector3
[サイズ] Vector2
TransformMatrix Matrix4x4
InsetClip BottomInset スカラー
LeftInset スカラー
RightInset スカラー
TopInset スカラー
CompositionColorBrush Color Windows.UI.Color
CompositionPropertySet 開発者によって指定されたプロパティのセット。

さらに、 CompositionEffectBrush オブジェクトの下にある一部の効果のプロパティをアニメーション化できます。

効果名 プロパティ名 プロパティの種類
SaturationEffect [鮮やかさ] スカラー
ColorSourceEffect Color Vector4
ArithmeticComposite Offset スカラー
Source1Amount スカラー
Source2Amount スカラー
MultiplyAmount スカラー
Transform2D TransformMatrix Matrix3x2
ContrastEffect この例を、 Float
ExposureEffect 露出 Float
HueRotationEffect Angle Float
SepiaEffect 強度 Float
TemperatureAndTintEffect 気温 Float
色合い Float
GammaTransferEffect RedAmplitude Float
RedExponent Float
RedOffset Float
GreenAmplitude Float
GreenExponent Float
GreenOffset Float
BlueAmplitude Float
BlueExponent Float
BlueOffset Float
AlphaAmplitude Float
AlphaExponent Float
AlphaOffset Float

適用対象

StartAnimation(String, CompositionAnimation, AnimationController)

アニメーションをオブジェクトの指定したプロパティに接続し、アニメーションを開始します。

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)

パラメーター

propertyName
String

Platform::String

winrt::hstring

アニメーションを関連付けるプロパティ。

animation
CompositionAnimation

指定したプロパティに関連付けるアニメーション。

animationController
AnimationController

アニメーションに関連付けるアニメーション コントローラー。

属性

Windows の要件

デバイス ファミリ
Windows 11 Insider Preview (10.0.23504.0 で導入)
API contract
Windows.Foundation.UniversalApiContract (v15.0 で導入)

注釈

animationControllerパラメーターを使用すると、複数のアニメーションを 1 つのコントローラーの Progress プロパティにバインドできます。必要な ExpressionAnimation オブジェクトは、複数のアニメーターのProgressプロパティを CompositionObject プロパティにバインドするよりも少なくなります。

適用対象