Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Super Smooth Animations
Search
Giacomo "Giko" Zinetti
March 16, 2018
Programming
1
100
Super Smooth Animations
Speech for CSSDay in Faenza (Italy)
March, 16th 2018
Live on
https://cssday2018.slides.giko.it/
Giacomo "Giko" Zinetti
March 16, 2018
Tweet
Share
More Decks by Giacomo "Giko" Zinetti
See All by Giacomo "Giko" Zinetti
Cmd Alt I - Chrome Dev tools
gcmznt
0
76
ES2015 new features
gcmznt
0
54
CSS from the future
gcmznt
0
38
Web performance & Http2
gcmznt
0
59
CSS variables
gcmznt
2
110
CSS Performance
gcmznt
2
82
Other Decks in Programming
See All in Programming
AgentCoreとHuman in the Loop
har1101
5
230
Rust 製のコードエディタ “Zed” を使ってみた
nearme_tech
PRO
0
170
OCaml 5でモダンな並列プログラミングを Enjoyしよう!
haochenx
0
140
Architectural Extensions
denyspoltorak
0
280
Grafana:建立系統全知視角的捷徑
blueswen
0
330
2026年 エンジニアリング自己学習法
yumechi
0
130
コマンドとリード間の連携に対する脅威分析フレームワーク
pandayumi
1
450
FOSDEM 2026: STUNMESH-go: Building P2P WireGuard Mesh Without Self-Hosted Infrastructure
tjjh89017
0
160
[KNOTS 2026登壇資料]AIで拡張‧交差する プロダクト開発のプロセス および携わるメンバーの役割
hisatake
0
280
Data-Centric Kaggle
isax1015
2
770
MDN Web Docs に日本語翻訳でコントリビュート
ohmori_yusuke
0
650
Oxlint JS plugins
kazupon
1
890
Featured
See All Featured
Future Trends and Review - Lecture 12 - Web Technologies (1019888BNR)
signer
PRO
0
3.2k
Effective software design: The role of men in debugging patriarchy in IT @ Voxxed Days AMS
baasie
0
220
Visual Storytelling: How to be a Superhuman Communicator
reverentgeek
2
430
How to optimise 3,500 product descriptions for ecommerce in one day using ChatGPT
katarinadahlin
PRO
0
3.4k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.7k
Exploring anti-patterns in Rails
aemeredith
2
250
Navigating the Design Leadership Dip - Product Design Week Design Leaders+ Conference 2024
apolaine
0
170
How People are Using Generative and Agentic AI to Supercharge Their Products, Projects, Services and Value Streams Today
helenjbeal
1
120
Introduction to Domain-Driven Design and Collaborative software design
baasie
1
580
Practical Orchestrator
shlominoach
191
11k
技術選定の審美眼(2025年版) / Understanding the Spiral of Technologies 2025 edition
twada
PRO
117
110k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
508
140k
Transcript
Super smooth animations
Expectation Expectation
Reality Reality
Battery drain Battery drain
Device Device overheating overheating
Maillard Maillard
Giacomo Zinetti Giacomo Zinetti @gcmznt @gcmznt
How browser How browser renders? renders?
Render Render cycle cycle JavaScript JavaScript Style Style Layout Layout
Paint Paint Composite Composite
Our logic Our logic JavaScript JavaScript Style Style Layout Layout
Paint Paint Composite Composite
margin margin padding padding Reflow Reflow JavaScript JavaScript Style Style
Layout Layout Paint Paint Composite Composite
color color background background Repaint Repaint JavaScript JavaScript Style Style
Layout Layout Paint Paint Composite Composite
transform transform opacity opacity Compose Compose JavaScript JavaScript Style Style
Layout Layout Paint Paint Composite Composite
CSS CSS
Animate Animate compositor-only compositor-only properties properties
Execute long JS task Start heavy JS loop Left Translate
Create layers Create layers will-change will-change
❌ ❌ * { * { will-change: transform; will-change: transform;
} }
Disable hover Disable hover on scroll on scroll
JS JS
Avoid forced Avoid forced synchronous synchronous layout layout
❌ ❌ elements.forEach(el => { elements.forEach(el => { el.querySelector('img').style.width el.querySelector('img').style.width
= `${el.offsetWidth}px`; = `${el.offsetWidth}px`; }) })
elements.forEach((el, i) => { elements.forEach((el, i) => { ws[i] =
el.offsetWidth; ws[i] = el.offsetWidth; }) }) elements.forEach((el, i) => { elements.forEach((el, i) => { el.querySelector('img').style.width el.querySelector('img').style.width = `${ws[i]}px`; = `${ws[i]}px`; }) })
rAF rAF requestAnimationFrame() requestAnimationFrame()
rIC rIC requestIdleCallback() requestIdleCallback()
Split big tasks Split big tasks
Web workers Web workers
TARGET TARGET RAIL RAIL
Response <100ms Response <100ms Animation <16ms Animation <16ms Idle <50ms
Idle <50ms Load <1000ms Load <1000ms
FLIP FLIP by @aerotwist by @aerotwist
First First const first = const first = el.getBoundingClientRect(); el.getBoundingClientRect();
Last Last el.classList.toggle('end'); el.classList.toggle('end'); const last = const last =
el.getBoundingClientRect(); el.getBoundingClientRect();
Invert Invert const invert = const invert = first.height /
last.height; first.height / last.height;
Play Play el.animate([ el.animate([ { transform: `scale(${invert}px)` }, { transform:
`scale(${invert}px)` }, { transform: 'scale(0)' } { transform: 'scale(0)' } ], 300); ], 300);
First First Last Last Invert Invert Play Play
None
Content Content VS VS Animations Animations
Users! Users!
The best animation The best animation is the invisible one
is the invisible one Thank you Thank you
Links Links This slides Codepen examples Feedbacks are welcome! Web
Fundamentals: Performance CSS Triggers FLIP by @aerotwist