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

Performance Improvement Hints (will-change) #537

Closed
klopfdreh opened this issue Feb 18, 2016 · 8 comments
Closed

Performance Improvement Hints (will-change) #537

klopfdreh opened this issue Feb 18, 2016 · 8 comments

Comments

@klopfdreh
Copy link

Hi,

I just read an article at developers.google.com about a new property which might improve the performance of the animations provided via animate.css.

So maybe it would be good "tell" the browsers what you are planing to do. Example:

.fadeInLeft {
   will-change: transform, opacity;
}

References:

@klopfdreh klopfdreh changed the title Performance Improvement Hints Performance Improvement Hints (will-change) Feb 18, 2016
@klopfdreh
Copy link
Author

If this has any relevance for you I may create a pull request and take over the work.

klopfdreh added a commit to klopfdreh/animate.css that referenced this issue Feb 18, 2016
@klopfdreh
Copy link
Author

To free the required resources we could also add a keyframe at 100% and set will-change back to auto

@keyframe myFrame{
   100%{
      will-change: auto;
   }
}

See Examples: https://developer.mozilla.org/en/docs/Web/CSS/will-change - auto is used to removeHint.

klopfdreh added a commit to klopfdreh/animate.css that referenced this issue Feb 18, 2016
klopfdreh added a commit to klopfdreh/animate.css that referenced this issue Feb 19, 2016
@klopfdreh
Copy link
Author

Hi,

I change the behavior a bit, because as of the spec: https://www.w3.org/TR/css-will-change-1/

will-change should be applied a short time before the animation actually starts. So what to do now is:

  1. Create your element with an so called animation hint: <effectname>Hint (fadeInRightHint)
  2. Add your Animation via the corresponding class with jQuery or other frameworks

You can let away the hint - then the animation is handled like before. Here are the states:

During the page rendering

<div class="fadeInRightHint">...</div>

On event (scroll, hover or what ever)

<div class="fadeInRightHint fadeInRight animated">...</div>

The hint can be removed on event but I think it is not required because the keyframe overrides it.

@tnga
Copy link

tnga commented Feb 23, 2016

interresting is it ; but with your second implementation approch it can make the animate.css usage too verbose.

@klopfdreh
Copy link
Author

Well the hint is optional, so if you don't need a better performance you can let them away. If you face performance issue you can use them. It has to be a class for each animation, because every animation is using different css properties to be changed and because of the spec it should used wisely - that is the reason why I defined them for each animation class.

@equinusocio
Copy link

@klopfdreh You have to put will-change before the animation starting (in this case on another class), so the only CSS solutions is to tell users how to use the will-change property. I think the README file is a good place.

@klopfdreh
Copy link
Author

klopfdreh commented Apr 14, 2016

@equinusocio : It is always <animation_name>Hint as you can see in the commit

@eltonmesquita
Copy link
Collaborator

I've got to agree with @equinusocio here. It'll probably confuse more than help the beginner users and it has a potential to harm performance or even cause browser crashing (run out of GPU memory).
I do think it has a well deserved place in documentation. Please, see #681.

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

4 participants