Tracking changes when animating with Windows.UI.Composition.CompositionPropertySet

Frederic Goulet 21 Reputation points
2020-12-30T20:01:27.677+00:00

Hello,

Is there a way to have a function called with the value of 'prop' everytime the CompositionPropertySet property is animated ?

Thanks !

var compositor = new Windows.UI.Composition.Compositor();

var propertySet= compositor.CreatePropertySet();
propertySet.InsertVector2("prop", new Vector2(50.0f, 50.0f));

var animation = compositor.CreateVector2KeyFrameAnimation();
animation.InsertKeyFrame(0.00f, new Vector2(50.0f, 50.0f));
animation.InsertKeyFrame(0.25f, new Vector2(75.0f, 75.0f));
animation.InsertKeyFrame(0.50f, new Vector2(100.0f, 75.0f));
animation.Duration = TimeSpan.FromMilliseconds(4000);
animation.IterationCount = 3;

propertySet.StartAnimation("prop", animation);
Universal Windows Platform (UWP)
0 comments No comments
{count} votes

Accepted answer
  1. Roy Li - MSFT 29,866 Reputation points Microsoft Vendor
    2020-12-31T03:00:22.11+00:00

    Hello,

    Welcome to Microsoft Q&A!

    Is there a way to have a function called with the value of 'prop' everytime the CompositionPropertySet property is animated ?

    No, currently there is no such event or function. My suggestion is that you could create a target function yourself. Then check the value when you call the StartAnimation() method and call the target function manually when you found the value is prop.

    Thank you.


    If the response is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


0 additional answers

Sort by: Most helpful