Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WindowsComposition Animation End Event missing. #352

Open
selastingeorge opened this issue Apr 3, 2021 · 1 comment
Open

WindowsComposition Animation End Event missing. #352

selastingeorge opened this issue Apr 3, 2021 · 1 comment

Comments

@selastingeorge
Copy link

I have been using Winrt with WPF to create the acrylic effect on wpf. I managed to fix the Aerospace issue by drawing the acrylic into a separate window and overlapping my content window on top of it, both windows are synced to move or resize together, but for the acrylic layer not to flicker i have to create Transparent Window, So i lost the Window Animations, currently i am trying to recreate the window Maximize and Restore animations, I Use the Winrt API for animating the Acrylic Visual Layer, I successfully created the window Maximize animation, but in window restore animation i need a way to know when the animation is finished. I have Raided the entire class and doesn't found an event listener for animation. Here are the Codes,

The Code for maximize animation :

public void animateMaximize()
{
     var sampleAnim= _compositor.CreateVector3KeyFrameAnimation();
     sampleAnim.InsertKeyFrame(0f, new Vector3(0.9f));
     sampleAnim.InsertKeyFrame(1.0f, new Vector3(1.0f));
     sampleAnim.Duration = TimeSpan.FromMilliseconds(350);
     _acrylicVisual.CenterPoint = new Vector3(_acrylicVisual.Size.X / 2, _acrylicVisual.Size.Y / 2, 0.0f);
     _acrylicVisual.StartAnimation("Scale", sampleAnim);
}

The Code for restore animation :

public void animateRestore()
{
     var sampleAnim= _compositor.CreateVector3KeyFrameAnimation();
     sampleAnim.InsertKeyFrame(0f, new Vector3(1.0f));
     sampleAnim.InsertKeyFrame(1.0f, new Vector3(0.9f));
     sampleAnim.Duration = TimeSpan.FromMilliseconds(350);
     _acrylicVisual.CenterPoint = new Vector3(_acrylicVisual.Size.X / 2, _acrylicVisual.Size.Y / 2, 0.0f);
     _acrylicVisual.StartAnimation("Scale", sampleAnim);
}

So I need a method, or a way to find when the sampleAnim finishes.
if a reference to any docs on this is available please share it. Or Does Windows.UI.Composition Does not support These Methods.

@JohnnyWestlake
Copy link

This can be accomplished using CompositionScopedBatch https://docs.microsoft.com/en-us/uwp/api/windows.ui.composition.compositionscopedbatch?view=winrt-19041

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants