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

PERF: paper-ripple sets transform every frame instead of using accelerated animation #67

Open
ebidel opened this issue Jan 3, 2016 · 10 comments

Comments

@ebidel
Copy link
Contributor

ebidel commented Jan 3, 2016

From @danakj on December 18, 2015 23:3

Rather than setting a new scale every frame, the effect would achieve better performance across browsers by using an accelerated animation. This would provide the browser with more hints to avoid re-raster on every frame.

The bug occurs in the drawRipple method https://code.google.com/p/chromium/codesearch#chromium/src/third_party/catapult/third_party/polymer/components/paper-ripple/paper-ripple.html&l=190

It can be reproduced by paper-button/demo.html, which is run by telemetry bots as per https://code.google.com/p/chromium/issues/detail?id=563504#c16

See more details here: https://code.google.com/p/chromium/issues/detail?id=563504#c18

Copied from original issue: Polymer/polymer#3219

@ebidel ebidel changed the title paper-ripple sets transform every frame instead of using accelerated animation PERF: paper-ripple sets transform every frame instead of using accelerated animation Jan 3, 2016
@ebidel
Copy link
Contributor Author

ebidel commented Jan 3, 2016

maybe @cdata @valdrinkoshi @notwaldorf could take a look?

@zmoshansky
Copy link

Also note previous discussion googlearchive/paper-ripple#10. Looks great on desktop, although on Android (Zenfone2) the ripple is very janky. Needs much more butter.

Aside:
That being said, I'm truly blown away (figuratively) by how smooth iron-animated pages and iron-list are on mobile. In a ~1.2 MB app (html & js, pre-gzip), this is one of the few areas that gives away that it could be running non-native. So kudos to the team for that and all the hard work.

@ebidel
Copy link
Contributor Author

ebidel commented Mar 10, 2016

ping

@kristfal
Copy link

I'll jump the bandwagon and ping again. Any movement? Would a PR be welcome, or would you prefer doing this in house?

@ebidel
Copy link
Contributor Author

ebidel commented May 25, 2016

I think a PR would be welcome at this point :)

@danbeam
Copy link
Contributor

danbeam commented Nov 30, 2016

@tjsavage

@danbeam
Copy link
Contributor

danbeam commented Nov 30, 2016

/cc @frankiefu as well

some ideas:

  1. detect whether Element#animate() exists and use it
  2. set less .style properties (i.e. only set a 2D webkitTransform in Safari and skip duplicative .style.transform which was unprefixed in Chrome 36)
  3. set .style values to the destination radius and rely on transition or @keyframes rather than continually using requestAnimationFrame (and canceling on up by changing .style.animationName or the .style.transition properties, possibly polyfilling transitionend for cancels)

@LarsDenBakker
Copy link

Any update on this?

@danbeam
Copy link
Contributor

danbeam commented Jun 26, 2017

I haven't been pushing on this hard because Chrome wrote it's own ripple via Web Animations API (i.e. Element#animate).
https://cs.chromium.org/chromium/src/third_party/polymer/v1_0/components-chromium/paper-ripple/

@blasten wrote a few branches with faster ripples which might actually work in other browsers:
https://github.com/PolymerElements/paper-ripple/compare/fast-ripple
https://github.com/PolymerElements/paper-ripple/compare/fast-ripple-2

@LarsDenBakker
Copy link

That's useful information, thanks!

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

No branches or pull requests

6 participants