SlideShare ist ein Scribd-Unternehmen logo
1 von 70
Downloaden Sie, um offline zu lesen
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/

Weitere ähnliche Inhalte

Was ist angesagt?

What is flutter and why should i care?
What is flutter and why should i care?What is flutter and why should i care?
What is flutter and why should i care?Sergi Martínez
 
What's new in NextJS 13_.pdf
What's new in NextJS 13_.pdfWhat's new in NextJS 13_.pdf
What's new in NextJS 13_.pdfTapanPatel847364
 
Getting started with flutter
Getting started with flutterGetting started with flutter
Getting started with flutterrihannakedy
 
Web deveopment using React js and Node js with SQL.
Web deveopment using React js and Node js with SQL.Web deveopment using React js and Node js with SQL.
Web deveopment using React js and Node js with SQL.Jayant Surana
 
PlayStation®4向けARPGのUnity開発事例 最適化と効率化の秘密
PlayStation®4向けARPGのUnity開発事例 最適化と効率化の秘密PlayStation®4向けARPGのUnity開発事例 最適化と効率化の秘密
PlayStation®4向けARPGのUnity開発事例 最適化と効率化の秘密Gemdrops Inc.
 
Blockchain Developer Geography 2023 by Electric Capital
Blockchain Developer Geography 2023 by Electric CapitalBlockchain Developer Geography 2023 by Electric Capital
Blockchain Developer Geography 2023 by Electric CapitalMariaShen2
 
Introduction to react
Introduction to reactIntroduction to react
Introduction to reactkiranabburi
 
Push notification to the open web
Push notification to the open webPush notification to the open web
Push notification to the open webAhmed Gamal
 
Erlang Software Developer CV
Erlang Software Developer CVErlang Software Developer CV
Erlang Software Developer CVAlex Radetsky
 
OpenCVで作るスタンプAR
OpenCVで作るスタンプAROpenCVで作るスタンプAR
OpenCVで作るスタンプARTakashi Yoshinaga
 
What and Why Flutter? What is a Widget in Flutter?
What and Why Flutter? What is a Widget in Flutter?What and Why Flutter? What is a Widget in Flutter?
What and Why Flutter? What is a Widget in Flutter?MohammadHussain595488
 
Build web applications using google flutter
Build web applications using google flutterBuild web applications using google flutter
Build web applications using google flutterAhmed Abu Eldahab
 
Intro to vue.js
Intro to vue.jsIntro to vue.js
Intro to vue.jsTechMagic
 
個人開発でゲーム一本完成させるまでの苦難の道のり 〜企画編〜
個人開発でゲーム一本完成させるまでの苦難の道のり 〜企画編〜個人開発でゲーム一本完成させるまでの苦難の道のり 〜企画編〜
個人開発でゲーム一本完成させるまでの苦難の道のり 〜企画編〜narumi_
 
【Unite 2017 Tokyo】Unity+WebGLでゲームを開発・運用して見えてきたメリット・デメリット
【Unite 2017 Tokyo】Unity+WebGLでゲームを開発・運用して見えてきたメリット・デメリット【Unite 2017 Tokyo】Unity+WebGLでゲームを開発・運用して見えてきたメリット・デメリット
【Unite 2017 Tokyo】Unity+WebGLでゲームを開発・運用して見えてきたメリット・デメリットUnite2017Tokyo
 
【準備編!】HoloLens 2/Oculus Quest対応WebXRハンズオン
【準備編!】HoloLens 2/Oculus Quest対応WebXRハンズオン【準備編!】HoloLens 2/Oculus Quest対応WebXRハンズオン
【準備編!】HoloLens 2/Oculus Quest対応WebXRハンズオンTakashi Yoshinaga
 
【Unite Tokyo 2018】XRで心地よい3D体験を生むための、絵画的空間構成手法とUnityへの実装
【Unite Tokyo 2018】XRで心地よい3D体験を生むための、絵画的空間構成手法とUnityへの実装【Unite Tokyo 2018】XRで心地よい3D体験を生むための、絵画的空間構成手法とUnityへの実装
【Unite Tokyo 2018】XRで心地よい3D体験を生むための、絵画的空間構成手法とUnityへの実装UnityTechnologiesJapan002
 
UE4エンジンソースをMacでビルドしてみた
UE4エンジンソースをMacでビルドしてみたUE4エンジンソースをMacでビルドしてみた
UE4エンジンソースをMacでビルドしてみたYuuki Ogino
 

Was ist angesagt? (20)

UX Workshop
UX WorkshopUX Workshop
UX Workshop
 
What is flutter and why should i care?
What is flutter and why should i care?What is flutter and why should i care?
What is flutter and why should i care?
 
What's new in NextJS 13_.pdf
What's new in NextJS 13_.pdfWhat's new in NextJS 13_.pdf
What's new in NextJS 13_.pdf
 
Getting started with flutter
Getting started with flutterGetting started with flutter
Getting started with flutter
 
Web deveopment using React js and Node js with SQL.
Web deveopment using React js and Node js with SQL.Web deveopment using React js and Node js with SQL.
Web deveopment using React js and Node js with SQL.
 
PlayStation®4向けARPGのUnity開発事例 最適化と効率化の秘密
PlayStation®4向けARPGのUnity開発事例 最適化と効率化の秘密PlayStation®4向けARPGのUnity開発事例 最適化と効率化の秘密
PlayStation®4向けARPGのUnity開発事例 最適化と効率化の秘密
 
Blockchain Developer Geography 2023 by Electric Capital
Blockchain Developer Geography 2023 by Electric CapitalBlockchain Developer Geography 2023 by Electric Capital
Blockchain Developer Geography 2023 by Electric Capital
 
Introduction to react
Introduction to reactIntroduction to react
Introduction to react
 
Push notification to the open web
Push notification to the open webPush notification to the open web
Push notification to the open web
 
Erlang Software Developer CV
Erlang Software Developer CVErlang Software Developer CV
Erlang Software Developer CV
 
OpenCVで作るスタンプAR
OpenCVで作るスタンプAROpenCVで作るスタンプAR
OpenCVで作るスタンプAR
 
What and Why Flutter? What is a Widget in Flutter?
What and Why Flutter? What is a Widget in Flutter?What and Why Flutter? What is a Widget in Flutter?
What and Why Flutter? What is a Widget in Flutter?
 
Build web applications using google flutter
Build web applications using google flutterBuild web applications using google flutter
Build web applications using google flutter
 
Intro to vue.js
Intro to vue.jsIntro to vue.js
Intro to vue.js
 
What is Swagger?
What is Swagger?What is Swagger?
What is Swagger?
 
個人開発でゲーム一本完成させるまでの苦難の道のり 〜企画編〜
個人開発でゲーム一本完成させるまでの苦難の道のり 〜企画編〜個人開発でゲーム一本完成させるまでの苦難の道のり 〜企画編〜
個人開発でゲーム一本完成させるまでの苦難の道のり 〜企画編〜
 
【Unite 2017 Tokyo】Unity+WebGLでゲームを開発・運用して見えてきたメリット・デメリット
【Unite 2017 Tokyo】Unity+WebGLでゲームを開発・運用して見えてきたメリット・デメリット【Unite 2017 Tokyo】Unity+WebGLでゲームを開発・運用して見えてきたメリット・デメリット
【Unite 2017 Tokyo】Unity+WebGLでゲームを開発・運用して見えてきたメリット・デメリット
 
【準備編!】HoloLens 2/Oculus Quest対応WebXRハンズオン
【準備編!】HoloLens 2/Oculus Quest対応WebXRハンズオン【準備編!】HoloLens 2/Oculus Quest対応WebXRハンズオン
【準備編!】HoloLens 2/Oculus Quest対応WebXRハンズオン
 
【Unite Tokyo 2018】XRで心地よい3D体験を生むための、絵画的空間構成手法とUnityへの実装
【Unite Tokyo 2018】XRで心地よい3D体験を生むための、絵画的空間構成手法とUnityへの実装【Unite Tokyo 2018】XRで心地よい3D体験を生むための、絵画的空間構成手法とUnityへの実装
【Unite Tokyo 2018】XRで心地よい3D体験を生むための、絵画的空間構成手法とUnityへの実装
 
UE4エンジンソースをMacでビルドしてみた
UE4エンジンソースをMacでビルドしてみたUE4エンジンソースをMacでビルドしてみた
UE4エンジンソースをMacでビルドしてみた
 

Andere mochten auch

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 HendricksRoland2015
 
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 & NARREALTORS® Land Institute
 
Tablas de contenidos
Tablas de contenidosTablas de contenidos
Tablas de contenidosximenahdz
 
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 AfterJane 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 IndiaOm Prakash Poddar
 
vJUG - The JavaFX Ecosystem
vJUG - The JavaFX EcosystemvJUG - The JavaFX Ecosystem
vJUG - The JavaFX EcosystemAndres Almiray
 
Open Source - Hip not Hype
Open Source - Hip not HypeOpen Source - Hip not Hype
Open Source - Hip not HypePriyank 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 goalsWil 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
 
L'Instrumentation des Bâtiments_LQE
L'Instrumentation des Bâtiments_LQEL'Instrumentation des Bâtiments_LQE
L'Instrumentation des Bâtiments_LQEecobuild.brussels
 

Andere mochten auch (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
 

Ähnlich wie 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 2015Apoorv Saxena
 
An introduction to html5 by Devs
An introduction to html5 by DevsAn introduction to html5 by Devs
An introduction to html5 by DevsDebidatta Satapathy
 
Django for n00bs
Django for n00bsDjango for n00bs
Django for n00bsJen Zajac
 
Hacking to be performant
Hacking to be performantHacking to be performant
Hacking to be performantApoorv Saxena
 
Academy PRO: HTML5 API graphics
Academy PRO: HTML5 API graphicsAcademy PRO: HTML5 API graphics
Academy PRO: HTML5 API graphicsBinary 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 2017Codemotion
 
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 fpsIntexSoft
 
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_presentationRay Brooks
 
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
 
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 issuesAnna 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 IssuesAnna Migas
 
Client side performance compromises worth making
Client side performance compromises worth makingClient side performance compromises worth making
Client side performance compromises worth makingCathy Lill
 

Ähnlich wie 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
 

Kürzlich hochgeladen

定制(Lincoln毕业证书)新西兰林肯大学毕业证成绩单原版一比一
定制(Lincoln毕业证书)新西兰林肯大学毕业证成绩单原版一比一定制(Lincoln毕业证书)新西兰林肯大学毕业证成绩单原版一比一
定制(Lincoln毕业证书)新西兰林肯大学毕业证成绩单原版一比一Fs
 
A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)
A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)
A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)Christopher H Felton
 
定制(Management毕业证书)新加坡管理大学毕业证成绩单原版一比一
定制(Management毕业证书)新加坡管理大学毕业证成绩单原版一比一定制(Management毕业证书)新加坡管理大学毕业证成绩单原版一比一
定制(Management毕业证书)新加坡管理大学毕业证成绩单原版一比一Fs
 
Contact Rya Baby for Call Girls New Delhi
Contact Rya Baby for Call Girls New DelhiContact Rya Baby for Call Girls New Delhi
Contact Rya Baby for Call Girls New Delhimiss dipika
 
Call Girls South Delhi Delhi reach out to us at ☎ 9711199012
Call Girls South Delhi Delhi reach out to us at ☎ 9711199012Call Girls South Delhi Delhi reach out to us at ☎ 9711199012
Call Girls South Delhi Delhi reach out to us at ☎ 9711199012rehmti665
 
定制(AUT毕业证书)新西兰奥克兰理工大学毕业证成绩单原版一比一
定制(AUT毕业证书)新西兰奥克兰理工大学毕业证成绩单原版一比一定制(AUT毕业证书)新西兰奥克兰理工大学毕业证成绩单原版一比一
定制(AUT毕业证书)新西兰奥克兰理工大学毕业证成绩单原版一比一Fs
 
Top 10 Interactive Website Design Trends in 2024.pptx
Top 10 Interactive Website Design Trends in 2024.pptxTop 10 Interactive Website Design Trends in 2024.pptx
Top 10 Interactive Website Design Trends in 2024.pptxDyna Gilbert
 
Call Girls Near The Suryaa Hotel New Delhi 9873777170
Call Girls Near The Suryaa Hotel New Delhi 9873777170Call Girls Near The Suryaa Hotel New Delhi 9873777170
Call Girls Near The Suryaa Hotel New Delhi 9873777170Sonam Pathan
 
Film cover research (1).pptxsdasdasdasdasdasa
Film cover research (1).pptxsdasdasdasdasdasaFilm cover research (1).pptxsdasdasdasdasdasa
Film cover research (1).pptxsdasdasdasdasdasa494f574xmv
 
定制(UAL学位证)英国伦敦艺术大学毕业证成绩单原版一比一
定制(UAL学位证)英国伦敦艺术大学毕业证成绩单原版一比一定制(UAL学位证)英国伦敦艺术大学毕业证成绩单原版一比一
定制(UAL学位证)英国伦敦艺术大学毕业证成绩单原版一比一Fs
 
办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一
办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一
办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一z xss
 
Font Performance - NYC WebPerf Meetup April '24
Font Performance - NYC WebPerf Meetup April '24Font Performance - NYC WebPerf Meetup April '24
Font Performance - NYC WebPerf Meetup April '24Paul Calvano
 
Magic exist by Marta Loveguard - presentation.pptx
Magic exist by Marta Loveguard - presentation.pptxMagic exist by Marta Loveguard - presentation.pptx
Magic exist by Marta Loveguard - presentation.pptxMartaLoveguard
 
办理多伦多大学毕业证成绩单|购买加拿大UTSG文凭证书
办理多伦多大学毕业证成绩单|购买加拿大UTSG文凭证书办理多伦多大学毕业证成绩单|购买加拿大UTSG文凭证书
办理多伦多大学毕业证成绩单|购买加拿大UTSG文凭证书zdzoqco
 
Blepharitis inflammation of eyelid symptoms cause everything included along w...
Blepharitis inflammation of eyelid symptoms cause everything included along w...Blepharitis inflammation of eyelid symptoms cause everything included along w...
Blepharitis inflammation of eyelid symptoms cause everything included along w...Excelmac1
 
Potsdam FH学位证,波茨坦应用技术大学毕业证书1:1制作
Potsdam FH学位证,波茨坦应用技术大学毕业证书1:1制作Potsdam FH学位证,波茨坦应用技术大学毕业证书1:1制作
Potsdam FH学位证,波茨坦应用技术大学毕业证书1:1制作ys8omjxb
 
Call Girls Service Adil Nagar 7001305949 Need escorts Service Pooja Vip
Call Girls Service Adil Nagar 7001305949 Need escorts Service Pooja VipCall Girls Service Adil Nagar 7001305949 Need escorts Service Pooja Vip
Call Girls Service Adil Nagar 7001305949 Need escorts Service Pooja VipCall Girls Lucknow
 
Call Girls In The Ocean Pearl Retreat Hotel New Delhi 9873777170
Call Girls In The Ocean Pearl Retreat Hotel New Delhi 9873777170Call Girls In The Ocean Pearl Retreat Hotel New Delhi 9873777170
Call Girls In The Ocean Pearl Retreat Hotel New Delhi 9873777170Sonam Pathan
 
Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)
Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)
Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)Dana Luther
 

Kürzlich hochgeladen (20)

定制(Lincoln毕业证书)新西兰林肯大学毕业证成绩单原版一比一
定制(Lincoln毕业证书)新西兰林肯大学毕业证成绩单原版一比一定制(Lincoln毕业证书)新西兰林肯大学毕业证成绩单原版一比一
定制(Lincoln毕业证书)新西兰林肯大学毕业证成绩单原版一比一
 
A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)
A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)
A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)
 
定制(Management毕业证书)新加坡管理大学毕业证成绩单原版一比一
定制(Management毕业证书)新加坡管理大学毕业证成绩单原版一比一定制(Management毕业证书)新加坡管理大学毕业证成绩单原版一比一
定制(Management毕业证书)新加坡管理大学毕业证成绩单原版一比一
 
Contact Rya Baby for Call Girls New Delhi
Contact Rya Baby for Call Girls New DelhiContact Rya Baby for Call Girls New Delhi
Contact Rya Baby for Call Girls New Delhi
 
Call Girls South Delhi Delhi reach out to us at ☎ 9711199012
Call Girls South Delhi Delhi reach out to us at ☎ 9711199012Call Girls South Delhi Delhi reach out to us at ☎ 9711199012
Call Girls South Delhi Delhi reach out to us at ☎ 9711199012
 
定制(AUT毕业证书)新西兰奥克兰理工大学毕业证成绩单原版一比一
定制(AUT毕业证书)新西兰奥克兰理工大学毕业证成绩单原版一比一定制(AUT毕业证书)新西兰奥克兰理工大学毕业证成绩单原版一比一
定制(AUT毕业证书)新西兰奥克兰理工大学毕业证成绩单原版一比一
 
Top 10 Interactive Website Design Trends in 2024.pptx
Top 10 Interactive Website Design Trends in 2024.pptxTop 10 Interactive Website Design Trends in 2024.pptx
Top 10 Interactive Website Design Trends in 2024.pptx
 
Call Girls Near The Suryaa Hotel New Delhi 9873777170
Call Girls Near The Suryaa Hotel New Delhi 9873777170Call Girls Near The Suryaa Hotel New Delhi 9873777170
Call Girls Near The Suryaa Hotel New Delhi 9873777170
 
Film cover research (1).pptxsdasdasdasdasdasa
Film cover research (1).pptxsdasdasdasdasdasaFilm cover research (1).pptxsdasdasdasdasdasa
Film cover research (1).pptxsdasdasdasdasdasa
 
定制(UAL学位证)英国伦敦艺术大学毕业证成绩单原版一比一
定制(UAL学位证)英国伦敦艺术大学毕业证成绩单原版一比一定制(UAL学位证)英国伦敦艺术大学毕业证成绩单原版一比一
定制(UAL学位证)英国伦敦艺术大学毕业证成绩单原版一比一
 
办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一
办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一
办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一
 
Font Performance - NYC WebPerf Meetup April '24
Font Performance - NYC WebPerf Meetup April '24Font Performance - NYC WebPerf Meetup April '24
Font Performance - NYC WebPerf Meetup April '24
 
Model Call Girl in Jamuna Vihar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in  Jamuna Vihar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in  Jamuna Vihar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Jamuna Vihar Delhi reach out to us at 🔝9953056974🔝
 
Magic exist by Marta Loveguard - presentation.pptx
Magic exist by Marta Loveguard - presentation.pptxMagic exist by Marta Loveguard - presentation.pptx
Magic exist by Marta Loveguard - presentation.pptx
 
办理多伦多大学毕业证成绩单|购买加拿大UTSG文凭证书
办理多伦多大学毕业证成绩单|购买加拿大UTSG文凭证书办理多伦多大学毕业证成绩单|购买加拿大UTSG文凭证书
办理多伦多大学毕业证成绩单|购买加拿大UTSG文凭证书
 
Blepharitis inflammation of eyelid symptoms cause everything included along w...
Blepharitis inflammation of eyelid symptoms cause everything included along w...Blepharitis inflammation of eyelid symptoms cause everything included along w...
Blepharitis inflammation of eyelid symptoms cause everything included along w...
 
Potsdam FH学位证,波茨坦应用技术大学毕业证书1:1制作
Potsdam FH学位证,波茨坦应用技术大学毕业证书1:1制作Potsdam FH学位证,波茨坦应用技术大学毕业证书1:1制作
Potsdam FH学位证,波茨坦应用技术大学毕业证书1:1制作
 
Call Girls Service Adil Nagar 7001305949 Need escorts Service Pooja Vip
Call Girls Service Adil Nagar 7001305949 Need escorts Service Pooja VipCall Girls Service Adil Nagar 7001305949 Need escorts Service Pooja Vip
Call Girls Service Adil Nagar 7001305949 Need escorts Service Pooja Vip
 
Call Girls In The Ocean Pearl Retreat Hotel New Delhi 9873777170
Call Girls In The Ocean Pearl Retreat Hotel New Delhi 9873777170Call Girls In The Ocean Pearl Retreat Hotel New Delhi 9873777170
Call Girls In The Ocean Pearl Retreat Hotel New Delhi 9873777170
 
Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)
Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)
Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)
 

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/