SlideShare a Scribd company logo
HTML version of slides: http://people.mozilla.org/~bbirtles/pres/graphical-web-2014/
Animations can be used for more than just cat gifs. 
They can be used to tell stories too.
Animation is essentially about using time 
to convey information.
Animation can be used as component of user interface design to describe the results of an action.
It can be more intuitive without cluttering the screen or requiring extra explanation.
But when animation runs slowly or hesitates, that information is lost. 
Hence for animation, performance is critical. 
In order to fix animation performance in Web pages, we really need to understand how browsers work.
As we follow the journey from markup to our eyeballs, we will consider how we can make each step smoother or skip it all together.
Parsing can be slow. Most browsers do it in a separate thread. 
If we skip parsing while animating surely it goes faster?
A micro-benchmark suggests an API that skips parsing is faster.
How about in a real-world animation?
It doesn’t make a lot of difference. Perhaps 3~4 fps at best.
There are bigger performance gains to be had from the style system. 
After creating a DOM tree, browsers construct a render tree suitable for painting to the screen.
What happens if we exploit the fact that display:none elements don’t appear in the render tree?
(Firefox doesn’t show such a big difference in this case since the test case animates ‘top’ which, as we’ll see, does not trigger reflow in Firefox so setting display:none doesn’t have as big an impact.)
This technique improved performance for the Parapara animation project where characters are set to display:none when they are off-stage.
Of the operations performed in the style system, the layout/reflow step is often expensive.
We can measure style resolution and layout time in profiling tools in Firefox (above) and Chrome (below).
Firefox lets you inspect reflow (layout) in the console.
Let’s see how different animations affect layout
Animating margin-top causes reflow on every frame
But in Firefox, animating top or transform does not trigger reflow (layout)
Comparing the performance of margin-top and transform, transform is faster because it avoids reflow but it also benefits from layerization which we will see later.
Since these processes can be expensive, browsers avoid doing them until either they have to paint, or until script asks a question about the current state.
Painting is often the most expensive part. Firefox creates a display list of items to paint, then creates a layer tree into which it paints. The layers in the tree are then composited together.
We can see exactly what area is being painted
When animating transform we only paint once at the start. 
This is because it gets put in its own layer.
When animating independent areas Chrome seems to paint the union of dirty areas so layerization can be more important there.
However, SVG filters are often hardware accelerated. 
Sometimes the combination of features is what is slow.
We can sometimes make things faster by pre-rendering. 
Desktop apps, native apps, Flash apps, everyone does it.
Alternatively, for SVG, simply referring to the SVG using <img> instead of <iframe> lets the browser make more optimizations. Especially Firefox.
Most browsers hardware accelerate layer compositing. 
That means they can often paint an animated element once then just change its transform, opacity etc. and let the GPU re-composite. 
That saves a lot of painting.
It’s up to the browser what gets a layer. 
Typically it’s things like the above.
Firefox OS
In the previous example, we can see why the transform animation only gets painted once. That element has its own layer.
Layerization is performed by the browser so it can automatically do it for SVG (SMIL) animation too.
And even for scripted animation, the browser can detect that an element is moving a lot and decide it would benefit from being on a separate layer. 
(The red boxes in this example indicate image layers.)
Often, however, the browser won’t create a layer until an element starts animating. Sometimes that can be too late and can cause the animation to stutter at the start as the browser sets up the layer.
will-change:transform/ opacity/etc. lets the browser create the layer in advance if it thinks that would help improve performance. 
transform:translateZ(0) doesn’t work cross- browser
Apart from low frame-rates, animation performance is affected by other processes on the same thread like layout, garbage collection, or other scripts, that cause the animation to stop and start (jank).
To avoid jank, some animations can be run on a separate thread/process.
Unlike animations running on the main thread which stop and start…
… these animations continue along uninterrupted.
But not everything can be animated in this way. 
In particular, when the browser doesn’t know all the parameters of the animation—like most scripted animations—the browser can’t delegate the animation to another thread/process.
One way around this is to use the Web Animations API to create animations. 
This lets the browser optimize the animation in the same way as it does for declarative animations like CSS Animations/Transitions.
Summarizing our journey…
Using our knowledge of how browsers work we can make animations that run smoothly on any browser on any device and convey their intended effect.
HTML version of slides: http://people.mozilla.org/~bbirtles/pres/graphical-web-2014/

More Related Content

What's hot

海外ゲーム技術勉強会#1 OGRE3D
海外ゲーム技術勉強会#1 OGRE3D海外ゲーム技術勉強会#1 OGRE3D
海外ゲーム技術勉強会#1 OGRE3D
Kazuhisa Minato
 
오승준, 사회적 기술이 프로그래머 인생을 바꿔주는 이유, NDC2011
오승준, 사회적 기술이 프로그래머 인생을 바꿔주는 이유, NDC2011오승준, 사회적 기술이 프로그래머 인생을 바꿔주는 이유, NDC2011
오승준, 사회적 기술이 프로그래머 인생을 바꿔주는 이유, NDC2011devCAT Studio, NEXON
 
김혁, <드래곤 하운드>의 PBR과 레이트레이싱 렌더링 기법, NDC2019
김혁, <드래곤 하운드>의 PBR과 레이트레이싱 렌더링 기법, NDC2019김혁, <드래곤 하운드>의 PBR과 레이트레이싱 렌더링 기법, NDC2019
김혁, <드래곤 하운드>의 PBR과 레이트레이싱 렌더링 기법, NDC2019
devCAT Studio, NEXON
 
Webデザインのための配色セオリー
Webデザインのための配色セオリーWebデザインのための配色セオリー
Webデザインのための配色セオリー
webcampusschoo
 
리얼타임 렌더링에 대해
리얼타임 렌더링에 대해리얼타임 렌더링에 대해
리얼타임 렌더링에 대해
필성 권
 
Putting the AI Back Into Air: Navigating the Air Space of Horizon Zero Dawn
Putting the AI Back Into Air: Navigating the Air Space of Horizon Zero DawnPutting the AI Back Into Air: Navigating the Air Space of Horizon Zero Dawn
Putting the AI Back Into Air: Navigating the Air Space of Horizon Zero Dawn
Guerrilla
 
Screen space reflection
Screen space reflectionScreen space reflection
Screen space reflection
Bongseok Cho
 
[150124 박민근] 모바일 게임 개발에서 루아 스크립트 활용하기
[150124 박민근] 모바일 게임 개발에서 루아 스크립트 활용하기[150124 박민근] 모바일 게임 개발에서 루아 스크립트 활용하기
[150124 박민근] 모바일 게임 개발에서 루아 스크립트 활용하기
MinGeun Park
 
유니티에서 MMD 사용해보기
유니티에서 MMD 사용해보기유니티에서 MMD 사용해보기
유니티에서 MMD 사용해보기
flashscope
 
NDC2013 - 인디게임 프로젝트 중도에 포기하지 않는 방법
NDC2013 - 인디게임 프로젝트 중도에 포기하지 않는 방법NDC2013 - 인디게임 프로젝트 중도에 포기하지 않는 방법
NDC2013 - 인디게임 프로젝트 중도에 포기하지 않는 방법ChangHyun Won
 
TensorFlowで訓練したLINE BotをAWS Lambdaで動かしてみた
TensorFlowで訓練したLINE BotをAWS Lambdaで動かしてみたTensorFlowで訓練したLINE BotをAWS Lambdaで動かしてみた
TensorFlowで訓練したLINE BotをAWS Lambdaで動かしてみた
Van Huy
 
Ndc2012 최지호 텍스쳐 압축 기법 소개
Ndc2012 최지호 텍스쳐 압축 기법 소개Ndc2012 최지호 텍스쳐 압축 기법 소개
Ndc2012 최지호 텍스쳐 압축 기법 소개Jiho Choi
 
モバイル通信を使わない 近接端末間通信対戦のレシピ
モバイル通信を使わない 近接端末間通信対戦のレシピモバイル通信を使わない 近接端末間通信対戦のレシピ
モバイル通信を使わない 近接端末間通信対戦のレシピ
NakamuraTaro
 
Raster graphics
Raster graphicsRaster graphics
Raster graphicslenance
 
Machinationの紹介
Machinationの紹介Machinationの紹介
Machinationの紹介
Kazuhisa Minato
 
Hable John Uncharted2 Hdr Lighting
Hable John Uncharted2 Hdr LightingHable John Uncharted2 Hdr Lighting
Hable John Uncharted2 Hdr Lighting
ozlael ozlael
 
Shadow mapping 정리
Shadow mapping 정리Shadow mapping 정리
Shadow mapping 정리
changehee lee
 
[2012 대학특강] 아티스트 + 프로그래머
[2012 대학특강] 아티스트 + 프로그래머[2012 대학특강] 아티스트 + 프로그래머
[2012 대학특강] 아티스트 + 프로그래머
포프 김
 
3D Animation Process and Workflow
3D Animation Process and Workflow3D Animation Process and Workflow
3D Animation Process and Workflow
Gridway Digital
 

What's hot (20)

海外ゲーム技術勉強会#1 OGRE3D
海外ゲーム技術勉強会#1 OGRE3D海外ゲーム技術勉強会#1 OGRE3D
海外ゲーム技術勉強会#1 OGRE3D
 
오승준, 사회적 기술이 프로그래머 인생을 바꿔주는 이유, NDC2011
오승준, 사회적 기술이 프로그래머 인생을 바꿔주는 이유, NDC2011오승준, 사회적 기술이 프로그래머 인생을 바꿔주는 이유, NDC2011
오승준, 사회적 기술이 프로그래머 인생을 바꿔주는 이유, NDC2011
 
김혁, <드래곤 하운드>의 PBR과 레이트레이싱 렌더링 기법, NDC2019
김혁, <드래곤 하운드>의 PBR과 레이트레이싱 렌더링 기법, NDC2019김혁, <드래곤 하운드>의 PBR과 레이트레이싱 렌더링 기법, NDC2019
김혁, <드래곤 하운드>의 PBR과 레이트레이싱 렌더링 기법, NDC2019
 
Webデザインのための配色セオリー
Webデザインのための配色セオリーWebデザインのための配色セオリー
Webデザインのための配色セオリー
 
카툰 렌더링
카툰 렌더링카툰 렌더링
카툰 렌더링
 
리얼타임 렌더링에 대해
리얼타임 렌더링에 대해리얼타임 렌더링에 대해
리얼타임 렌더링에 대해
 
Putting the AI Back Into Air: Navigating the Air Space of Horizon Zero Dawn
Putting the AI Back Into Air: Navigating the Air Space of Horizon Zero DawnPutting the AI Back Into Air: Navigating the Air Space of Horizon Zero Dawn
Putting the AI Back Into Air: Navigating the Air Space of Horizon Zero Dawn
 
Screen space reflection
Screen space reflectionScreen space reflection
Screen space reflection
 
[150124 박민근] 모바일 게임 개발에서 루아 스크립트 활용하기
[150124 박민근] 모바일 게임 개발에서 루아 스크립트 활용하기[150124 박민근] 모바일 게임 개발에서 루아 스크립트 활용하기
[150124 박민근] 모바일 게임 개발에서 루아 스크립트 활용하기
 
유니티에서 MMD 사용해보기
유니티에서 MMD 사용해보기유니티에서 MMD 사용해보기
유니티에서 MMD 사용해보기
 
NDC2013 - 인디게임 프로젝트 중도에 포기하지 않는 방법
NDC2013 - 인디게임 프로젝트 중도에 포기하지 않는 방법NDC2013 - 인디게임 프로젝트 중도에 포기하지 않는 방법
NDC2013 - 인디게임 프로젝트 중도에 포기하지 않는 방법
 
TensorFlowで訓練したLINE BotをAWS Lambdaで動かしてみた
TensorFlowで訓練したLINE BotをAWS Lambdaで動かしてみたTensorFlowで訓練したLINE BotをAWS Lambdaで動かしてみた
TensorFlowで訓練したLINE BotをAWS Lambdaで動かしてみた
 
Ndc2012 최지호 텍스쳐 압축 기법 소개
Ndc2012 최지호 텍스쳐 압축 기법 소개Ndc2012 최지호 텍스쳐 압축 기법 소개
Ndc2012 최지호 텍스쳐 압축 기법 소개
 
モバイル通信を使わない 近接端末間通信対戦のレシピ
モバイル通信を使わない 近接端末間通信対戦のレシピモバイル通信を使わない 近接端末間通信対戦のレシピ
モバイル通信を使わない 近接端末間通信対戦のレシピ
 
Raster graphics
Raster graphicsRaster graphics
Raster graphics
 
Machinationの紹介
Machinationの紹介Machinationの紹介
Machinationの紹介
 
Hable John Uncharted2 Hdr Lighting
Hable John Uncharted2 Hdr LightingHable John Uncharted2 Hdr Lighting
Hable John Uncharted2 Hdr Lighting
 
Shadow mapping 정리
Shadow mapping 정리Shadow mapping 정리
Shadow mapping 정리
 
[2012 대학특강] 아티스트 + 프로그래머
[2012 대학특강] 아티스트 + 프로그래머[2012 대학특강] 아티스트 + 프로그래머
[2012 대학특강] 아티스트 + 프로그래머
 
3D Animation Process and Workflow
3D Animation Process and Workflow3D Animation Process and Workflow
3D Animation Process and Workflow
 

Viewers also liked

Logiciel diagramme
Logiciel diagramme Logiciel diagramme
Logiciel diagramme
Hicham Amar
 
Serious Animation (an introduction to Web Animations)
Serious Animation (an introduction to Web Animations)Serious Animation (an introduction to Web Animations)
Serious Animation (an introduction to Web Animations)
brianskold
 
Vision 2030: Gauteng Provincial Fire & Rescue Services - RG Hendricks
Vision 2030: Gauteng Provincial Fire & Rescue Services - RG HendricksVision 2030: Gauteng Provincial Fire & Rescue Services - RG Hendricks
Vision 2030: Gauteng Provincial Fire & Rescue Services - RG Hendricks
Roland2015
 
2015 Land Markets Survey | REALTORS Land Institute & NAR
2015 Land Markets Survey | REALTORS Land Institute & NAR2015 Land Markets Survey | REALTORS Land Institute & NAR
2015 Land Markets Survey | REALTORS Land Institute & NAR
REALTORS® Land Institute
 
2014 Land Markets Survey
2014 Land Markets Survey2014 Land Markets Survey
2014 Land Markets Survey
REALTORS® Land Institute
 
Tablas de contenidos
Tablas de contenidosTablas de contenidos
Tablas de contenidos
ximenahdz
 
El sindrome del Impostor - ¿Incapacidad o Pobre Imagen de sí mismo/a?
El sindrome del Impostor - ¿Incapacidad o Pobre Imagen de sí mismo/a?El sindrome del Impostor - ¿Incapacidad o Pobre Imagen de sí mismo/a?
El sindrome del Impostor - ¿Incapacidad o Pobre Imagen de sí mismo/a?
María Clara Ruiz Martínez
 
11 Of The Oddest Pets You Might Want To Look After
11 Of The Oddest Pets You Might Want To Look After11 Of The Oddest Pets You Might Want To Look After
11 Of The Oddest Pets You Might Want To Look After
Jane Clarke
 
Erik Proposal Final
Erik Proposal FinalErik Proposal Final
Erik Proposal FinalErik Messier
 
Lodgement Order dated 28.01.2017 of Registrar Supreme Court of India
Lodgement Order dated 28.01.2017 of  Registrar Supreme Court of IndiaLodgement Order dated 28.01.2017 of  Registrar Supreme Court of India
Lodgement Order dated 28.01.2017 of Registrar Supreme Court of India
Om Prakash Poddar
 
vJUG - The JavaFX Ecosystem
vJUG - The JavaFX EcosystemvJUG - The JavaFX Ecosystem
vJUG - The JavaFX Ecosystem
Andres Almiray
 
Open Source - Hip not Hype
Open Source - Hip not HypeOpen Source - Hip not Hype
Open Source - Hip not Hype
Priyank Kapadia
 
プリンより滑らか。スムーズなアニメーションの作り方
プリンより滑らか。スムーズなアニメーションの作り方プリンより滑らか。スムーズなアニメーションの作り方
プリンより滑らか。スムーズなアニメーションの作り方
brianskold
 
Technical SEO Myths Facts And Theories On Crawl Budget And The Importance Of ...
Technical SEO Myths Facts And Theories On Crawl Budget And The Importance Of ...Technical SEO Myths Facts And Theories On Crawl Budget And The Importance Of ...
Technical SEO Myths Facts And Theories On Crawl Budget And The Importance Of ...
Dawn Anderson MSc DigM
 
Pubcon 2016 - How SEO's can Use PPC to hit their goals
Pubcon 2016 - How SEO's can Use PPC to hit their goalsPubcon 2016 - How SEO's can Use PPC to hit their goals
Pubcon 2016 - How SEO's can Use PPC to hit their goals
Wil Reynolds
 
ARTIFICIAL RETINA/EYE (ASR,BIONIC EYE)
ARTIFICIAL RETINA/EYE (ASR,BIONIC EYE)ARTIFICIAL RETINA/EYE (ASR,BIONIC EYE)
ARTIFICIAL RETINA/EYE (ASR,BIONIC EYE)
prashanth15
 
Marco Gold Standard
Marco Gold StandardMarco Gold Standard
Marco Gold Standard
MarcoTechnologies
 
L'Instrumentation des Bâtiments_LQE
L'Instrumentation des Bâtiments_LQEL'Instrumentation des Bâtiments_LQE
L'Instrumentation des Bâtiments_LQE
ecobuild.brussels
 
2016 Land Markets Survey
2016 Land Markets Survey2016 Land Markets Survey
2016 Land Markets Survey
REALTORS® Land Institute
 

Viewers also liked (20)

Logiciel diagramme
Logiciel diagramme Logiciel diagramme
Logiciel diagramme
 
Serious Animation (an introduction to Web Animations)
Serious Animation (an introduction to Web Animations)Serious Animation (an introduction to Web Animations)
Serious Animation (an introduction to Web Animations)
 
Vision 2030: Gauteng Provincial Fire & Rescue Services - RG Hendricks
Vision 2030: Gauteng Provincial Fire & Rescue Services - RG HendricksVision 2030: Gauteng Provincial Fire & Rescue Services - RG Hendricks
Vision 2030: Gauteng Provincial Fire & Rescue Services - RG Hendricks
 
2015 Land Markets Survey | REALTORS Land Institute & NAR
2015 Land Markets Survey | REALTORS Land Institute & NAR2015 Land Markets Survey | REALTORS Land Institute & NAR
2015 Land Markets Survey | REALTORS Land Institute & NAR
 
2014 Land Markets Survey
2014 Land Markets Survey2014 Land Markets Survey
2014 Land Markets Survey
 
Tablas de contenidos
Tablas de contenidosTablas de contenidos
Tablas de contenidos
 
El sindrome del Impostor - ¿Incapacidad o Pobre Imagen de sí mismo/a?
El sindrome del Impostor - ¿Incapacidad o Pobre Imagen de sí mismo/a?El sindrome del Impostor - ¿Incapacidad o Pobre Imagen de sí mismo/a?
El sindrome del Impostor - ¿Incapacidad o Pobre Imagen de sí mismo/a?
 
11 Of The Oddest Pets You Might Want To Look After
11 Of The Oddest Pets You Might Want To Look After11 Of The Oddest Pets You Might Want To Look After
11 Of The Oddest Pets You Might Want To Look After
 
Erik Proposal Final
Erik Proposal FinalErik Proposal Final
Erik Proposal Final
 
reshma resume
reshma resumereshma resume
reshma resume
 
Lodgement Order dated 28.01.2017 of Registrar Supreme Court of India
Lodgement Order dated 28.01.2017 of  Registrar Supreme Court of IndiaLodgement Order dated 28.01.2017 of  Registrar Supreme Court of India
Lodgement Order dated 28.01.2017 of Registrar Supreme Court of India
 
vJUG - The JavaFX Ecosystem
vJUG - The JavaFX EcosystemvJUG - The JavaFX Ecosystem
vJUG - The JavaFX Ecosystem
 
Open Source - Hip not Hype
Open Source - Hip not HypeOpen Source - Hip not Hype
Open Source - Hip not Hype
 
プリンより滑らか。スムーズなアニメーションの作り方
プリンより滑らか。スムーズなアニメーションの作り方プリンより滑らか。スムーズなアニメーションの作り方
プリンより滑らか。スムーズなアニメーションの作り方
 
Technical SEO Myths Facts And Theories On Crawl Budget And The Importance Of ...
Technical SEO Myths Facts And Theories On Crawl Budget And The Importance Of ...Technical SEO Myths Facts And Theories On Crawl Budget And The Importance Of ...
Technical SEO Myths Facts And Theories On Crawl Budget And The Importance Of ...
 
Pubcon 2016 - How SEO's can Use PPC to hit their goals
Pubcon 2016 - How SEO's can Use PPC to hit their goalsPubcon 2016 - How SEO's can Use PPC to hit their goals
Pubcon 2016 - How SEO's can Use PPC to hit their goals
 
ARTIFICIAL RETINA/EYE (ASR,BIONIC EYE)
ARTIFICIAL RETINA/EYE (ASR,BIONIC EYE)ARTIFICIAL RETINA/EYE (ASR,BIONIC EYE)
ARTIFICIAL RETINA/EYE (ASR,BIONIC EYE)
 
Marco Gold Standard
Marco Gold StandardMarco Gold Standard
Marco Gold Standard
 
L'Instrumentation des Bâtiments_LQE
L'Instrumentation des Bâtiments_LQEL'Instrumentation des Bâtiments_LQE
L'Instrumentation des Bâtiments_LQE
 
2016 Land Markets Survey
2016 Land Markets Survey2016 Land Markets Survey
2016 Land Markets Survey
 

Similar to Animations on Fire - Making Web animations fast

Performance beyond page load - CSS Conf Asia 2015
Performance beyond page load - CSS Conf Asia 2015Performance beyond page load - CSS Conf Asia 2015
Performance beyond page load - CSS Conf Asia 2015
Apoorv Saxena
 
An introduction to html5 by Devs
An introduction to html5 by DevsAn introduction to html5 by Devs
An introduction to html5 by Devs
Debidatta Satapathy
 
Django for n00bs
Django for n00bsDjango for n00bs
Django for n00bs
Jen Zajac
 
Hacking to be performant
Hacking to be performantHacking to be performant
Hacking to be performant
Apoorv Saxena
 
Academy PRO: HTML5 API graphics
Academy PRO: HTML5 API graphicsAcademy PRO: HTML5 API graphics
Academy PRO: HTML5 API graphics
Binary Studio
 
Make your animations perform well - Anna Migas - Codemotion Rome 2017
Make your animations perform well - Anna Migas - Codemotion Rome 2017Make your animations perform well - Anna Migas - Codemotion Rome 2017
Make your animations perform well - Anna Migas - Codemotion Rome 2017
Codemotion
 
It works on your computer... but does it render fast enough?
It works on your computer... but does it render fast enough?It works on your computer... but does it render fast enough?
It works on your computer... but does it render fast enough?
Diogo Antunes
 
How to write an application and not roll down to 1 fps
How to write an application and not roll down to 1 fpsHow to write an application and not roll down to 1 fps
How to write an application and not roll down to 1 fps
IntexSoft
 
Task 4 investigating digital animation
Task 4 investigating digital animationTask 4 investigating digital animation
Task 4 investigating digital animationBenT1990
 
Flyweight jquery select_presentation
Flyweight jquery select_presentationFlyweight jquery select_presentation
Flyweight jquery select_presentation
Ray Brooks
 
Echo HTML5
Echo HTML5Echo HTML5
Echo HTML5
Nathan Smith
 
Techniques For A Modern Web UI (With Notes)
Techniques For A Modern Web UI (With Notes)Techniques For A Modern Web UI (With Notes)
Techniques For A Modern Web UI (With Notes)
patrick.t.joyce
 
CSS3 and a brief introduction to Google Maps API v3
CSS3 and a brief introduction to Google Maps API v3 CSS3 and a brief introduction to Google Maps API v3
CSS3 and a brief introduction to Google Maps API v3
Jeffrey Barke
 
Web Optimisation
Web OptimisationWeb Optimisation
Web Optimisation
Gregory Benner
 
Peterc_Dušan_full_AUTEX16
Peterc_Dušan_full_AUTEX16Peterc_Dušan_full_AUTEX16
Peterc_Dušan_full_AUTEX16dpeterc
 
Fast but not furious: debugging user interaction performance issues
Fast but not furious: debugging user interaction performance issuesFast but not furious: debugging user interaction performance issues
Fast but not furious: debugging user interaction performance issues
Anna Migas
 
DevChatt: The Wonderful World Of Html5
DevChatt: The Wonderful World Of Html5DevChatt: The Wonderful World Of Html5
DevChatt: The Wonderful World Of Html5Cameron Kilgore
 
NordicJS: Fast but not Furious: Debugging User Interaction Performance Issues
NordicJS:  Fast but not Furious: Debugging User Interaction Performance IssuesNordicJS:  Fast but not Furious: Debugging User Interaction Performance Issues
NordicJS: Fast but not Furious: Debugging User Interaction Performance Issues
Anna Migas
 
Client side performance compromises worth making
Client side performance compromises worth makingClient side performance compromises worth making
Client side performance compromises worth making
Cathy Lill
 

Similar to Animations on Fire - Making Web animations fast (20)

Performance beyond page load - CSS Conf Asia 2015
Performance beyond page load - CSS Conf Asia 2015Performance beyond page load - CSS Conf Asia 2015
Performance beyond page load - CSS Conf Asia 2015
 
An introduction to html5 by Devs
An introduction to html5 by DevsAn introduction to html5 by Devs
An introduction to html5 by Devs
 
Django for n00bs
Django for n00bsDjango for n00bs
Django for n00bs
 
Hacking to be performant
Hacking to be performantHacking to be performant
Hacking to be performant
 
Academy PRO: HTML5 API graphics
Academy PRO: HTML5 API graphicsAcademy PRO: HTML5 API graphics
Academy PRO: HTML5 API graphics
 
Make your animations perform well - Anna Migas - Codemotion Rome 2017
Make your animations perform well - Anna Migas - Codemotion Rome 2017Make your animations perform well - Anna Migas - Codemotion Rome 2017
Make your animations perform well - Anna Migas - Codemotion Rome 2017
 
It works on your computer... but does it render fast enough?
It works on your computer... but does it render fast enough?It works on your computer... but does it render fast enough?
It works on your computer... but does it render fast enough?
 
How to write an application and not roll down to 1 fps
How to write an application and not roll down to 1 fpsHow to write an application and not roll down to 1 fps
How to write an application and not roll down to 1 fps
 
Task 4 investigating digital animation
Task 4 investigating digital animationTask 4 investigating digital animation
Task 4 investigating digital animation
 
Flyweight jquery select_presentation
Flyweight jquery select_presentationFlyweight jquery select_presentation
Flyweight jquery select_presentation
 
Echo HTML5
Echo HTML5Echo HTML5
Echo HTML5
 
Techniques For A Modern Web UI (With Notes)
Techniques For A Modern Web UI (With Notes)Techniques For A Modern Web UI (With Notes)
Techniques For A Modern Web UI (With Notes)
 
Testing
TestingTesting
Testing
 
CSS3 and a brief introduction to Google Maps API v3
CSS3 and a brief introduction to Google Maps API v3 CSS3 and a brief introduction to Google Maps API v3
CSS3 and a brief introduction to Google Maps API v3
 
Web Optimisation
Web OptimisationWeb Optimisation
Web Optimisation
 
Peterc_Dušan_full_AUTEX16
Peterc_Dušan_full_AUTEX16Peterc_Dušan_full_AUTEX16
Peterc_Dušan_full_AUTEX16
 
Fast but not furious: debugging user interaction performance issues
Fast but not furious: debugging user interaction performance issuesFast but not furious: debugging user interaction performance issues
Fast but not furious: debugging user interaction performance issues
 
DevChatt: The Wonderful World Of Html5
DevChatt: The Wonderful World Of Html5DevChatt: The Wonderful World Of Html5
DevChatt: The Wonderful World Of Html5
 
NordicJS: Fast but not Furious: Debugging User Interaction Performance Issues
NordicJS:  Fast but not Furious: Debugging User Interaction Performance IssuesNordicJS:  Fast but not Furious: Debugging User Interaction Performance Issues
NordicJS: Fast but not Furious: Debugging User Interaction Performance Issues
 
Client side performance compromises worth making
Client side performance compromises worth makingClient side performance compromises worth making
Client side performance compromises worth making
 

Recently uploaded

JAVIER LASA-EXPERIENCIA digital 1986-2024.pdf
JAVIER LASA-EXPERIENCIA digital 1986-2024.pdfJAVIER LASA-EXPERIENCIA digital 1986-2024.pdf
JAVIER LASA-EXPERIENCIA digital 1986-2024.pdf
Javier Lasa
 
Latest trends in computer networking.pptx
Latest trends in computer networking.pptxLatest trends in computer networking.pptx
Latest trends in computer networking.pptx
JungkooksNonexistent
 
APNIC Foundation, presented by Ellisha Heppner at the PNG DNS Forum 2024
APNIC Foundation, presented by Ellisha Heppner at the PNG DNS Forum 2024APNIC Foundation, presented by Ellisha Heppner at the PNG DNS Forum 2024
APNIC Foundation, presented by Ellisha Heppner at the PNG DNS Forum 2024
APNIC
 
This 7-second Brain Wave Ritual Attracts Money To You.!
This 7-second Brain Wave Ritual Attracts Money To You.!This 7-second Brain Wave Ritual Attracts Money To You.!
This 7-second Brain Wave Ritual Attracts Money To You.!
nirahealhty
 
急速办(bedfordhire毕业证书)英国贝德福特大学毕业证成绩单原版一模一样
急速办(bedfordhire毕业证书)英国贝德福特大学毕业证成绩单原版一模一样急速办(bedfordhire毕业证书)英国贝德福特大学毕业证成绩单原版一模一样
急速办(bedfordhire毕业证书)英国贝德福特大学毕业证成绩单原版一模一样
3ipehhoa
 
test test test test testtest test testtest test testtest test testtest test ...
test test  test test testtest test testtest test testtest test testtest test ...test test  test test testtest test testtest test testtest test testtest test ...
test test test test testtest test testtest test testtest test testtest test ...
Arif0071
 
guildmasters guide to ravnica Dungeons & Dragons 5...
guildmasters guide to ravnica Dungeons & Dragons 5...guildmasters guide to ravnica Dungeons & Dragons 5...
guildmasters guide to ravnica Dungeons & Dragons 5...
Rogerio Filho
 
Multi-cluster Kubernetes Networking- Patterns, Projects and Guidelines
Multi-cluster Kubernetes Networking- Patterns, Projects and GuidelinesMulti-cluster Kubernetes Networking- Patterns, Projects and Guidelines
Multi-cluster Kubernetes Networking- Patterns, Projects and Guidelines
Sanjeev Rampal
 
Internet-Security-Safeguarding-Your-Digital-World (1).pptx
Internet-Security-Safeguarding-Your-Digital-World (1).pptxInternet-Security-Safeguarding-Your-Digital-World (1).pptx
Internet-Security-Safeguarding-Your-Digital-World (1).pptx
VivekSinghShekhawat2
 
1.Wireless Communication System_Wireless communication is a broad term that i...
1.Wireless Communication System_Wireless communication is a broad term that i...1.Wireless Communication System_Wireless communication is a broad term that i...
1.Wireless Communication System_Wireless communication is a broad term that i...
JeyaPerumal1
 
The+Prospects+of+E-Commerce+in+China.pptx
The+Prospects+of+E-Commerce+in+China.pptxThe+Prospects+of+E-Commerce+in+China.pptx
The+Prospects+of+E-Commerce+in+China.pptx
laozhuseo02
 
一比一原版(SLU毕业证)圣路易斯大学毕业证成绩单专业办理
一比一原版(SLU毕业证)圣路易斯大学毕业证成绩单专业办理一比一原版(SLU毕业证)圣路易斯大学毕业证成绩单专业办理
一比一原版(SLU毕业证)圣路易斯大学毕业证成绩单专业办理
keoku
 
BASIC C++ lecture NOTE C++ lecture 3.pptx
BASIC C++ lecture NOTE C++ lecture 3.pptxBASIC C++ lecture NOTE C++ lecture 3.pptx
BASIC C++ lecture NOTE C++ lecture 3.pptx
natyesu
 
一比一原版(LBS毕业证)伦敦商学院毕业证成绩单专业办理
一比一原版(LBS毕业证)伦敦商学院毕业证成绩单专业办理一比一原版(LBS毕业证)伦敦商学院毕业证成绩单专业办理
一比一原版(LBS毕业证)伦敦商学院毕业证成绩单专业办理
eutxy
 
原版仿制(uob毕业证书)英国伯明翰大学毕业证本科学历证书原版一模一样
原版仿制(uob毕业证书)英国伯明翰大学毕业证本科学历证书原版一模一样原版仿制(uob毕业证书)英国伯明翰大学毕业证本科学历证书原版一模一样
原版仿制(uob毕业证书)英国伯明翰大学毕业证本科学历证书原版一模一样
3ipehhoa
 
Comptia N+ Standard Networking lesson guide
Comptia N+ Standard Networking lesson guideComptia N+ Standard Networking lesson guide
Comptia N+ Standard Networking lesson guide
GTProductions1
 
1比1复刻(bath毕业证书)英国巴斯大学毕业证学位证原版一模一样
1比1复刻(bath毕业证书)英国巴斯大学毕业证学位证原版一模一样1比1复刻(bath毕业证书)英国巴斯大学毕业证学位证原版一模一样
1比1复刻(bath毕业证书)英国巴斯大学毕业证学位证原版一模一样
3ipehhoa
 
History+of+E-commerce+Development+in+China-www.cfye-commerce.shop
History+of+E-commerce+Development+in+China-www.cfye-commerce.shopHistory+of+E-commerce+Development+in+China-www.cfye-commerce.shop
History+of+E-commerce+Development+in+China-www.cfye-commerce.shop
laozhuseo02
 
Bridging the Digital Gap Brad Spiegel Macon, GA Initiative.pptx
Bridging the Digital Gap Brad Spiegel Macon, GA Initiative.pptxBridging the Digital Gap Brad Spiegel Macon, GA Initiative.pptx
Bridging the Digital Gap Brad Spiegel Macon, GA Initiative.pptx
Brad Spiegel Macon GA
 
一比一原版(CSU毕业证)加利福尼亚州立大学毕业证成绩单专业办理
一比一原版(CSU毕业证)加利福尼亚州立大学毕业证成绩单专业办理一比一原版(CSU毕业证)加利福尼亚州立大学毕业证成绩单专业办理
一比一原版(CSU毕业证)加利福尼亚州立大学毕业证成绩单专业办理
ufdana
 

Recently uploaded (20)

JAVIER LASA-EXPERIENCIA digital 1986-2024.pdf
JAVIER LASA-EXPERIENCIA digital 1986-2024.pdfJAVIER LASA-EXPERIENCIA digital 1986-2024.pdf
JAVIER LASA-EXPERIENCIA digital 1986-2024.pdf
 
Latest trends in computer networking.pptx
Latest trends in computer networking.pptxLatest trends in computer networking.pptx
Latest trends in computer networking.pptx
 
APNIC Foundation, presented by Ellisha Heppner at the PNG DNS Forum 2024
APNIC Foundation, presented by Ellisha Heppner at the PNG DNS Forum 2024APNIC Foundation, presented by Ellisha Heppner at the PNG DNS Forum 2024
APNIC Foundation, presented by Ellisha Heppner at the PNG DNS Forum 2024
 
This 7-second Brain Wave Ritual Attracts Money To You.!
This 7-second Brain Wave Ritual Attracts Money To You.!This 7-second Brain Wave Ritual Attracts Money To You.!
This 7-second Brain Wave Ritual Attracts Money To You.!
 
急速办(bedfordhire毕业证书)英国贝德福特大学毕业证成绩单原版一模一样
急速办(bedfordhire毕业证书)英国贝德福特大学毕业证成绩单原版一模一样急速办(bedfordhire毕业证书)英国贝德福特大学毕业证成绩单原版一模一样
急速办(bedfordhire毕业证书)英国贝德福特大学毕业证成绩单原版一模一样
 
test test test test testtest test testtest test testtest test testtest test ...
test test  test test testtest test testtest test testtest test testtest test ...test test  test test testtest test testtest test testtest test testtest test ...
test test test test testtest test testtest test testtest test testtest test ...
 
guildmasters guide to ravnica Dungeons & Dragons 5...
guildmasters guide to ravnica Dungeons & Dragons 5...guildmasters guide to ravnica Dungeons & Dragons 5...
guildmasters guide to ravnica Dungeons & Dragons 5...
 
Multi-cluster Kubernetes Networking- Patterns, Projects and Guidelines
Multi-cluster Kubernetes Networking- Patterns, Projects and GuidelinesMulti-cluster Kubernetes Networking- Patterns, Projects and Guidelines
Multi-cluster Kubernetes Networking- Patterns, Projects and Guidelines
 
Internet-Security-Safeguarding-Your-Digital-World (1).pptx
Internet-Security-Safeguarding-Your-Digital-World (1).pptxInternet-Security-Safeguarding-Your-Digital-World (1).pptx
Internet-Security-Safeguarding-Your-Digital-World (1).pptx
 
1.Wireless Communication System_Wireless communication is a broad term that i...
1.Wireless Communication System_Wireless communication is a broad term that i...1.Wireless Communication System_Wireless communication is a broad term that i...
1.Wireless Communication System_Wireless communication is a broad term that i...
 
The+Prospects+of+E-Commerce+in+China.pptx
The+Prospects+of+E-Commerce+in+China.pptxThe+Prospects+of+E-Commerce+in+China.pptx
The+Prospects+of+E-Commerce+in+China.pptx
 
一比一原版(SLU毕业证)圣路易斯大学毕业证成绩单专业办理
一比一原版(SLU毕业证)圣路易斯大学毕业证成绩单专业办理一比一原版(SLU毕业证)圣路易斯大学毕业证成绩单专业办理
一比一原版(SLU毕业证)圣路易斯大学毕业证成绩单专业办理
 
BASIC C++ lecture NOTE C++ lecture 3.pptx
BASIC C++ lecture NOTE C++ lecture 3.pptxBASIC C++ lecture NOTE C++ lecture 3.pptx
BASIC C++ lecture NOTE C++ lecture 3.pptx
 
一比一原版(LBS毕业证)伦敦商学院毕业证成绩单专业办理
一比一原版(LBS毕业证)伦敦商学院毕业证成绩单专业办理一比一原版(LBS毕业证)伦敦商学院毕业证成绩单专业办理
一比一原版(LBS毕业证)伦敦商学院毕业证成绩单专业办理
 
原版仿制(uob毕业证书)英国伯明翰大学毕业证本科学历证书原版一模一样
原版仿制(uob毕业证书)英国伯明翰大学毕业证本科学历证书原版一模一样原版仿制(uob毕业证书)英国伯明翰大学毕业证本科学历证书原版一模一样
原版仿制(uob毕业证书)英国伯明翰大学毕业证本科学历证书原版一模一样
 
Comptia N+ Standard Networking lesson guide
Comptia N+ Standard Networking lesson guideComptia N+ Standard Networking lesson guide
Comptia N+ Standard Networking lesson guide
 
1比1复刻(bath毕业证书)英国巴斯大学毕业证学位证原版一模一样
1比1复刻(bath毕业证书)英国巴斯大学毕业证学位证原版一模一样1比1复刻(bath毕业证书)英国巴斯大学毕业证学位证原版一模一样
1比1复刻(bath毕业证书)英国巴斯大学毕业证学位证原版一模一样
 
History+of+E-commerce+Development+in+China-www.cfye-commerce.shop
History+of+E-commerce+Development+in+China-www.cfye-commerce.shopHistory+of+E-commerce+Development+in+China-www.cfye-commerce.shop
History+of+E-commerce+Development+in+China-www.cfye-commerce.shop
 
Bridging the Digital Gap Brad Spiegel Macon, GA Initiative.pptx
Bridging the Digital Gap Brad Spiegel Macon, GA Initiative.pptxBridging the Digital Gap Brad Spiegel Macon, GA Initiative.pptx
Bridging the Digital Gap Brad Spiegel Macon, GA Initiative.pptx
 
一比一原版(CSU毕业证)加利福尼亚州立大学毕业证成绩单专业办理
一比一原版(CSU毕业证)加利福尼亚州立大学毕业证成绩单专业办理一比一原版(CSU毕业证)加利福尼亚州立大学毕业证成绩单专业办理
一比一原版(CSU毕业证)加利福尼亚州立大学毕业证成绩单专业办理
 

Animations on Fire - Making Web animations fast

  • 1. HTML version of slides: http://people.mozilla.org/~bbirtles/pres/graphical-web-2014/
  • 2.
  • 3. Animations can be used for more than just cat gifs. They can be used to tell stories too.
  • 4. Animation is essentially about using time to convey information.
  • 5. Animation can be used as component of user interface design to describe the results of an action.
  • 6. It can be more intuitive without cluttering the screen or requiring extra explanation.
  • 7. But when animation runs slowly or hesitates, that information is lost. Hence for animation, performance is critical. In order to fix animation performance in Web pages, we really need to understand how browsers work.
  • 8. As we follow the journey from markup to our eyeballs, we will consider how we can make each step smoother or skip it all together.
  • 9.
  • 10. Parsing can be slow. Most browsers do it in a separate thread. If we skip parsing while animating surely it goes faster?
  • 11. A micro-benchmark suggests an API that skips parsing is faster.
  • 12. How about in a real-world animation?
  • 13. It doesn’t make a lot of difference. Perhaps 3~4 fps at best.
  • 14.
  • 15. There are bigger performance gains to be had from the style system. After creating a DOM tree, browsers construct a render tree suitable for painting to the screen.
  • 16. What happens if we exploit the fact that display:none elements don’t appear in the render tree?
  • 17.
  • 18. (Firefox doesn’t show such a big difference in this case since the test case animates ‘top’ which, as we’ll see, does not trigger reflow in Firefox so setting display:none doesn’t have as big an impact.)
  • 19. This technique improved performance for the Parapara animation project where characters are set to display:none when they are off-stage.
  • 20. Of the operations performed in the style system, the layout/reflow step is often expensive.
  • 21. We can measure style resolution and layout time in profiling tools in Firefox (above) and Chrome (below).
  • 22. Firefox lets you inspect reflow (layout) in the console.
  • 23. Let’s see how different animations affect layout
  • 24. Animating margin-top causes reflow on every frame
  • 25. But in Firefox, animating top or transform does not trigger reflow (layout)
  • 26.
  • 27. Comparing the performance of margin-top and transform, transform is faster because it avoids reflow but it also benefits from layerization which we will see later.
  • 28.
  • 29. Since these processes can be expensive, browsers avoid doing them until either they have to paint, or until script asks a question about the current state.
  • 30.
  • 31.
  • 32.
  • 33. Painting is often the most expensive part. Firefox creates a display list of items to paint, then creates a layer tree into which it paints. The layers in the tree are then composited together.
  • 34.
  • 35. We can see exactly what area is being painted
  • 36.
  • 37.
  • 38. When animating transform we only paint once at the start. This is because it gets put in its own layer.
  • 39. When animating independent areas Chrome seems to paint the union of dirty areas so layerization can be more important there.
  • 40. However, SVG filters are often hardware accelerated. Sometimes the combination of features is what is slow.
  • 41.
  • 42. We can sometimes make things faster by pre-rendering. Desktop apps, native apps, Flash apps, everyone does it.
  • 43. Alternatively, for SVG, simply referring to the SVG using <img> instead of <iframe> lets the browser make more optimizations. Especially Firefox.
  • 44. Most browsers hardware accelerate layer compositing. That means they can often paint an animated element once then just change its transform, opacity etc. and let the GPU re-composite. That saves a lot of painting.
  • 45. It’s up to the browser what gets a layer. Typically it’s things like the above.
  • 46.
  • 48.
  • 49.
  • 50. In the previous example, we can see why the transform animation only gets painted once. That element has its own layer.
  • 51. Layerization is performed by the browser so it can automatically do it for SVG (SMIL) animation too.
  • 52. And even for scripted animation, the browser can detect that an element is moving a lot and decide it would benefit from being on a separate layer. (The red boxes in this example indicate image layers.)
  • 53. Often, however, the browser won’t create a layer until an element starts animating. Sometimes that can be too late and can cause the animation to stutter at the start as the browser sets up the layer.
  • 54. will-change:transform/ opacity/etc. lets the browser create the layer in advance if it thinks that would help improve performance. transform:translateZ(0) doesn’t work cross- browser
  • 55.
  • 56.
  • 57.
  • 58. Apart from low frame-rates, animation performance is affected by other processes on the same thread like layout, garbage collection, or other scripts, that cause the animation to stop and start (jank).
  • 59. To avoid jank, some animations can be run on a separate thread/process.
  • 60. Unlike animations running on the main thread which stop and start…
  • 61. … these animations continue along uninterrupted.
  • 62. But not everything can be animated in this way. In particular, when the browser doesn’t know all the parameters of the animation—like most scripted animations—the browser can’t delegate the animation to another thread/process.
  • 63. One way around this is to use the Web Animations API to create animations. This lets the browser optimize the animation in the same way as it does for declarative animations like CSS Animations/Transitions.
  • 65.
  • 66.
  • 67.
  • 68.
  • 69. Using our knowledge of how browsers work we can make animations that run smoothly on any browser on any device and convey their intended effect.
  • 70. HTML version of slides: http://people.mozilla.org/~bbirtles/pres/graphical-web-2014/