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

Add an animation to pane entrance/exit #7364

Merged
23 commits merged into from
Oct 9, 2020
Merged

Conversation

zadjii-msft
Copy link
Member

@zadjii-msft zadjii-msft commented Aug 21, 2020

Adds an entrance animation when panes are created. This animation can be
disabled with the disableAnimations global setting.

Although the XAML animation documentation was pretty heavy on the do it
in XAML
route, our panes are created pretty much entirely in code, so
we've got to create the animations in code as well.

200ms as the duration of the animation was picked super arbitrarily.
300ms felt too long, and 166ms felt like it was only visible for a
single frame.

see also:

Validation Steps Performed

Man have I been opening panes

Closes #1001
Closes #7366

@ghost ghost added Area-User Interface Issues pertaining to the user interface of the Console or Terminal Issue-Feature Complex enough to require an in depth planning process and actual budgeted, scheduled work. Product-Terminal The new Windows Terminal. labels Aug 21, 2020
@zadjii-msft zadjii-msft changed the title Add a aniamtion to pane entrance Add a animation to pane entrance Aug 21, 2020
@miniksa
Copy link
Member

miniksa commented Aug 21, 2020

What about the reverse animation on close pane?

@zadjii-msft
Copy link
Member Author

@miniksa

What about the reverse animation on close pane?

That's #7366 😉

Copy link
Member

@miniksa miniksa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code looks fine. I just had the one comment I left outside. I feel like the animations should be paired (in and out) before merge.

…animations-2020

# Conflicts:
#	src/cascadia/TerminalApp/GlobalAppSettings.cpp
#	src/cascadia/TerminalApp/GlobalAppSettings.h
@zadjii-msft
Copy link
Member Author

Alright so regarding animating the closing of panes.

This will be extra tricky. The simplest way to do it seems like it would be to:

  • In _ChildCloseRoutine, setup and start the animation
  • then on the completion of the animation, call _CloseChild to reparent the remaining panes, their controls, etc.

But that won't actually work for us. If we leave the row/col definitions untouched for the parent when one of their children closes, then even if we make the other child bigger, the child only has half the parent to work with. So the child will get bigger, but still be clipped by the existing rol/col defs

Oh but what if we

  • Remove the closed pane's grid from the parent
  • add a dummy grid in its place
  • set the parent pane's row/col defs to be auto sized, so they're as big as the content
  • animate the remaining pane growing to 100% size
  • animate the dummy grid shrinking in size to 0%
  • pre-resize the remaining pane (& all descendants) to the full size they will have. We'll set their size manually here.
  • start the animation.
  • on completion:
    • remove all the manually set sizes from the remaining pane (& descendants)
    • call _CloseChild to move the content from the remaining pane into the parent (this should be seamless)

Alright so I was about to say "this is too hard for us to do now", but with the auto-sizing of the parent grid this could be possible.

@aharpervc
Copy link

Does this feature honor the "Show animations in Windows" setting (which also powers prefers-reduced-motion in browsers)?

@zadjii-msft
Copy link
Member Author

@miniksa you wanted closing animations? You get closing animations
pane-closing-animation

@zadjii-msft
Copy link
Member Author

zadjii-msft commented Aug 27, 2020

Does this feature honor the "Show animations in Windows" setting (which also powers prefers-reduced-motion in browsers)?

Weird, this doesn't. But the new tab menu flyout does.

But if you disable animations app-wide with AllowDependentAnimations(false), and enable animations in windows, then the Pane animation doesn't run (expected), but the new tab menu does animate (unexpected). Same behavior with the command palette - it animates even with AllowDependentAnimations(false)

I wonder why that is. I'm gonna ping some XAML folks internally for some answers on this.

@ghost ghost added the Issue-Task It's a feature request, but it doesn't really need a major design. label Aug 27, 2020
Copy link
Member

@DHowett DHowett left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd definitely like for us to follow the system API -- there was an e-mail about how we can do it, so I'm gonna block for that and my couple comments.

I won't be around on Friday or Monday. I give permission to clear my review if they are fixed. I sign off apart from that.

I understand why we want a separate setting. It does feel weird though.


// Create the dummy grid. This grid will be the one we actually animate,
// in the place of the closed pane.
Controls::Grid dummyGrid;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't this be a border? we'll never use its containment properties..

idk, nit

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Still curious tho)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just went with a Grid because that's my mental go-to "I need a 2d space" control. Is there a real difference the way I'm using this?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

naw

src/cascadia/TerminalApp/Pane.cpp Outdated Show resolved Hide resolved
src/cascadia/TerminalApp/Pane.cpp Outdated Show resolved Hide resolved
src/cascadia/TerminalApp/Pane.cpp Outdated Show resolved Hide resolved
@ghost ghost added the Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something label Aug 28, 2020
@ghost ghost removed the Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something label Aug 28, 2020
@zadjii-msft
Copy link
Member Author

@DHowett Hey turns out I did the OS setting thing right before I went on leave, wanna take another look?

Copy link
Member

@DHowett DHowett left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Augh! Sorry Mike. I wrote up comments and NEVER HIT SUBMIT

// 200ms was chosen because it's quick enough that it doesn't break your
// flow, but not too quick to see
static const int AnimationDurationInMilliseconds = 200;
static const Duration AnimationDuration = DurationHelper::FromTimeSpan(winrt::Windows::Foundation::TimeSpan(std::chrono::milliseconds(AnimationDurationInMilliseconds)));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the annoying bit here is that this has to be constructed during llibrary initialization :(


// Create the dummy grid. This grid will be the one we actually animate,
// in the place of the closed pane.
Controls::Grid dummyGrid;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Still curious tho)

@DHowett
Copy link
Member

DHowett commented Oct 9, 2020

/azp run


// Create the dummy grid. This grid will be the one we actually animate,
// in the place of the closed pane.
Controls::Grid dummyGrid;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

naw

@DHowett DHowett changed the title Add a animation to pane entrance Add an animation to pane entrance/exit Oct 9, 2020
@DHowett DHowett added the AutoMerge Marked for automatic merge by the bot when requirements are met label Oct 9, 2020
@DHowett DHowett removed their assignment Oct 9, 2020
@DHowett
Copy link
Member

DHowett commented Oct 9, 2020

COPIED FROM BODY


Yesterday, I day-of-learned about animation in XAML. The result?

Summary of the Pull Request

Adds an entrance animation when panes are created. This animation can be disabled with the disableAnimations global setting.

pane-animation-pr

and in 60FPS:
pane-animation-60fps
(though, playing that back, I might have the gif sped up a tad bit...)

References

PR Checklist

Detailed Description of the Pull Request / Additional comments

Although the XAML animation documentation was pretty heavy on the do it in XAML route, our panes are created pretty much entirely in code, so we've got to create the animations in code as well.

200ms as the duration of the animation was picked super arbitrarily. 300ms felt too long, and 166ms felt like it was only visible for a single frame.

see also:

Validation Steps Performed

Man have I been opening panes

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@ghost
Copy link

ghost commented Oct 9, 2020

Hello @DHowett!

Because this pull request has the AutoMerge label, I will be glad to assist with helping to merge this pull request once all check-in policies pass.

p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (@msftbot) and give me an instruction to get started! Learn more here.

@ghost ghost merged commit 9dc38ad into master Oct 9, 2020
@ghost ghost deleted the dev/migrie/f/panes-animations-2020 branch October 9, 2020 23:06
skyline75489 pushed a commit to skyline75489/terminal that referenced this pull request Oct 10, 2020
Adds an entrance animation when panes are created. This animation can be
disabled with the `disableAnimations` global setting. 

Although the XAML animation documentation was pretty heavy on the _do it
in XAML_ route, our panes are created pretty much entirely in code, so
we've got to create the animations in code as well. 

200ms as the duration of the animation was picked _super_ arbitrarily.
300ms felt too long, and 166ms felt like it was only visible for a
single frame. 

see also:
* [Motion in practice](https://docs.microsoft.com/en-us/windows/uwp/design/motion/motion-in-practice)
* [This example](https://docs.microsoft.com/en-us/uwp/api/Windows.UI.Xaml.Media.Animation.Storyboard?view=winrt-19041#examples) what what I ended up using, albeit ported to cppwinrt.
* [`Timeline.AllowDependentAnimations`](https://docs.microsoft.com/en-us/uwp/api/windows.ui.xaml.media.animation.timeline.allowdependentanimations?view=winrt-19041#Windows_UI_Xaml_Media_Animation_Timeline_AllowDependentAnimations)
* [easing functions](https://docs.microsoft.com/en-us/windows/uwp/design/motion/key-frame-and-easing-function-animations#easing-functions)

## Validation Steps Performed
Man have I been opening panes

Closes microsoft#1001
Closes microsoft#7366
carlos-zamora added a commit that referenced this pull request Oct 30, 2020
## Summary of the Pull Request
Since we've started working on the Settings UI, a few settings have been added on `main`. This adds those missing settings over. 

## References
Missing settings include...
- #7364: `disableAnimations`
- #7873: `launchMode` `focus` and `maximizedFocus`
- #7793: `bellStyle`

## Validation Steps Performed
Verified that those settings appear properly in the Settings UI.
@ghost
Copy link

ghost commented Nov 11, 2020

🎉Windows Terminal Preview v1.5.3142.0 has been released which incorporates this pull request.:tada:

Handy links:

This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-User Interface Issues pertaining to the user interface of the Console or Terminal AutoMerge Marked for automatic merge by the bot when requirements are met Issue-Feature Complex enough to require an in depth planning process and actual budgeted, scheduled work. Issue-Task It's a feature request, but it doesn't really need a major design. Needs-Second It's a PR that needs another sign-off Priority-3 A description (P3) Product-Terminal The new Windows Terminal.
Projects
None yet
6 participants