SlideShare une entreprise Scribd logo
1  sur  70
Télécharger pour lire hors ligne
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/

Contenu connexe

Tendances

Cloud-Native Integration with Apache Camel on Kubernetes (Copenhagen October ...
Cloud-Native Integration with Apache Camel on Kubernetes (Copenhagen October ...Cloud-Native Integration with Apache Camel on Kubernetes (Copenhagen October ...
Cloud-Native Integration with Apache Camel on Kubernetes (Copenhagen October ...
Claus Ibsen
 
RedisConf17 - Distributed Java Map Structures and Services with Redisson
RedisConf17 - Distributed Java Map Structures and Services with RedissonRedisConf17 - Distributed Java Map Structures and Services with Redisson
RedisConf17 - Distributed Java Map Structures and Services with Redisson
Redis Labs
 

Tendances (20)

NVMe over Fabrics Demystified
NVMe over Fabrics Demystified NVMe over Fabrics Demystified
NVMe over Fabrics Demystified
 
SeaweedFS introduction
SeaweedFS introductionSeaweedFS introduction
SeaweedFS introduction
 
Node.js BFFs: our way to better/micro frontends
Node.js BFFs: our way to better/micro frontendsNode.js BFFs: our way to better/micro frontends
Node.js BFFs: our way to better/micro frontends
 
XenDesktop / XenAppの可用性を最大化するポッドアーキテクチャとは
XenDesktop / XenAppの可用性を最大化するポッドアーキテクチャとはXenDesktop / XenAppの可用性を最大化するポッドアーキテクチャとは
XenDesktop / XenAppの可用性を最大化するポッドアーキテクチャとは
 
Estimation of a micro services based estimation application bhawna thakur -...
Estimation of a micro services based estimation application   bhawna thakur -...Estimation of a micro services based estimation application   bhawna thakur -...
Estimation of a micro services based estimation application bhawna thakur -...
 
Cloud-Native Integration with Apache Camel on Kubernetes (Copenhagen October ...
Cloud-Native Integration with Apache Camel on Kubernetes (Copenhagen October ...Cloud-Native Integration with Apache Camel on Kubernetes (Copenhagen October ...
Cloud-Native Integration with Apache Camel on Kubernetes (Copenhagen October ...
 
Introduction to Spark Streaming
Introduction to Spark StreamingIntroduction to Spark Streaming
Introduction to Spark Streaming
 
Hadoop World 2011: Advanced HBase Schema Design
Hadoop World 2011: Advanced HBase Schema DesignHadoop World 2011: Advanced HBase Schema Design
Hadoop World 2011: Advanced HBase Schema Design
 
Hands-on Lab: How to Unleash Your Storage Performance by Using NVM Express™ B...
Hands-on Lab: How to Unleash Your Storage Performance by Using NVM Express™ B...Hands-on Lab: How to Unleash Your Storage Performance by Using NVM Express™ B...
Hands-on Lab: How to Unleash Your Storage Performance by Using NVM Express™ B...
 
Practical experiences and best practices for SSD and IBM i
Practical experiences and best practices for SSD and IBM iPractical experiences and best practices for SSD and IBM i
Practical experiences and best practices for SSD and IBM i
 
Anemia &amp; transfusion
Anemia &amp; transfusion Anemia &amp; transfusion
Anemia &amp; transfusion
 
MonetDB :column-store approach in database
MonetDB :column-store approach in databaseMonetDB :column-store approach in database
MonetDB :column-store approach in database
 
RedisConf17 - Distributed Java Map Structures and Services with Redisson
RedisConf17 - Distributed Java Map Structures and Services with RedissonRedisConf17 - Distributed Java Map Structures and Services with Redisson
RedisConf17 - Distributed Java Map Structures and Services with Redisson
 
Best Practices for Streaming IoT Data with MQTT and Apache Kafka®
Best Practices for Streaming IoT Data with MQTT and Apache Kafka®Best Practices for Streaming IoT Data with MQTT and Apache Kafka®
Best Practices for Streaming IoT Data with MQTT and Apache Kafka®
 
Apache Spark & Hadoop
Apache Spark & HadoopApache Spark & Hadoop
Apache Spark & Hadoop
 
Frame - Feature Management for Productive Machine Learning
Frame - Feature Management for Productive Machine LearningFrame - Feature Management for Productive Machine Learning
Frame - Feature Management for Productive Machine Learning
 
Show Me Kafka Tools That Will Increase My Productivity! (Stephane Maarek, Dat...
Show Me Kafka Tools That Will Increase My Productivity! (Stephane Maarek, Dat...Show Me Kafka Tools That Will Increase My Productivity! (Stephane Maarek, Dat...
Show Me Kafka Tools That Will Increase My Productivity! (Stephane Maarek, Dat...
 
Apache Kafka Architecture & Fundamentals Explained
Apache Kafka Architecture & Fundamentals ExplainedApache Kafka Architecture & Fundamentals Explained
Apache Kafka Architecture & Fundamentals Explained
 
Paying To Win
Paying To WinPaying To Win
Paying To Win
 
Event driven architecture with Kafka
Event driven architecture with KafkaEvent driven architecture with Kafka
Event driven architecture with Kafka
 

En vedette

Erik Proposal Final
Erik Proposal FinalErik Proposal Final
Erik Proposal Final
Erik Messier
 

En vedette (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
 

Similaire à Animations on Fire - Making Web animations fast

Task 4 investigating digital animation
Task 4 investigating digital animationTask 4 investigating digital animation
Task 4 investigating digital animation
BenT1990
 
Peterc_Dušan_full_AUTEX16
Peterc_Dušan_full_AUTEX16Peterc_Dušan_full_AUTEX16
Peterc_Dušan_full_AUTEX16
dpeterc
 
DevChatt: The Wonderful World Of Html5
DevChatt: The Wonderful World Of Html5DevChatt: The Wonderful World Of Html5
DevChatt: The Wonderful World Of Html5
Cameron Kilgore
 

Similaire à 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
 

Dernier

Lucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRL
Lucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRLLucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRL
Lucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRL
imonikaupta
 
Call Girls In Pratap Nagar Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Pratap Nagar Delhi 💯Call Us 🔝8264348440🔝Call Girls In Pratap Nagar Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Pratap Nagar Delhi 💯Call Us 🔝8264348440🔝
soniya singh
 
Dwarka Sector 26 Call Girls | Delhi | 9999965857 🫦 Vanshika Verma More Our Se...
Dwarka Sector 26 Call Girls | Delhi | 9999965857 🫦 Vanshika Verma More Our Se...Dwarka Sector 26 Call Girls | Delhi | 9999965857 🫦 Vanshika Verma More Our Se...
Dwarka Sector 26 Call Girls | Delhi | 9999965857 🫦 Vanshika Verma More Our Se...
Call Girls In Delhi Whatsup 9873940964 Enjoy Unlimited Pleasure
 
Call Girls In Defence Colony Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Defence Colony Delhi 💯Call Us 🔝8264348440🔝Call Girls In Defence Colony Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Defence Colony Delhi 💯Call Us 🔝8264348440🔝
soniya singh
 
AWS Community DAY Albertini-Ellan Cloud Security (1).pptx
AWS Community DAY Albertini-Ellan Cloud Security (1).pptxAWS Community DAY Albertini-Ellan Cloud Security (1).pptx
AWS Community DAY Albertini-Ellan Cloud Security (1).pptx
ellan12
 

Dernier (20)

VIP Model Call Girls NIBM ( Pune ) Call ON 8005736733 Starting From 5K to 25K...
VIP Model Call Girls NIBM ( Pune ) Call ON 8005736733 Starting From 5K to 25K...VIP Model Call Girls NIBM ( Pune ) Call ON 8005736733 Starting From 5K to 25K...
VIP Model Call Girls NIBM ( Pune ) Call ON 8005736733 Starting From 5K to 25K...
 
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
 
VIP Model Call Girls Hadapsar ( Pune ) Call ON 9905417584 Starting High Prof...
VIP Model Call Girls Hadapsar ( Pune ) Call ON 9905417584 Starting  High Prof...VIP Model Call Girls Hadapsar ( Pune ) Call ON 9905417584 Starting  High Prof...
VIP Model Call Girls Hadapsar ( Pune ) Call ON 9905417584 Starting High Prof...
 
VVIP Pune Call Girls Sinhagad WhatSapp Number 8005736733 With Elite Staff And...
VVIP Pune Call Girls Sinhagad WhatSapp Number 8005736733 With Elite Staff And...VVIP Pune Call Girls Sinhagad WhatSapp Number 8005736733 With Elite Staff And...
VVIP Pune Call Girls Sinhagad WhatSapp Number 8005736733 With Elite Staff And...
 
Russian Call girl in Ajman +971563133746 Ajman Call girl Service
Russian Call girl in Ajman +971563133746 Ajman Call girl ServiceRussian Call girl in Ajman +971563133746 Ajman Call girl Service
Russian Call girl in Ajman +971563133746 Ajman Call girl Service
 
All Time Service Available Call Girls Mg Road 👌 ⏭️ 6378878445
All Time Service Available Call Girls Mg Road 👌 ⏭️ 6378878445All Time Service Available Call Girls Mg Road 👌 ⏭️ 6378878445
All Time Service Available Call Girls Mg Road 👌 ⏭️ 6378878445
 
On Starlink, presented by Geoff Huston at NZNOG 2024
On Starlink, presented by Geoff Huston at NZNOG 2024On Starlink, presented by Geoff Huston at NZNOG 2024
On Starlink, presented by Geoff Huston at NZNOG 2024
 
Lucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRL
Lucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRLLucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRL
Lucknow ❤CALL GIRL 88759*99948 ❤CALL GIRLS IN Lucknow ESCORT SERVICE❤CALL GIRL
 
𓀤Call On 7877925207 𓀤 Ahmedguda Call Girls Hot Model With Sexy Bhabi Ready Fo...
𓀤Call On 7877925207 𓀤 Ahmedguda Call Girls Hot Model With Sexy Bhabi Ready Fo...𓀤Call On 7877925207 𓀤 Ahmedguda Call Girls Hot Model With Sexy Bhabi Ready Fo...
𓀤Call On 7877925207 𓀤 Ahmedguda Call Girls Hot Model With Sexy Bhabi Ready Fo...
 
Call Girls In Pratap Nagar Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Pratap Nagar Delhi 💯Call Us 🔝8264348440🔝Call Girls In Pratap Nagar Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Pratap Nagar Delhi 💯Call Us 🔝8264348440🔝
 
Call Now ☎ 8264348440 !! Call Girls in Sarai Rohilla Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Sarai Rohilla Escort Service Delhi N.C.R.Call Now ☎ 8264348440 !! Call Girls in Sarai Rohilla Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Sarai Rohilla Escort Service Delhi N.C.R.
 
(+971568250507 ))# Young Call Girls in Ajman By Pakistani Call Girls in ...
(+971568250507  ))#  Young Call Girls  in Ajman  By Pakistani Call Girls  in ...(+971568250507  ))#  Young Call Girls  in Ajman  By Pakistani Call Girls  in ...
(+971568250507 ))# Young Call Girls in Ajman By Pakistani Call Girls in ...
 
Dwarka Sector 26 Call Girls | Delhi | 9999965857 🫦 Vanshika Verma More Our Se...
Dwarka Sector 26 Call Girls | Delhi | 9999965857 🫦 Vanshika Verma More Our Se...Dwarka Sector 26 Call Girls | Delhi | 9999965857 🫦 Vanshika Verma More Our Se...
Dwarka Sector 26 Call Girls | Delhi | 9999965857 🫦 Vanshika Verma More Our Se...
 
Russian Call Girls in %(+971524965298 )# Call Girls in Dubai
Russian Call Girls in %(+971524965298  )#  Call Girls in DubaiRussian Call Girls in %(+971524965298  )#  Call Girls in Dubai
Russian Call Girls in %(+971524965298 )# Call Girls in Dubai
 
Call Girls In Defence Colony Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Defence Colony Delhi 💯Call Us 🔝8264348440🔝Call Girls In Defence Colony Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Defence Colony Delhi 💯Call Us 🔝8264348440🔝
 
Shikrapur - Call Girls in Pune Neha 8005736733 | 100% Gennuine High Class Ind...
Shikrapur - Call Girls in Pune Neha 8005736733 | 100% Gennuine High Class Ind...Shikrapur - Call Girls in Pune Neha 8005736733 | 100% Gennuine High Class Ind...
Shikrapur - Call Girls in Pune Neha 8005736733 | 100% Gennuine High Class Ind...
 
DDoS In Oceania and the Pacific, presented by Dave Phelan at NZNOG 2024
DDoS In Oceania and the Pacific, presented by Dave Phelan at NZNOG 2024DDoS In Oceania and the Pacific, presented by Dave Phelan at NZNOG 2024
DDoS In Oceania and the Pacific, presented by Dave Phelan at NZNOG 2024
 
VVVIP Call Girls In Connaught Place ➡️ Delhi ➡️ 9999965857 🚀 No Advance 24HRS...
VVVIP Call Girls In Connaught Place ➡️ Delhi ➡️ 9999965857 🚀 No Advance 24HRS...VVVIP Call Girls In Connaught Place ➡️ Delhi ➡️ 9999965857 🚀 No Advance 24HRS...
VVVIP Call Girls In Connaught Place ➡️ Delhi ➡️ 9999965857 🚀 No Advance 24HRS...
 
Call Now ☎ 8264348440 !! Call Girls in Shahpur Jat Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Shahpur Jat Escort Service Delhi N.C.R.Call Now ☎ 8264348440 !! Call Girls in Shahpur Jat Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Shahpur Jat Escort Service Delhi N.C.R.
 
AWS Community DAY Albertini-Ellan Cloud Security (1).pptx
AWS Community DAY Albertini-Ellan Cloud Security (1).pptxAWS Community DAY Albertini-Ellan Cloud Security (1).pptx
AWS Community DAY Albertini-Ellan Cloud Security (1).pptx
 

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/