CompositionObject.StartAnimationGroup(ICompositionAnimationBase) メソッド

定義

アニメーション グループを開始します。

CompositionObject の StartAnimationGroup メソッドを使用すると、CompositionAnimationGroup を開始できます。 グループ内のすべてのアニメーションは、オブジェクトで同時に開始されます。

public:
 virtual void StartAnimationGroup(ICompositionAnimationBase ^ value) = StartAnimationGroup;
void StartAnimationGroup(ICompositionAnimationBase const& value);
public void StartAnimationGroup(ICompositionAnimationBase value);
function startAnimationGroup(value)
Public Sub StartAnimationGroup (value As ICompositionAnimationBase)

パラメーター

value
ICompositionAnimationBase

開始するアニメーション グループ。

Windows の要件

デバイス ファミリ
Windows 10 Anniversary Edition (10.0.14393.0 で導入)
API contract
Windows.Foundation.UniversalApiContract (v3.0 で導入)

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

    // Animate multiple properties on the target when the “Offset” property changes. 
    CompositionAnimationGroup animationGroup = compositor.CreateCompositionAnimationGroup();

    animationGroup.Add(CreateSizeAnimation(compositor));
    animationGroup.Add(CreateRotationAnimation(compositor));

    // Set the CenterPoint so that rotation will be around the center
    heroVisual.CenterPoint = new Vector3((heroVisual.Size.X/2.0f), (heroVisual.Size.Y/2.0f), 0.0f);

    // Start AnimationGroup
    heroVisual.StartAnimationGroup(animationGroup);
  }


  Vector2KeyFrameAnimation CreateSizeAnimation(Compositor compositor)
  {
    Vector2KeyFrameAnimation animation  = compositor.CreateVector2KeyFrameAnimation();

    CubicBezierEasingFunction easing = compositor.CreateCubicBezierEasingFunction(new Vector2(0.80f, 0.0f), new Vector2(0.95f, 1.0f));

    // value (as the animation will target on the “Size” property).
    animation.InsertExpressionKeyFrame(0f, "this.StartingValue", easing);
    animation.InsertExpressionKeyFrame(1f, "this.StartingValue * 2", easing);
    animation.Duration = TimeSpan.FromSeconds(0.25);
    animation.Target = “Size”;

    return animation;
  }


  ScalarKeyFrameAnimation CreateRotationAnimation(Compositor compositor)
  {
    ScalarKeyFrameAnimation animation = compositor.CreateScalarKeyFrameAnimation();

    // Create KeyFrameAnimation to animate RotationAngleInDegrees by 90 degrees.	

    animation.InsertExpressionKeyFrame(0f, "this.StartingValue”);
    animation.InsertExpressionKeyFrame(1f, "this.StartingValue + 90.0f”);
    animation.Duration = TimeSpan.FromSeconds(0.25);
    animation.Target = “RotationAngleInDegrees”;

    return animation;
  }
}


注釈

StartAnimationGroup は 、CompositionAnimationGroup をパラメーターとして受け取り、グループ内のすべてのアニメーションをオブジェクトで同時に開始します。 グループ内の CompositionAnimation には、Target プロパティに値が割り当てられている必要があります。

すべてのアニメーションの Completed イベントを取得するには、登録された Completed イベントを含む CompositionScopedBatch から StartAnimationGroup を呼び出す必要があります。

適用対象