src/content/en/shows/cds/2014/the-applied-science-of-runtime-performance.md
project_path: /web/_project.yaml book_path: /web/shows/_book.yaml
{# wf_updated_on: 2015-02-23 #} {# wf_published_on: 2015-02-23 #} {# wf_youtube_id: RCFQu0hK6bU #}
Late last year I built the Chrome Dev Summit{: .external } site. I wanted it to have a Material Design look and feel, since it’s a great design language, and I felt it would be a great fit for the kind of site I wanted to create. But, as with any new design language, there are questions, challenges, and decisions to take, and especially so when dealing with the conventions of the web.
One aspect of the site that was particularly challenging to create was the “takeover” effect when you click on a card.
<p style="text-align: center;"> </p>Getting an effect like this to run at 60fps took some thinking, prototyping, and a few interesting compromises. At Chrome Dev Summit, I spoke about this effect and explained in gory detail how I went about building it.
High performance animations, today at least, are those that favor the browser’s compositor. If you’re able to stick to changing transform and opacity properties, typically you’ll see great performance. The general approach I took to the card animation does just that:
All of this might sound expensive, but there is a window of 100ms from the moment a user interacts before the animation must start. Any more than this and the user will perceive a delay. You can use this time to do expensive preparatory work so that you can run more cheaply during the animation itself. There is also a window at the end of about 50-100ms to do tidy up work, which may be handy depending on what you’re trying to do.
<p style="text-align: center;"> </p>The expensive work to do the animation is done inside that first 100ms and, on a Nexus 5 the work takes something in the region of 70ms, so there’s room to spare.
If you’re interested in looking at the site in more detail you’ll be pleased to hear that the code has been released on GitHub, so go and take a look!