Skip to content

fix(snackbar): swap enter and exit animation curves #6791

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

Merged
merged 1 commit into from
Oct 12, 2017

Conversation

willshowell
Copy link
Contributor

@googlebot googlebot added the cla: yes PR author has agreed to Google's Contributor License Agreement label Sep 1, 2017
@@ -42,8 +42,8 @@ export type SnackBarState = 'initial' | 'visible' | 'complete' | 'void';

// TODO(jelbourn): we can't use constants from animation.ts here because you can't use
// a text interpolation in anything that is analyzed statically with ngc (for AoT compile).
export const SHOW_ANIMATION = '225ms cubic-bezier(0.4,0.0,1,1)';
export const HIDE_ANIMATION = '195ms cubic-bezier(0.0,0.0,0.2,1)';
export const SHOW_ANIMATION = '375ms cubic-bezier(0.4,0.0,0.2,1)';
Copy link
Member

Choose a reason for hiding this comment

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

As you noted, we are not using the correct easing curves for our animations. However it appears we just have the curves reversed.

From looking at the spec once again:
Entering the screen should use the deceleration curve - cubic-bezier(0.0, 0.0, 0.2, 1)
Permanently leaving the screen should use the acceleration curve - cubic-bezier(0.4, 0.0, 1, 1)

The durations appear to be correct as they are non-complex transitions. These are also guided by the spec found here.

@josephperrott josephperrott self-assigned this Sep 1, 2017
@willshowell
Copy link
Contributor Author

willshowell commented Sep 1, 2017

@josephperrott

Curve

While some of these points are open for interpretation, here's why I think the standard curve is most appropriate:

  1. Most importantly, this defining animation of the standard curve shows a snackbar. (source)

  2. The standard curve should be used when moving other on-screen elements, as the snackbar eventually will do.

    Relative movement (source)
    Entering or exiting elements that move other on-screen elements do so along a smooth easing curve, so that they remain minimally disruptive and avoid eye-catching, dramatic movement.

    The standard curve is used for moving elements both in and out of the bounds of the screen. This curve has a slightly longer duration compared to independent elements.

  3. The snackbar - in all the Material spec animations - is not traveling at peak velocity, a property of the deceleration curve.

    Entering the screen (source)
    Elements entering the screen use the deceleration curve for a speedy entrance, indicating that they had been travelling at peak velocity.

  4. The snackbar is not leaving the screen permanently as use of the acceleration curve would suggest.

    Permanently leaving the screen (source)
    Elements permanently leaving the screen use the acceleration curve to speed off-screen over a slightly shorter duration, as they will not be returning and require less user focus.

Duration

I tried durations of 275ms and 195ms and neither looked like the spec's animations. If you open this animation in VLC, you can see the snackbar is moving for ~12-14 frames, and the video is 30fps. While I agree that the snackbar motion shouldn't be classified as a complex transition, 375ms seemed to best match what I saw in the spec. Further, point 2 above mentions that relative movement should have longer durations.

@willshowell
Copy link
Contributor Author

Hey @josephperrott, as you can see in my last comment, I feel pretty strongly about this 😁. Would it be possible to send a message to the UX team specifically about snackbar curves and durations?

@josephperrott
Copy link
Member

@willshowell sorry for the delay, I actually did as the UX team to get an answer on this one. Ultimately they instructed to use the curves as I outlined in my previous comment:

Entering the screen should use the deceleration curve - cubic-bezier(0.0, 0.0, 0.2, 1)
Permanently leaving the screen should use the acceleration curve - cubic-bezier(0.4, 0.0, 1, 1)

With regards to curves:
I agree with most of your points you outlined in the last update, however I am just following our UX team on this one.

Though I will point out that for #4:

  1. The snackbar is not leaving the screen permanently as use of the acceleration curve would suggest.

Any snackbar that comes back into the screen is actually a newly composed snackbar, even if the content is the same content.

With regards to the timings:
I wouldn't fully trust the frame rate in the animation example videos, though we should be able to start setting the rate of animation based on screen size once #6772 lands.

@willshowell
Copy link
Contributor Author

@josephperrott Thanks for reaching out to them! I'll update it based on your original comment.

@willshowell willshowell force-pushed the fix/snackbar-animation branch from efac170 to 3aa1c27 Compare September 25, 2017 22:40
@willshowell
Copy link
Contributor Author

@josephperrott change made

@willshowell
Copy link
Contributor Author

@josephperrott I've updated this to use the animation constants. Can you take another look?

- Use animation constants for maintainability
@willshowell willshowell force-pushed the fix/snackbar-animation branch from d83f72c to 503677d Compare October 5, 2017 14:20
@willshowell willshowell changed the title fix(snackbar): match spec animations more closely fix(snackbar): swap enter and exit animation curves Oct 5, 2017
Copy link
Member

@josephperrott josephperrott left a comment

Choose a reason for hiding this comment

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

LGTM

@josephperrott josephperrott added pr: lgtm action: merge The PR is ready for merge by the caretaker labels Oct 6, 2017
@andrewseguin andrewseguin merged commit 4f571b1 into angular:master Oct 12, 2017
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 7, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker cla: yes PR author has agreed to Google's Contributor License Agreement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants